Jump to content
  • Advertisement
Sign in to follow this  
Symphonic

An approach for NPR outlines using vertex shaders

This topic is 3913 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

I don't have a working shader environment to test this idea, so I thought I might toss it out here and see what happens. This is a dual pass render. First pass: front-faces filled, your choice of non-photo-realistic (NPR) shading Second pass: back-faces filled, vertex shader displaces each vertex like so:
scale = length(vertex_position - camera_position);
vertex_position += normal * scale * CONSTANT;
the constant tunes the width of the border. the pixel shader associated with this vertex shader just draws black (or whatever color outline you want) pixels. In this way the geometry of the rendered object is bloated from its original shape so that it forms a border. Will this work? it will make strange shapes at sharp corners, and the border will likely appear to have irregular width in some places, to solve the latter problem, the displacement of the vertices could be along the normal projected into the plane perpendicular to the view direction.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!