Jump to content
  • Advertisement
Sign in to follow this  
Coz

gltexgen & texture matrix celshading

This topic is 3409 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 all, I have been trying to apply cel shading( no outlines needed ) to a model, but I'm limited to the fixed function pipeline. I know this can be achieved with glTexGen, and in fact, using a 1D texture( dark to white ) with a GL_SPHERE_MAP works fine, except that the light source is always to the right. If I understand correctly, I could use GL_NORMAL_MAP with glTexGen, then use a texture matrix that contains the light vector in the first row and that should result in the dot product, which would be set as the X coordinate for the texture. However, I have tried this and other variants without success. The closest I could get is that it seems that by scaling the X axis and by rotationg around the Z axis I can move the texture around in directions I want. I tried using a matrix like this as my texture matrix: X Y Z 0 0 1 0 0 0 0 1 0 0 0 0 1 and I'm assuming the light vector is normalized, so if I wanted a light that comes from the sky, Y = -1, so I would use: 0 -1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 and yeah, it doesn't works :p If I could at least get a working example of what I'm trying to achieve, it would be just dandy.

Share this post


Link to post
Share on other sites
Advertisement
that matrixs not orthogonal (+ will give very wierd results)

see here
http://www.j3d.org/matrix_faq/matrfaq_latest.html
the rotation part on matrixs

Share this post


Link to post
Share on other sites
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!