• Advertisement
Sign in to follow this  

An approach for NPR outlines using vertex shaders

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