I’m just full of questions today
I’m trying to get linear fog to work in a fragment program on the 9700.
In the spec, it recommends doing something like this:
# # Linear fog # f = (end-z)/(end-start) # PARAM p = {-1/(END-START), END/(END-START), NOT USED, NOT USED}; PARAM fogColor = state.fog.color; TEMP fogFactor; ATTRIB fogCoord = fragment.fogcoord.x; MAD fogFactor.x, p.x, fogCoord.x, p.y; LRP result.color, fogFactor.x, finalColor, fogColor;
Unfortunately, of course, this won’t work because of the illegal way that they define p. I changed it to something like this:
"TEMP p;" "TEMP fogFactor;" "PARAM fogParms = state.fog.params;" "PARAM fogColor = state.fog.color;" "ATTRIB fogCoord = fragment.fogcoord;" "MOV p, -fogParms.w;" "MUL p.y, p, -fogParms.z" "MAD fogFactor.x, p.x, fogCoord.x, p.y;" "LRP result.color, fogFactor.x, temp, fogColor;"
But this program won’t compile. It gives an “Invalid component” error at fogParms.z. I don’t get it. state.fog.params is defined like this:
state.fog.params (d,s,e,r) fog density, linear start
and end, and 1/(end-start)
(section 3.11)
so it seems to me that the z component should be ok. Any ideas?
Thanks again,
– Zeno