- Home /
Shader: is this possible? vertex colors for the blending and parallax mapping?
the reason why I ask this question is because I need to know if this could work so that I can plan my assets better. I have never written a shader bevore so thats why I ask.
I decided for my game to work with modular parts in the size of a square meter or 2 or 4 square meter. because I want to take the advantage of batching and occlusion culling, I want to use more texture atlases.
so I had the idea to use a texture atlas with 4 textures inside.
diffuse RGBA : texture atlas: one nice looking texture, one a bit dirty looking texture, one really dirty looking one and one that has some other stuff on it. the alpha channel should be used as a blending map or as the hightmap for its paralax part.
normal RGBA : just normal map and the alpha like above.
on the models I want to paint some vertex colors so that every model would be batched even if they all look different ingame because of the blending with the vertex colors.
I came to this vertex color blending idea because of this youtube video. http://www.youtube.com/watch?v=HDXwSEUYrbI
is it possible to offset the texture via shader for red, blue, green and white painted vertices and use at the same time parallax mapping? or do I need to set every texture offset by hand with more texture fields?
I dont ask so that someone create this for me I just ask if this is possible like I described above. I just want to make sure that the floor and the walls in my game dont look always the same but use not too much textures so that the game has lowest drawcalls as possible.
Answer by equalsequals · Jul 02, 2013 at 03:05 PM
This is completely possible.
Using vertex colours as texture offsets is a very popular technique to achieve effects like flow maps.
The idea is that you choose a maximum offset value for U and V and then modify the original UV coordinate by the vector you have created by the R and G channels.
Since any mapping, be it albedo, normal, specular, etc. relies on the UV coordinates, the basic theory should be the same.
Hope that helps.
==