VMF Importer is not loading the UVs correctly (or at all?)

Started by Pocket, July 25, 2019, 07:32:00 PM

Previous topic - Next topic

Pocket

A tiny bit of backstory: Since Propper hasn't worked in like a decade and I'm bad at UV mapping, I'm using Wall Worm's VMF Importer and compile tools as a replacement. But I don't think I fully understand how the VMF importer is supposed to work, because the alignment is all wrong. In Hammer it looked like the figure on the left, but once I import it, remove the teal faces representing nodraw, and set the material to point to a TGA copy of my texture, it looks like the figure on the right. So it looks like the UV info isn't coming through correctly. How fix?

Joris Ceoen

#1
Hello! Are you trying to export the geometry as a static_prop? First make sure that the $staticprop option is ticked on in the WWMT helper settings (it's near the top), otherwise it might export as a prop_dynamic, which could possibly cause some problems, but generally never linked to textures. In case it wasn't, however, please tick it on first.

Now, I can't exactly tell whether the issue it that the texture is just not being exported correctly (since I believe that would make the model pitchblack), but you could try to apply a Reset Xform to the model, then convert it back to an Editable Poly. Then export it once again.

EDIT: I think I just realised what happened. The model on the right is in 3DS Max, right? In that case, it simply looks like the material link is missing. There are 2 scenarios possible, but it's probably the first one:


  • You have the "Show shaded material in viewport" disabled. It's a small button at the top, just under the menu's of the Slate Material editor. Look at the image below for reference.

  • Open the slate material editor ('M' by default)
  • Pick the material from your object (with the Pipet)
  • With the material now in Slate, double-click the material (not the bitmap!) and then press that button that I've highlighted in the image.

It should now show your texture on the model.

If that didn't fix it, you can do the same exact steps, except that you go into the bitmap instead, and verify if it is in fact redirecting to the correct image/path. If that didn't fix it... perhaps the UV's are being incorrectly imported. In that case we'll have to wait for Shawn for a more detailed answer.

Let us know if you were able to fix it!

Pocket

The picture on the right is with the texture rendering; it's just zoomed into the texture so far that just about all you can see is solid colors. In fact, if I export it, the transparency in the texture that I use to make the chain links hollow covers one of the links and the whole bottom, turning them invisible.

Actually, I'm a dummy; I should have checked the UV chart in HLMV to make sure I was right. Here's what it looks like. I can only spot the faces that I said render as invisible; I don't have a clue where the others are.

wallworm

Thanks Joris for helping out.

Normally when it comes to importing a VMF, all the materials and textures should appear correctly in the viewport for you automatically. If the materials/textures are missing, it most likely means one of two things:


  • If using Max 2014 and older, you did not extract the VMT/VTFs from VPK and convert VTFs to TGA files.
  • If using Max 2015+, it likely means WW is not properly set up to find all your assets for your game.

To set up WW correctly in Max 2015+, see Anatomy of a Design Team for a comprehensive breakdown. If you are working in GMod, make sure to also read Gmod and Wall Worm.




In terms of the UVs, brush UVs can import incorrectly if the textures are not found. So check the documents above.

In terms of converting your VMF imports into props, look into this document: Convert Scene to Model

Joris Ceoen

Quote from: Pocket on July 26, 2019, 09:51:26 PM
I can only spot the faces that I said render as invisible; I don't have a clue where the others are.
That's indeed because the UV's have been lost in the process. I don't know all the technical details of the VMF importer, mainly because all my scenes are always made from scratch in 3DS Max itself, but judging from the model itself, it doesn't look like a very hard one to just manually change the UV's. I know you said you don't have much experience with it, but this is probably an excellent occasion to learn it :) I suggest you do this:

  • Select the model
  • Go to the modifier tab, and apply a 'Unwrap UVW' modifier to it
  • Open the UV editor (it's under the Edit UV's map in the modifier)
  • Now, select the polygon subselection (the square image) and press CTRL+A. This will now select all the polygons of your model, they should turn red-ish as reference.
  • In the menu's above this UV Editor, there's one called 'Mapping'. Open it and now press 'Flatten Mapping'. A dialogue opens, but all defaults should be fine. Just press OK and now all your polygons should be seperated in the UV editor.
  • You can now start to move these polygons inside the UV Editor, scale them or move vertices or edges, depending on what needs to go where. If you don't know what polygon is where, it'll be highlighted if you press on it. That way you should start to get familiar with UV-mapping in general. Since this model started out of brushes, the whole texturing itself is basically planar, meaning you won't be needing to do anything but move the squares or scale them up/down.

Hopefully that gives you a start on how to do basic UV-mapping. It's nowhere near as complicated as doing it for something like a character model, but you have to start somewhere. If it really is too complicated, we can wait for Shawn to look why the importer is incorrectly importing your VMF.

Pocket

OK, I see what's happening. I didn't bother importing any textures because I figured they were only needed for previewing the results before compiling. What hadn't occurred to me was that, unlike 3D modeling where UV is defined in terms of percentages of the height and width, Hammer uses absolute pixel counts to store texture alignment, so of course the importer would at least need to know the dimensions of the texture in order to interpret that information correctly.

Anyway, I skimmed the link you posted, and realized I had set the gameinfo directory incorrectly, so I fixed that and reimported... and it's improved the situation somewhat, but not enough. Importing most other VMFs, including other props I'd made for this project years ago (and successfully compiled) works correctly, bringing the textures into /sceneassets/images. (Exhibit A) But a few of them come through with all-black faces and only a relative path in the bitmap parameters. (Exhibit B) And the only difference I can tell is that the ones that don't work have textures stored in BGRA8888 format. So... maybe it really is a bug after all?

Also worth mentioning is that I tried importing some VMFs whose textures were renamed since I last used them, and those came through as cyan instead of black. So it's definitely behaving differently depending on whether it can't find the texture at all or just can't read it.

Joris Ceoen

In this case, I would simply suggest you convert your texture into the DXT1 format. I can't possibly believe that the RGBA8888 format would cause an error, but since I never ever use this format (you should never, for prop_statics, in my opinion) it could just be the reason. Then try importing it again, and see if it comes through. As Shawn already stated, if your textures are missing upon import, UV's may be invalid. Since yours aren't coming through, aka black as can be seen in your screenshot, it's most likely the reason for error.

Pocket

Re-saving as BGR888 and rebooting 3ds Max did the trick. I think from now on I'm just going to use alpha-free versions of the textures for when I build the prop in Hammer, since I'm having to use a separate copy anyway that's outside of /materials/models/. I'm certain that way back when I started this project (using 3ds Max 2013 and whatever version of Wall Worm was available back then) it didn't matter, but it was also so long ago that I have no idea what the process was like.

Joris Ceoen

Quote from: Pocket on July 30, 2019, 01:47:02 AM
Re-saving as BGR888 and rebooting 3ds Max did the trick. I think from now on I'm just going to use alpha-free versions of the textures for when I build the prop in Hammer, since I'm having to use a separate copy anyway that's outside of /materials/models/. I'm certain that way back when I started this project (using 3ds Max 2013 and whatever version of Wall Worm was available back then) it didn't matter, but it was also so long ago that I have no idea what the process was like.
Glad to hear you've been able to solve it! Just out of curiosity, since I assume this model will be used as a prop_static... but why are you using this format? It's file-heavy and is almost never used by Valve for level design (mainly on weapon textures, if I'm correct). In the very early days of mapping, I dabbled a little with different texture formats, but never saw any significant difference, if at all. I had heared on forums about people saying it saves the colors better etc, but never saw Valve using this format, ever.

SMF spam blocked by CleanTalk