Could you examine my normals?
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]
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]
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]
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
ps.1.3
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
//Diffuse
dp3 r1, t1_bx2, v0_bx2
mul r1, t0, r1
//Final color
add r0, r1, t3
//Color map -> t0
//Normal -> t1
//Halfway vector-> t2
//Halfway vector-> t3 (power table)
//Light vector -> v0
ps.1.3
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
//Diffuse
dp3 r1, t1_bx2, v0_bx2
mul r1, t0, r1
//Final color
add r0, r1, t3
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement