Jump to content
  • Advertisement

Archived

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

JulianSpillane

Object Outlining - Vertex Program

This topic is 5240 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 all. I''m having a bit of an annoying problem. See, I''m trying to get the outline of an object for a bit of toon shading by extruding an object along its normals a given amount through a vertex shader, but am getting realllly odd results. [img]http://www.frozennorth.net/images/tempoutline1.jpg[/img] This is sans vertex program. [img]http://www.frozennorth.net/images/tempoutline2.jpg[/img] This is what''s happening with the program. Here''s the code I''m using (btw, it''s ARB_vertex_program):
ATTRIB iPos         = vertex.position;
ATTRIB iColor		= vertex.color;
ATTRIB iNormal      = vertex.normal;
PARAM  mvp[4]       = { state.matrix.mvp };
PARAM  extrude      = { 2.0, 2.0, 2.0, 0.0 };
TEMP   xfNormal, tempResize;
OUTPUT oPos         = result.position;
OUTPUT oColor       = result.color;

DP3 xfNormal.w, iNormal, iNormal;
RSQ xfNormal.w, xfNormal.w;
MUL xfNormal.xyz, xfNormal.w, iNormal;
MUL xfNormal, xfNormal, extrude.xyzw;

ADD tempResize.x, iPos.x, xfNormal.x;
ADD tempResize.y, iPos.y, xfNormal.y;
ADD tempResize.z, iPos.z, xfNormal.z;
ADD tempResize.w, iPos.w, xfNormal.w;

# Transform the vertex to clip coordinates.
# We transform succesively through the modelview matrix, then the projection matrix.
DP4 oPos.x, mvp[0], tempResize;
DP4 oPos.y, mvp[1], tempResize;
DP4 oPos.z, mvp[2], tempResize;
DP4 oPos.w, mvp[3], tempResize;

# Write our color out directly
MOV oColor, iColor;
 
Can anyone tell me where I''ve gone wrong? Thanks, Julian

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!