PDA

View Full Version : .jpg for normal maps



ugluk
01-07-2011, 12:32 PM
I've read about some sharp-eyed people here in these forums noticing when someone was using a .jpg texture, but is it safe to use for a normal map? My normal maps are the usual 3 color (i.e. 24 bit) textures. Is your sight so good, that it can discern between a .png and a .jpg normal map? I mean, the accuracy of this basic normal map isn't so good anyway, it has just 8-bits per normal component.

Jan
01-07-2011, 12:51 PM
Ugh. Do not use jpegs to store normalmaps!

Artifacts in normals are MUCH more visible than artifacts in a diffuse texture. While jpegs might sometimes be good enough for diffuse textures, your normal-maps will definitely suffer heavily under this kind of compression.

Jan.

Alfonse Reinheart
01-07-2011, 01:27 PM
Adding to what Jan said, strongly consider using RGTC (http://www.opengl.org/wiki/Red_Green_Texture_Compression) if you need compression for normal maps. It's a two channel format, and you just use a rsqrt in the shader to reconstruct the normal.

ugluk
01-07-2011, 02:59 PM
By diffuse textures you probably mean the color textures I plaster on my models?

Because I am using the normal map to calculate the diffuse lighting component, the dot(L, N) Lambert lighting component, so I am a bit confused.

Alfonse Reinheart
01-07-2011, 03:19 PM
The Lambertian diffuse lighting equation is as follows:

D * I *dot(N, L)

Where N is the surface normal at the point of interest, L is the direction from the point of interest to the light, I is the light intensity (or color, if you wish to think of it that way) that reaches the surface (which itself may be attenuated by distance), and D is the diffuse reflectance characteristics of the surface at that point. Or diffuse color, if you prefer. A surface looks green under white light because it absorbs all non-green wavelengths of light, reflecting only the green.

A texture is just a look-up table. It can define any of these values, or any value from any other equation. Or other things. A texture who's contents represent the surface normal at a particular point is usually referred to as a normal map or normal texture. A texture that provides the diffuse reflectance of the surface at a particular point is usually referred to as a diffuse map or diffuse texture.

ugluk
01-07-2011, 03:52 PM
In my case, I only use the cosine/Lambert term i.e. dot(N, L), nothing else; it is blended onto a surface (because of reflection and the fixed pipeline I'm using). So I see: diffuse texture, another name for color texture, or better diffuse reflectance/color texture. Thanks!