PDA

View Full Version : Gouraud Texture shading



zroobavela
02-12-2002, 08:17 AM
Hi,
(This question has actually been asked before but not answered, so let's try again...)

I need to use the texture equivalent of gouraud shading on a triangle. That is, somehow assign a differet texture to each vertex - and smoothly shade the triangle.
Multitexturing/env_combine/multipass texturing have great blending capabilities - but these seem to be per triangle. I.e., you can't change textures between glBegin() and glEnd(). At least, I could not find a way to do so.
To sum up, does anyone know how to assign different texture images to vertices in order to smoothly shade these textures across a single triangle?

thx

jabe
02-12-2002, 08:22 AM
multitexturing is per pixel. if you would have three texture units, you could bind all three textures once and blend between them in one pass over the triangle.
a working example i do not have in mind yet, so try to figure out it by yourself.

regards,
jan

Moshe Nissim
02-12-2002, 08:39 AM
Continuing the above (binding and activating 3 texture units). Assign per-vertex colors (1,0,0) (0,1,0) and (0,0,1). The color interpolator gives you then in (r,g,b) the 3 weights for the 3 texture units. Use register combiners to compute r*tex0 + g*tex1 + b*tex2