PDA

View Full Version : NV dependant AR reads.



Nutty
07-28-2002, 02:12 PM
If I setup texture unit 2 to be an AR dependant read. And the previous input texture unit is unit 1.

Can I do this..




glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB);
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_RGB);

glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB, GL_TEXTURE1_ARB, GL_DISCARD_NV, GL_DISCARD_NV,
GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);

i.e. get a value from the cubemap that is Texture unit 1, and write out the dot product of Unit 0 and 1, back to unit 1, for use as the dependant AR values in texture unit 2?

I seem to get constant values from Texture unit 2, when the result of the dot product should vary.

cheers,

Nutty

andrewl
07-28-2002, 05:31 PM
Sorry, there's no feedback from the register combiners to the texture shaders. In the register combiners, the GL_TEXTUREx_ARB registers function as scratch registers that are initialised with the texture values.

The dependent AR read in stage 2 will use whatever value was generated by the texture shader instruction in stage 1, i.e. the original GL_TEXTURE1_ARB value.

I was in a situation where I wanted to normalise two vectors, dot them, then do a 1-D texture lookup. I just decided that one of the vectors didn't actually change much over the polygon. Therefore it could be normalised in the vertex shader and fed directly to the dot product instruction, while the other vector got the per-pixel normalise.

Nutty
07-28-2002, 11:55 PM
Ahh right, thats what I figured. Since it's legal to write to the textureN_Arb regs in the register combiners, I wasn't sure which value it would use for the dependant AR read.

Unfortunatly doing my vectors at the per-vertex level wont work, as my polys are huge.

What I'm trying to do is power up my specular, without using vast amounts of Combiner stages. I figured I'd do the dot product, then use the result to look up a gradient texture. Is there anyway to do that on NV hardware?

Nutty

edit - Ahh.. I'm starting to see what those texture shader dot products are for now http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by Nutty (edited 07-29-2002).]

davepermen
07-29-2002, 03:36 AM
the combiners process entierly after the texshaders, no way to interfer..

and yes, thats why the texshaderdp3 are there.. there is a good .ppt document online explaining all the posibilities of texshaders. what you want is not entierly possible but you can approx it..