Sign in to follow this  
Yhonatan

MultiTexturing + VBO?

Recommended Posts

Yhonatan    115
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

Share this post


Link to post
Share on other sites
sebbit    224
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)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this