Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Shadow Volume + Vertex Program

This topic is 5483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, Why dosn''t this vertex program work? It''s supposed to extrude the vertices, if the w-component is 0 It computes the extrusion via this pos = pos * pos.w + (pos * l.w - l * pos.w) * (1 - pos.w) I didn''t borhter to include the pos * l.w part, since my lights always has a w-component of 1.0f! Anyone got any ideas? !!ARBvp1.0 # Vertex Input ATTRIB vPos = vertex.position; # Local Input #PARAM light = program.local[0]; PARAM light = {0, 5, 0, 1}; # Modelview Projection Matrix PARAM mvp[4] = {state.matrix.mvp}; # Extrude Position TEMP pos, posMultW, lMultW, posSubL, posSubLMultW, w; SUB w, 1, vPos.w; MUL posMultW, vPos, vPos.w; MUL lMultW, light, vPos.w; SUB posSubL, vPos, lMultW; MUL posSubLMultW, posSubL, w; ADD pos, posMultW, posSubLMultW; # Transform Vertex Position Into Clip Space TEMP clipSpace; DP4 clipSpace.x, mvp[0], pos; DP4 clipSpace.y, mvp[1], pos; DP4 clipSpace.z, mvp[2], pos; DP4 clipSpace.w, mvp[3], pos; PARAM yellow = {1, 1, 0, 0}; MOV result.color, yellow; MOV result.position, clipSpace; END

Share this post

Link to post
Share on other sites

"ATTRIB pos = vertex.position;"
"PARAM mvp[4] = { state.matrix.mvp };"
"PARAM lightpos = program.local[4];"
"TEMP p,a;"

"MOV a.xyz, lightpos;"
"MAD p, pos.w, lightpos, -a;"
"ADD p.xyz, p, pos;"

"DP4 result.position.x, mvp[0], p;"
"DP4 result.position.y, mvp[1], p;"
"DP4 result.position.z, mvp[2], p;"
"DP4 result.position.w, mvp[3], p;"

This should work.
Notice the difference from the NVidia prog. Theirs has a precision problem!

[edited by - baskuenen on November 16, 2003 5:28:30 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!