Iam trying to add attenuation to my scene.
Iam doing this in a vertex program, and register combiners. But its just wont work right, i got attenuation, but not like intended.
“DP4 o[HPOS].x, c[0], v[OPOS] ;”
“DP4 o[HPOS].y, c[1], v[OPOS] ;”
“DP4 o[HPOS].z, c[2], v[OPOS] ;”
“DP4 o[HPOS].w, c[3], v[OPOS] ;”
//c[5]=lightpos
“MOV R1,c[5];”
“ADD R2.xyz, -R1, v[OPOS];”
//Transform light vec to tangentspace
“DP3 R4.x, R2, v[1];”
“DP3 R4.y, R2, v[2];”
“DP3 R4.z, R2, v[3];”
//c[4].w = 1/light radius
//c[4].z = 0.5
“MUL R2.xyz, R4, c[4].w;”
“MAD R3,R2, c[4].z, c[4].z ;”
//Tex0 = radial map 2D
“MOV o[TEX0].xyz,R3 ;”
“MOV o[COL0].xyz,R3;”
“END”;
"{
"
" rgb {
"
" discard = tex0;
"
" discard = col0.b;
"
" spare0 = sum();
"
" }
"
"}
"
"out.rgb=lerp(spare0,zero,unsigned_invert(zero));
"
"out.a = unsigned_invert(zero);
"
I have read Ron Frazier’s very nice paper and trying to do the same but cant see what is wrong.
PLEASE help
/Marcus