UVW mapping and Ofusion

Raskriall

30-09-2008 22:41:02

hi,

i'm working on a terrain texture and now i'm facing a small problem. as you can see on the screenshot, i have a texture of rock setted as the main terrain. and there's a a TGA image ( the green spot), which i have to place at a specifc location on my terrain.



each texture as been set in a textureUnit in a Ofusion material. As you can see in the perspective viewport, i'm using a UVW map to position the right place of my green spot using map channel 5. if i enter the number 5 in map channel in my textureUnit setup, the green spot just disappear.

is there any way to make this work ? or there's a work arround ?

thx for the help ! :)

Lioric

02-10-2008 02:40:09

Texture channels in Ogre are zero based (0 in the Texture Unit UV channel is 1 in Max texture map channel, this will change in upcoming updates to be the same channel in both systems)

Have you tested with the 4 in the map channel of the texture?

Raskriall

02-10-2008 15:51:20

thanks for the info, but still wont work. i first thought that was my VertexPaint modifier causing the problem, so i tested without it, and still no result.
also, when i'm using the vertexTextureBlend program, the texture to be set by the UVW mapping is not even showing.

here some more informations about my material:

vertex shader program : vertexTextureBlendVS
pixel shader program : vertexTextureBlend

only one pass is set yet.

the texture to be setup with the UVW mapping is the fourth textureUnit.
the UVW mapping is set to map channel 5, so basically, with your information, the textureUnit who need to be set, should have map channel set to 4.

i working with the Ofusion Pro version.

thx for the help ! :D

Lioric

02-10-2008 22:53:11

That is because a shader controls all the rendering of the objects with the shader applied to, if the shader was made to use 4 textures, then that is all of the textures that will be used, even if you add more texunits to the pass they wont be used in the shader, as without modification it is not aware of the new texture, you need to manually add that texture unit to the shader to use it

Add a 2d sampler to the fragment shader, and a texcoord channel to the vertex and fragment shaders, sample this texture with the new uvs from the channel you added (in your case the 4 channel) and blend the result as needed with the other colors

If you prefer a simple solution (without modifications to the shader), then add a new pass to the material, set the the texture unit you need and blend with the previous pass (using the scene blend modes as needed)