Sign in to follow this  

An approach for NPR outlines using vertex shaders

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this