multiple uv's in BGE.

I was wondering if it is possible to use multiple UV’s in the GE.

I have 2 UV maps for an object. In material panel I add two textures to the object.
Both textures are images and have UV as map input. I have also entered the appropriate UV map in the tab UV in map input for each of the textures.

In 3d window everything seems to be working fine and the result is as expected. But when I run the game only the active UV is used. GE won’t use the UV map from the tab UV in map input.

Am I doing something wrong or is it just not possible to use multiple UV’s?

Check this tutorial: http://www.guildofwriters.com/wiki/Lightmapping

One thing to be aware of is that if you apply material utilizing 2 UV layers into an object which has only one UV, the material will fall back to default UV layer in all of the objects. So make sure each and every object having the material does have second UV layer also.

The object already has two UV layers. I will upload a .blend file with the problem as soon as I have time.

Here is a sample .blend file with the problem. In 3d viewport you see the result I want. But when you press P the texture changes.

http://rapidshare.com/files/402812293/multUV.blend.html

I’m not sure if this is what you want, but on your stencil node, instead of using the color output use the normal output instead. That seems to work better.

Thanks for the tip. I’ll try it but I don’t think that’s the problem.

The problem is that in 3d viewport , before I play the game I see the texture as it should be.
When I press P the material alters appearance because the stencil uses as UV the wallUV and not the stencilUV, even though I have assigned stencilUV to that texture.

I don’t know if it is a problem with my GPU (X1950 with catalyst 10.2) or a Blender bug.

Here is the problem: The first image show the wall as in 3d viewport.

The second image is from when I run the game.

Attachments



Your texture setup is a complete mess!!
Don’t use nodes!
The names in the Mesh/UV Texture Panel and the ones in the Map Input/UV: must match ( and not be the same in the two slots!
The loaded images/data slots doesn’t match the ones in the assigned UV’s!
You’re trying to “cut a hole” in a texture, I guess…so you need THREE UV slots in this order:
the “main” one
the “hole” one
the “hole fill” one
only two are enabled
and I forget many more details
read the tutorial pointed by Monster!
Bye

I use nodes because I want to use a stencil map. Doing it the traditional way , stencil map works only for the color maps and not the normal maps. That’s why I had to use nodes (I don’t like them either). If there is a way that stencil map will affect both color and normal maps , I would use it.

1 Like

I had a similar problem with a model. I remember reading somewhere that Glsl only supports one UV map per object. But can anyone back me up on this? As for your nodes, my advice is instead of having brick and plaster in the same material add to your object as a separate material for you plaster, brick and stone textures(do this in the “editing” panel) . Your brick and plaster textures are tiling so you can adjust their scale in the texture scaling section of the mapping options.

Hope this helps.

Edit:
After making the above changes here’s your blend file: http://www.pasteall.org/blend/3040