MultiTexturing + VBO?
Hey guys,
Assuming i got a vbo that contains an entire terrain, and i want each of the triangles to have a different texture + that it will combine together.
how can I do it? do I have to make a vbo for each triangle?
Thanks in advance
You could use a texture atlas, multiple sets of texture coordinates and some blend values to combine the textures in a shader.
So, if you want to combine up to 3 textures per triangle (one for each corner) you would need:
1. The texture atlas (all of your terrain textures packed into one big textures)
2. 3 texture coordinates per vertex (for the 3 textures)
3. 3 blend values (you could pack those into a vertex attribute or you could use per vertex colors)
4. A fragment shader that samples the 3 textures and blends them together using the blend values
(you may also achive that through texture combiners but that is most likely more complicated than to use a shader)
So, if you want to combine up to 3 textures per triangle (one for each corner) you would need:
1. The texture atlas (all of your terrain textures packed into one big textures)
2. 3 texture coordinates per vertex (for the 3 textures)
3. 3 blend values (you could pack those into a vertex attribute or you could use per vertex colors)
4. A fragment shader that samples the 3 textures and blends them together using the blend values
(you may also achive that through texture combiners but that is most likely more complicated than to use a shader)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement