PDA

View Full Version : Combiners and 2 texture units



ChadIsBad
12-19-2005, 03:06 PM
Howdy

My OpenGL app performs dot 3 normalmapping. Now, I need two texture units for this normalmapping. First one is a normalization cube map, second one is the normalmap. I also have a vertex shader that transforms things into tangent space, and I also wish to do some simple light effects, such as attenuation and light color.

I can calculate these effects in my vertex shader, and put them into the output color, but the only way I can get this to be used in the combiner, is if I use 3 units, and have the last texture unit set to just modulate the previous result (after the normalmapping), with GL_PRIMARY_COLOR. I can't find any way to get the output color from my vertex shader used in just two texture units! (And unfortunatly my target platform only has two texture units :( )

Can anyone help me?

dorbie
12-19-2005, 04:16 PM
Try SECONDARY_COLOR, you can also do strange stuff like use vertex fog.

If you have a fragment shader you have other options, like generic attributes but also brute force normalization or some approximation.

There's always normalization in your vertex shader provided your normals are reasonably well behaved, (HINT: subdivision can be your friend).

CrazyButcher
12-19-2005, 10:17 PM
with tex_env_crossbar or tex_env_combine4 extension you can do

unit0: tex0 dot3 tex1
unit1: prev modulate primary