Per pixel lighting using only 1 constant normal (for quads)

This topic is 4872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey guys, Looking into simple per pixel lighting, just to get rid of vertex lighting on large surfaces (quads in my case) I wondered, do I need a normal map? It seems to me, when you create a normal map for a flat surface all normals will be the same anyway, so why cant I have 1 constant normal (say {0,0,-1}) ? All I want is to have point and spotlights working on a per pixel basis and I only need them on quads.. Am I overlooking something ? Thanks :)

Share on other sites
You dont need a normal map. But using a "constant" normal of (0, 0, -1) wont work for just any tri - it must be properly oriented with respect to the triangle. You would have to tranform it and pack it into constant registers for each triangle - not a good way to go.

Just pass vertex normals to the pixel shader, and do your N.L there. If you have the space in your pixel shader, you should renormalize the normal to keep spec highlights hot.

You can use a constant tangent-space normal map (all purple), but you'll have to do your light math in tangent space, which puts a little more heat on the vertex shader, and at that point, you're doing normal mapping.

Share on other sites
Ok, let me see if I get this :)

I can use the re-normalized interpolated normals from the vertexshader (so no normal map) and simply do all lighting (spots, point etc) in the pixelshader instead of the vertex shader (as I am doing now) ?

To avoid losing an arm and a leg performance wise, are there any other values I can use "pre-calculated" from the vertexshader (and passed interpolated to the ps) ?

Thanks Scoob !

• 10
• 9
• 48
• 12
• 10
• Forum Statistics

• Total Topics
631383
• Total Posts
2999687
×