Hello,everyone
I get the depth peeling code from NV demos (C. Everitt).I'm not familier with shader programming. Can you please try to interpret this fragment code?
char _fp_peel[] =
"!!ARBfp1.0\n"
"OPTION ARB_fragment_program_shadow;\n"
"TEMP R0;\n"
"TEX R0.x, fragment.position, texture[0], SHADOWRECT;\n"
"ADD R0.x, R0.x, -0.5;\n"
"KIL R0.x;\n"
"MOV result.color, fragment.color;\n"
"END\n";
Also,I have three problem:how to understand TEX sentence? if fragment.position changes into fragment.texcoord[0],is there any differences? The last one,why R0.x need subtract 0.5?
Many thanks,
depth peeling program
Started by abc9804, Mar 14 2008 02:09 PM
1 reply to this topic
#1
Posted 14 March 2008 - 02:09 PM
#2
Posted 14 March 2008 - 04:32 PM
fragment.position is a built-in variable that represents the fragment's x, y coordinates on the screen. fragment.texcoord[0] isn't necessarily the same although you could set up your geometry with appropriate texcoords so that it would be the same.
As for the subtraction of 0.5, look at the next line: KIL R0.x. This instruction discards (kills) the fragment if R0.x is less than zero. So the subtraction right before means that the fragment gets killed if the returned value from the texture is less than 0.5, i.e. if the fragment is more than 50% shadowed.
As for the subtraction of 0.5, look at the next line: KIL R0.x. This instruction discards (kills) the fragment if R0.x is less than zero. So the subtraction right before means that the fragment gets killed if the returned value from the texture is less than 0.5, i.e. if the fragment is more than 50% shadowed.
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












