View Full Version : Best way to blend n number of textures?

05-04-2003, 02:08 AM
I need to blend multiple textures (each with it's own alpha map for transparency) and would like to know the best/most efficient way to do it.

Let me explain what I would like to do using a simple equation :

((Texture1 blend with Alpha Map1) * 0.2) *
((Texture2 blend with Alpha Map2) * 0.2) *
((Texture3 blend with Alpha Map3) * 0.2) *
((Texture4 blend with Alpha Map4) * 0.2) *
((Texture5 blend with Alpha Map5) * 0.2) => combine with the color of my primitives (triangles) => display

From what I've read multitexturing seems to be limited to very few textures but I need to blend up to a dozen layers at a time.
Is multi pass the best way to do it?

Also I want OpenGL to only apply the lighting after I've done all the blending - how do I tell it to do it in that order?
Do I just enable the lighting at the end?

The problem is that I don't fully understand the order in which OpenGL goes about processing images. Like what buffers it moves the data between and when and how it applies all the different types of filters.