PDA

View Full Version : Mip mapping makes normal maps abnormal



DonJMyers
05-30-2014, 06:45 PM
I was putting rivets on an airplane using gigantic normal maps and had an odd problem. THey weren't showing up on all the textures or were showing up erratically.

Kudos to CelShader who sorted it out for me.

First the normal map has to be set for "linear" color space.

Then you have to turn off mip mapping. Otherwise the bitmap may have it's data smeared and doesn't work anymore. The larger the normal map the worse the problem probably will be. Mine was 8192x8192 and the little rivets (each of which is about 5 pixels across) disappeared.

CelShader (Jen Hachigan) figured it out because the rivets showed up in the VPR preview render but not in the final render. VPR doesn't use mip mapping.

I was going nuts before she helped me figure it out. Note how, in the attachment below, some textures look fine and others don't. The few rivets you see in the lower right are from a small normal map which was much less affected. But the big one that goes on the wing was blurred out completely.

Even if your normal maps are small I'm sure turning off mip mapping will make them "pop" more. Fortunately when the plane moved far away the rivets blended great and didn't look like pimples far away.

Sensei
05-30-2014, 08:33 PM
That's pretty known by everybody knowledge.. :)
Normal maps cannot be further post-processed.
Mip-mapping is generating intermediate images with smaller scale than original (half, quad etc.) then blending them together, depending on distance to camera.
But normal map contain sensitive data that is normalized. R is X axis, G is Y axis, B is Z axis. They must be read as they were written by normal map generating app.

djwaterman
05-30-2014, 09:17 PM
Thanks for the information, I think I normally turn mip map off but know I'll make it a point.

probiner
05-31-2014, 05:51 AM
On the other hand... you need it for bump maps... :screwy:
http://forums.newtek.com/showthread.php?133893-Consistency-improvements-on-Bump-mapping-generation-Search-distance-and-amplitude

Thanks for the heads up :)

Sensei
05-31-2014, 08:04 AM
On the other hand... you need it for bump maps... :screwy:

Bump map is scalar. Color doesn't matter, it's converted to gray scale anyway during process.
After reading 5+ scalars there is build vector from them.

Normal map is vector, stored in all RGB components at the same time.
If you start messing with RGB independently, data will be damaged.

DonJMyers
05-31-2014, 01:03 PM
That's pretty known by everybody knowledge.. :)
Normal maps cannot be further post-processed.

Well I'm obviously not everybody, just an Emmy winner. I mostly just use bumps maps and don't even know how to make a normal map. I'd probably know by now if I used LW more but, with my Hwd job outsourced, I don't get to use it as much anymore as I'd like.

Fortunately I'm working on a movie now called "Barely Lethal" (http://en.wikipedia.org/wiki/Barely_Lethal) and the stock airplane we got had great normal and other maps. But they were all huge.

Sensei
05-31-2014, 01:50 PM
Bump map is scalar - it's like altitude of mountains.
It's converted by renderer or node to vector (blue output). Couple bump image scalars (colors are converted to gray scale) are read by it and converted to single vector.

Bump vector is then subtracted from Normal vector (typically smoothed polygon's normal vectors) and normalized.
You can do it by yourself using mine Bump To Normal node from TrueArt's Node Library.
After that bump vector is integrated in normal.

Normal must be always normalized (either internally by renderer or by user). Because it's later used by dot product, which absolute requires normalized vectors.
Normalized vector has always length of 1.0 (bump vector is never normalized, actually bump vector raw from scalar is multiplied by Bump Amplitude, and when it's >100%, bump has increased power and overall vector length is much more than 1.0).

It's general 3d knowledge, not related to just LW.


Well I'm obviously not everybody, just an Emmy winner.

Congratulations.
I am currently quantum physics scientist.. :)

From mine point of view "normal" is knowledge like "what is mass-energy of electron/positron (511 keV) or proton/antiproton (938.272 MeV), pion+-0 (139/135 MeV), muon+- (105 MeV)" from memory..

DonJMyers
06-01-2014, 12:04 PM
And now on to parallax mapping .... groan ...

djwaterman
06-01-2014, 05:07 PM
Sensei, how do you go about normalizing a normal map?

Sensei
06-01-2014, 05:38 PM
Well, normal map generated by some application should already be normalized.

Normal vector that's coming from Spot Info > Normal/Geometric Normal/Smoothed Normal etc. are all normalized already.

But imagine that normal map has not normalized.
So make plane covering whole render area.
Camera width & height equal to normal map image.
Enable nodes. Use normal map node, plug output to Math > Vector > Normalize, then to Diffuse Shading.
Render Frame, and output image should be normalized normal map.

Theoretically. I have not tried it in practice.

Greenlaw
06-01-2014, 06:24 PM
The key thing in LightWave is to make sure the normal map is set to Linear in the Image Editor. I know that was mentioned above but here's additional more info. For example, if you're lighting and rendering in sRGB colorspace, color image textures should be set to sRGB (or 'default' in this case,) but your normal maps must be set to Linear. LightWave won't necessarily do this automatically, so be sure to check. If you don't, you'll probably find unexpected seams or otherwise really ugly results when you render. (Generally speaking, any 'utility' textures like displacement maps, masks, spec maps, etc, should be set to Linear, but normal maps will show the problem the strongest.)

Another item you might want to check it the Y-axis setting in the Normal Map node--depending on where the normal map came from, you may need to flip the Y setting. If you're not sure, isolate your surfaces to show only the normal map in question and check how it responds to a single light.

Hope this helps.

G.

DonJMyers
06-02-2014, 12:35 PM
There is also a sneaky "gotcha" in using the normal map texturing node. The interface has a section on mip maps like all the other textures, implying it's okay to use when, in fact, it's not.

vector
06-02-2014, 09:35 PM
Nice tips. Thank you