This topic is now archived and is closed to further replies.

Could you examine my normals?

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

I exported a sphere (500 faces) to my engine, through the exportation I computed smooth normals. Here's the result: To render it I use a per pixel lighting. Is it correct to see the adjacents triangles to the specular lighting more brightly? It isn't as smooth as I thought it would be. But maybe this is due to the low polygon count. [edited by - Alload on June 4, 2002 5:06:01 AM]

Share this post

Link to post
Share on other sites
For per-vertex lighting, this behaviour is normal, considering the low tesselation. But for true per-pixel lighting this should not happen, it should be 100% smooth instead. What kind of perpixel shader do you use for the specular part ?

And more important: do you renormalize your interpolated normals every pixel ? (very important for nice shading).

[edited by - Yann L on June 5, 2002 6:54:05 PM]

Share this post

Link to post
Share on other sites
Here''s the code I use for the pixel shader (in the vertex shader, I transform the light and halfway vectors into texture space):

//Color map -> t0
//Normal -> t1
//Halfway vector-> t2
//Halfway vector-> t3 (power table)
//Light vector -> v0


tex t0
tex t1

//Specular, I make the dot product between the halfway vector
//and the normal then I seek in a power table lookup for the
//powered result
texm3x2pad t2, t1_bx2
texm3x2tex t3, t1_bx2

dp3 r1, t1_bx2, v0_bx2
mul r1, t0, r1

//Final color
add r0, r1, t3

Share this post

Link to post
Share on other sites