View Full Version : How to use Vertex colors to blend different texture, as in a Game engine ?
06-02-2006, 08:46 AM
How to use Vertex colors to blend different texture, as in a Game engine ?
I've got a terrain to create, and I want to use 10 different Colors in order to Paint different texture on my ground plane.
R G B
128 0 0
255 0 0
0 128 0
0 255 0
255 128 0
255 255 0
0 0 128
0 0 255
0 255 128
0 255 255
So How I can do my shader to works ? I need to aplly a specified File texture to a specified Vertex color . Should I'll be restricted to just 3 colors/ 3 texture cause RGB ?
i also faced with something similar a while ago so here u go :)
(btw this works ok if you paint vertex colors with the face option. Else you'll need to paint different colors and not V values ;))
and here's how to use the mentalrayVertexColors node:
06-02-2006, 11:14 AM
Thanks a Lot Yashu !
But at this time I've already done the same shader as you by lear some info about the mentarayVertexColos node in the Help.
But in your shader, What do you use between you mentalrayVertexColors Output and the LayerTexture2 Alpha ?
I mean , you'll need to connect the mentalrayVertexColors.Output to a Stencil.Input and select a KeyColor to define a Black and White area by selecting just the RGB 255.128.0 color for exemple in order to use it as an alpha to the LayerTexture2.Alpha.
Isn't it ? I've tried to recreate you shader tree but my renders appears totaly Black :sad:
I want to use a Stencil utilities, to just have to work on just one CPV Map. That's why I use KeyMasking.
Here my Test Scene :
ehehe didn't know maya has color keying nodes lol :D much easyer this way that the condition loops :P
ok took a look at that scene and it seems your problem is that you connected the wrong colorSet to the mentalrayVertexColors.cpvSets (aka in your scene you have to connect the shape.colorSet.colorName to the mrVC.cpvSets). So after you set up the mrVC plug it in the stencil node.input then adjust the hsv settings and set the default color to white and the other to black. Now plug this stencil into the luminance and then use that as the alpha for the layered texture :)
but there seems to be some problems where three or more colors blend in the vertex colors map... i couldn't make the stencil make a smooth transition there, obtaining rough alphas matching the mesh topology... who knows maybe there if you play with the stencil settings you can fix that. Though an workaround would be to paint the vertex colors using the Face option in the artisan tool (unsmoothed vertex colors).
hope it helps
06-03-2006, 09:02 AM
less flexible is baking the vertex colors to texture maps and using that as an alpha
06-06-2006, 08:51 AM
right.. thanks for your post Yashu !
Yes I want to use a stencil node, but my problem was I want an hardware preview of my multitexturing, in order to see the result in a Third party software who's designed for realtime game engine.
Has the thread (http://how%20to%20blend%202%20textures%20in%20maya7.../) you've post the link, it was exactly what I want to do, but with some particularity.
I mean I want to use many different colors in RGB and I can't use just a grey scale. I want to blend more than 2 texture with just one source (in my case Vertex Colors). I think Roh Test result from a Grey scale CPV source, so I can't achieve the same result with an RGB file texture.
I can use instead a File Texture with a blend map coded in RGB with just 5 colors for exemple. But I really need to use the Stencil node to get the blend map of one layer texture. I really didn't want a Sharp blending, but a Smooth blending :-)
here my result:
Notice that I've test many different technique: Layered Texture to a lambert, Layered Shader, JS_Mix20Layer from JS script package, JS_Multilayer; and MentalRayCPV shader.
Can I get a smoothed blending If I use a Sharp texture file (8 x 8 pixels) ?
06-06-2006, 08:51 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.