PDA

View Full Version : Fog in register combiners using nvparse



knackered
02-14-2002, 06:28 AM
Can someone tell me how to express the fog equation in nvparse?
I came up with this (please don't laugh, I'm still struggling with rc's in nvparse, mainly because I can't find any docs on it!):-
final_product = tex3 * col0;
out.rgb = fog.rgb * unsigned_invert(fog.a) + final_product.rgb * fog.a;
out.a = unsigned_invert(zero);

This doesn't work - it comes up with an error.
Please help.
The reason I'm doing this is because I'm doing reflecting bumpmapping in vertex programs/texture shaders, but I can't get the final output to be tex3*col0 with fog.

davepermen
02-14-2002, 06:49 AM
out.rgb = lerp(fog.a,fog.rgb,final_product.rgb);

i guess its that, or fog and final_product swapped..

docs are out there enough on nvidias page, just take the time to download all the .pdf files and read them..

knackered
02-14-2002, 07:05 AM
Thanks for the answer Dave, but...
No, that doesn't work (swapping fog & final still comes up with an error).
This is my entire reg combiner script:-

!!RC1.0
final_product = tex0*col0;
out.rgb = lerp(fog.a, final_product.rgb, fog.rgb);
out.a = unsigned_invert(zero);

I get an error on line 1.
I really can't find any documents on nvparse with register combiners on the nvidia website or in the sdk. There's a "nvparse and texture shaders" presentation, but that's it.

PH
02-14-2002, 07:17 AM
In the OpenGL SDK, the presentation ProgrammableTextureBlending.ppt has some infomation on using nvparse.

I haven't used nvparse but from you post, using just the final combiner might be the error. Try inserting a stage before the final combiner stage ( that just discards results ).

knackered
02-14-2002, 07:23 AM
No, I've seen a few examples where just the final combiner is used, and it works fine. If I did this:-
!!RC1.0
out.rgb = tex0.rgb * col0.rgb;
out.a = unsigned_invert(zero);

.. I get the expected result...it's just when it comes to fog (which I believe is only available in the final combiner) I can't get it to work.

So that isn't the problem, thanks anyway.

knackered
02-14-2002, 07:33 AM
PH, I could kiss you!
Thank you for pointing out the "ProgrammableTextureBlending.ppt" document, it held the answer within!

The combiner should look like this:-

!!RC1.0
final_product = tex3*col0;
out.rgb = lerp(fog.a, final_product, fog);
out.a = unsigned_invert(zero);

That's it, it works!

PH
02-14-2002, 07:51 AM
You're welcome. I just checked the rc1.0_grammar.y file and as you noted, using just the final combiner is allowed ( the parser inserts the blank stage automatically ).