Sign in to follow this  
GamerYZ

GLSL cel-shade

Recommended Posts

I'm trying to write a vertex shader for a cel-shaded game. I've been reading the lighthouse3D tutorials on this subject, but the way they are doing it is manually setting a color based on the intensity, so how should I apply the intensity if the verts already have color on them? Thanks.

Share this post


Link to post
Share on other sites
The vertex shader has access to the vertex's color value through 'gl_Color' so how about multiplying the incoming color by some factor of the intensity.

Something like this maybe

if (intensity > 0.95)
factor = 1.0;
else if (intensity > 0.5)
factor = 0.5;
else if (intensity > 0.25)
factor = 0.25;
else
factor = 0.10;

result_color = gl_Color * factor;
HTH

Share this post


Link to post
Share on other sites
alright I'm getting another weird problem :(

For some reason after working and changing the vertex and fragment file couple times, the shader seems to get stuck in memory. I even deleted both files and the program is still acting as if it is running the shaders. I know I am deleting the handles to shader and program when I shut down the app....

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