Rendering normal maps using multiple UVs

I have a model with several UV layouts. Each layout corresponds to a material that is used for different parts of the model. Each of these materials in turn has a colour map and a normal map.

However, it seems Blender can only work with one UV layout at a time. I can only get normal mapping for one of the UV layouts, by clicking one of the Set rendering UV texture buttons, and not all of the layouts at the same time.

As an aside, this also seems to be affecting my ability to export my model. I’ve tried exporting my model a couple of times and it always seemed to only export information for one of the layouts instead of all of them, causing the model to have missing textures. I’ve tried Wavefront OBJ and Collada.

I think this comes down to workflow. When exporting an object you just use all the same maps in both programs to the exported OBJ, FBX or whatever format you’re using and reassign them in the new host. Be aware that with Normal Maps you want to FlipX colours for compatibility of Blender versus most other 3D Apps. There are Mix and Stenciling options in Blender which should allow for merging normal maps just like mixing diffuse maps (you can get hi-res detail map overlaying a low res general normal map this way, see: http://www.blendernation.com/2009/07/25/realtime-stone-with-detail-maps-in-blender/ )

You can also merge multiple maps in photoshop, gimp etc using “overlay” to combine them.

I’m not sure I understand what you’re saying, so let me elaborate.

In Blender I have this:

http://img83.imageshack.us/img83/8252/uvlayouts.png

I have a single texture pair for each of these layouts, one diffuse and one normal. I also have a set of materials that each cover specific parts of my model, and these materials use one of the texture pairs governed by their respective layout.

Notice that “Gloves” is active. This enables normal mapping for the “glove” part of my model, as featured here:

http://img385.imageshack.us/img385/3456/glovedetailed.png

This is at the expense of the other parts of the model. The parts of the model that use the “Body” or “Mane” layout, for example, are flat. But if I select one of those other layouts, then the gloves (and any other parts of the model) become flat:

http://img31.imageshack.us/img31/755/gloveundetailed.png

Here, the “Body” layout is active, which is the layout that the texturing of the hand is a part of. Notice how the hands have a bit more detail at the expense of the glove.

In regards to exporting; notice how I have multiple UV layouts. When I tried exporting it seemed only the “active” layout got exported; the other layouts are lost which leads to missing textures.

When I map characters I usually only use one UV layout for the full character (with everything carefully spread out to make the most of the full UV space) and then with that same layout I have separate image textures for diffuse (colour), specular, bump or normals and so on. I haven’t really used multiple UV layers the way you have, where instead I would have just made bigger maps (powers of two etc) if I needed higher resolution.

This layering looks to me like a way of saving multiple alternative UV layouts. It could be useful if you wanted to apply a map from someone who had used the same object but had the seams positioned differently, you could use it to switch textures in a way that provides “per shot” close up detail of different areas (e.g. one shot has the character with face close to camera, whereas on another shot their hand reaches out: rreposition UV area to suit camera positioned texture stretching), BlenderArt magazine issue 12 has a way of using it to remove seams by baking the seam areas at the middle of UV islands and painting the joins (BlenderArt magazine, issue 12 p.23 “Texture Seam Removal Using Multi-UV & Render Bake” by Eric Pranausk). You could almost think of those UV layers as different “saves” of your UV layout.

UV layering may be useful for combining several “project from view” layouts but then I would want to bake the results onto one properly unwrapped map using a similar method to the layer merging show in the BlenderArt article, which may be a solution for your problem.

So I would say the “standard” UV setup would be to have a single map where the whole model is unwrapped and laid out properly, not multiple UV maps for each different part. If someone has a tutorial or something to show I’m missing something here I’d be keen to learn though.

So, does that mean that multiple UVs are unusable for putting separate texture images on separate parts of the model? Is there another way to use different images for different parts of the model (as opposed to layered on top of the same parts of a model) instead of having everything in a single image?

This is actually important for me because my model is for a Half-Life 2 mod, where I want my model to have moveable eyes. From what I can tell from the documentation, each eye needs its own texture file for the engine’s eye shader to work.

I’m a bit disappointed that Blender seems to lack this functionality for multiple textures. I know Softimage XSI is able to handle models with textures like this. I tried exporting an XSI file from blender and open it up in XSI Mod Tool, but it crashed. :no:

Well, yes blender can “can handle” layered UVs with different layers for different parts pretty much as you describe. I was working with some gamers a while back in Blender (mainly doing the rigging of premade game models) and their models were exactly that… the eye UV covered the whole UV area and had its own texturemap.

…thing is, you never you never said what you’re really doing until now, so is it any wonder that I approached your question in the context of what I am doing, which is from the perspective of character animation for movies? It’s not really fair on Blender or its developers if you get all disapointed when you’ve been hiding essential parts of your request like that.

I don’t know anything about HL2, though I suspect your question has more to do with exporting to the game format. I found this thread which looks at an import script so you can examine, in Blender, what HL2 characters should look like…
http://blenderartists.org/forum/showthread.php?t=103724
…but of course I’m only taking a stab in the dark here.

Perhaps you could start a new thread about exporting to HL2 from blender?

O.K. I’m sorry about getting too worked up. In regards to the apparent lack of detail in my post, I didn’t want to get too specific since I was wanting a general answer that could be applied to other situations similar to what I’m in (i.e. not specifically about exporting to the Half-Life 2 model format).

What I’m actually attempting to do is transferring my model to XSI Mod Tool for rigging and creating facial animations. I know Blender exporters to the Half-Life 2 format exist, but XSI has some specific tools that I want to use that I don’t see in the Blender plugins.

So, I need to export my model to some intermediary format like OBJ, Collada, or native XSI. An XSI file I exported made Mod Tool crash when I tried to open it. OBJ and Collada files only preserved a single UV layout, giving the missing texture effect (I saw this when checking them through Blender; I didn’t try importing those files into Mod Tool).

There’s also still the issue that the normal mapping for one UV layout can be active at a time when rendering. While technically not my real concern, I thought I’d draw attention to it since it may be indicative of other problems.

Yeah - with regards to the XSI crash (which I think is more your root problem) perhaps you could find out as much about what’s really going wrong as you can (e.g. are there reported console errors from XSI? Does it happen with the default cube or only with certain models?), then file a bug report?

When I was studying animation using Maya I didn’t want to use pirated software at home, so I was exporting between school (Maya) and home (Blender). In the process I discovered bugs in the UV mapper with exported & imported models. On filing the bug, I received word from the developer that he thought Maya was at fault in terms of what it thought an .obj could handle. Then, when I gave him several import comparisons (first Maya <=> Blender, then Blender <=> Blender and then Maya <=> Maya) I was able to prove the mesh was going out of kilter in the Blender part of the pipeline… he then fixed the problem in the developmental SVN branch overnight.

Some developers are more responsive than others, and I wish they would fix the search function on the tracker site, as it’s near impossible to tell if your bug has already been filed. This does sound like a serious bug though and I think you should submit it with an attached XSI file example.

O.K. I’ll look into the XSI export problem some more. I would like to figure out how to transfer my model to Mod Tool without redoing all of my textures.

I’m still curious about how to get the normal maps using all of the UV layouts working in the renderer though.