View Single Post
Old 08-31-04, 07:47 AM   #37
Abba Zabba
Java Cool Dude
Abba Zabba's Avatar
Join Date: May 2003
Location: Los Angeles
Posts: 125
Send a message via AIM to Abba Zabba Send a message via MSN to Abba Zabba
Default Re: My own Benchmark

Originally Posted by 991060
I think it's better if you add another pass in which the program just uses vertex shader for the shadow volume(i.e. inserting degenerate quad).
I modified the glsl shader, nulling most of the fragment level operation and only get less than 200 fps. I assume the program is mainly limited by the cpu in this situation.
Look for ShadowVolumes.txt
I already wrote something even better to limit volume extrusion to the radius of the light source, but I'm running into a special case where the shadows go flashing like crazy even though I'm checking thouroughly for when it's safe to cap/uncap the volume.
I think I figured a workaround for it which involves casting a ray from the light source passing by the center of the occluder and checking for intersection with the near clip plane delimited by the viewport corners, and deciding to force cap in the case of an intersection.

Don't use this one yet, I modified few other things in the scenegraph that I should upload sometime soon (back to school, I'm overwhelmed...)

PARAM mvp[4]	    = { state.matrix.mvp };
PARAM lightPosition = program.env[0];

PARAM zero = {0.0, 0.0, 0.0, 0.0};
PARAM one  = {1.0, 1.0, 1.0, 1.0};

ATTRIB inPosition = vertex.position;
ATTRIB inNormal   = vertex.normal;

TEMP lightVector, dotProduct;
TEMP multiplier, position;
TEMP toMult;

SUB, inPosition, lightPosition;
DP3 dotProduct,  lightVector, inNormal;

MOV multiplier, lightPosition.w;

MOV toMult, one;
SGE toMult, dotProduct, zero;

MUL multiplier, multiplier, toMult;

MAD position, multiplier, lightVector, inPosition;

DP4 result.position.x, mvp[0], position;
DP4 result.position.y, mvp[1], position;
DP4 result.position.z, mvp[2], position;
DP4 result.position.w, mvp[3], position;
MOV result.color, vertex.color;
Abba Zabba is offline   Reply With Quote