• Advertisement
Sign in to follow this  

gltexgen & texture matrix celshading

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