Skip to main content
GameDev.net gamedev.net
🔒 Locked

gltexgen & texture matrix celshading

Started by Coz Apr 20, 2009 at 8:36 AM 0 replies 800+ views
Original Post
Coz
Coz
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.
zedz
zedz
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.