Jump to content
  • Advertisement
Sign in to follow this  
Clapfoot

Fixed function cell shading with positional lights

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

Hi, I've implemented cell shading with directional lighting by using the technique described in this article (http://www.gamedev.net/reference/programming/features/celshading/). As described in the article, I take the dot product of the vertex normal (transformed by modelview matrx) and the light vector and use it as the 1D texture coordinate for the vertex. This works fine, but for faces where all vertex normals are pointing in the same direction, the face will have a uniform colour throughout (vs. having cell shaded gradiants). Now I believe that by using positional lights, I can get better results. I've been doing the following additional steps per frame: 1) Create a light vector by subtracing the vertex position from the light position. 2) Multiply the current modelview matrix (using glGet(GL_MODELVIEW_MATRIX)) with the light vector. 3) Normalize the light vector. 4) Take dot product of light vector and normalized vertex normal and use it as 1D texture coordinate. For some reason, the image doesn't look correct. Is there anything obviously missing from the technique described above? Thanks!

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!