Normalmaps, How to Make Good Ones: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
(New page: Copied from http://homepage.ntlworld.com/gerald.hunt1/website/nfhwta.htm, by Greg Hunt First off, to explain what normalmaps are in terms of an artist's perspective. Normalmaps alter the ...)
 
No edit summary
 
(17 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Copied from http://homepage.ntlworld.com/gerald.hunt1/website/nfhwta.htm, by Greg Hunt
Original text copied from http://homepage.ntlworld.com/gerald.hunt1/website/nfhwta.htm, by Greg Hunt


First off, to explain what normalmaps are in terms of an artist's perspective. Normalmaps alter the perception of a lit object via Per-pixel lighting rather than the bog standard vector lighting used on a low-polygon model without a normalmap. This technique requires an RGB texture which contains the information needed to create surface normals in a texture map. This texture containing surface normal data is called a normal map. The red, green and blue channels of the normal map dictate how lighting effects the X, Y, and Z axis' of the normal vector orientation.
''Comments by Springheel''


(img to come)
''Running the nvidia plugin on your diffusemap usually doesn't give great results, as every bit of 'noise' in the diffusemap becomes rough and bumpy in the created normalmap.  Here's an example of bricks that are too rough:''


Let us assume the above image is a greyscale heightmap, the lighter the value, the higher the point of elevation from the surface, the darker the value, the deeper the point of recess from the surface. When used in a computer game engine, this would appear convincing if the surface was perpendicular to your sight and if the lighting was static. However, take this situation away and the bumpmap loses it's realistic impact due to a lack of vector orientation information.
[[Image:Brickwall result1.jpg]]


=== Here's how you achieve a good-looking normalmap without the noise ===


(img to come)
"The essential goal of this tutorial is to show how I go about achieving making organic (possibly rounded/curved/smooth) normalmaps that appear to be 3d-modelled."


This is how the same bumpmap looks when converted into a normalmap. In a normalmap texture, each pixel represents a normal (mathematical term) and you can freely dictate the direction you want it go.
''First of all you need to create a heightmap. A heightmap is basically a black and white version of your texture, where the higher areas are light and the lower areas are dark. On something like bricks, the bricks would be pretty bright and the cracks between the bricks would be dark.  
Each direction is represented by a colour and this is where the RGB channels work together in order to create the illusion of geometry dictated by the lighting. In the image above we can see that the light blue pixels (R 127, G 127, B 255) represent normals that are perpendicular to your vision. The pink pixels represent normals that are facing to the right. Green pixels represent normals that are facing down. Purple pixels represent normals that are facing upwards, and dark blue/green pixel are normals facing to the left.
Yet in the original greyscale image, they all share the shame RGB value therefore the normals (which don't actually exist in the greyscale image but this is purely logic) all react the same to the lighting even if the light source is situated West of this elevation.


''
"So here is where the process begins.  With a black and white heightmap. Duplicate this so we have 3 layers of the same image."


[[Image:Heightmap offset.jpg]]


So here is where the process begins, start back at the beginning to when we had the heightmap, duplicate this so we have 3 layers of the same image.
"- Use a Gaussian Blur filter with a pixel radius of 6 on the bottom layer image, use the Filter->Other->Offset tool and offset it by half the texture's size, making sure that "Wrap Around" is checked. Repeat this step and Gaussian Blur it once more. You should have offset the image twice and blurred this image 3 times now.
 
- Use a Gaussian Blur filter with a pixel radius of 6 on the bottom layer image, use the Filter->Other->Offset tool and offset it by half the texture's resolution, making sure that "Wrap Around" is checked. Repeat this step and Gaussian Blur it once more. You should have offset the image twice and blurred this image 3 times now.


- On the 2nd layer image Repeat the previous step but using a Gaussian Blur filter with a pixel radius of 3, you can leave the top layer alone for now.
- On the 2nd layer image Repeat the previous step but using a Gaussian Blur filter with a pixel radius of 3, you can leave the top layer alone for now.
Line 25: Line 25:


- Set the top and the 2nd layer's Blending mode to "Overlay" then tweak the opacity to how you see fit, then flatten the image.
- Set the top and the 2nd layer's Blending mode to "Overlay" then tweak the opacity to how you see fit, then flatten the image.
You should have a normalmap like above and as you can see, it puts more emphasis on the geometry even though edge/line details are still present, they don't overthrow the overall shape. From this point onwards I can simply create additional heightmap layers for fine details, filter them through with a "Du/Dv" Filter Type and a scale between 5-10, Overlay and Merge."
''The result will be something like this smooth version:''
[[image:Brickwall_heightmap_cleaned.jpg]]
== Further tweaking ==
''Tips and tricks by STiFU (Based on Photoshop, but applicable in GIMP)''
Sometimes there are parts in your normalmap that just don't look good enough yet and could do with some tweaking. Small alterations can be done directly on the normalmap with the Clone Stamp Tool for example. However this approach is not very intuitive to handle and requires a very good understanding of normalmaps. So we take the detour over the heightmap again.
You can generate the heightmap like described before (I'd recommend to use only one layer and less blur in this case though) or have an external program like Crazybump or SSBump do it. The heightmap does not have to be very precise, because you are going to edit it manually in just a few selected places anyway. So identify the spots you want to fix and draw the heightprofile of those places using Dodge, Burn and Brushes (White is high, black is low). You don't need to draw all the details here, because you can get those pretty well from the original normalmap. Sometimes it's also usefull to change contrast/brightness before drawing and it might help to have a semi-transparent layer with the diffusemap visible.
When you're done, convert this heightmap into a normalmap, paste it as a layer over your original normalmap and name it something convenient like "normal from heightmap". Add a layermask and paint it completely black, so that nothing of the new normalmap is visible anymore. Now use a white brush with a very low hardness and an appropriate size on the layermask to make the structures again, which have recently been edited in the heightmap. Improve the transitions with Burn and Dodge, if necessary.
Now you will want to improve the details on your "normal from heightmap". To do this, apply its layermask also to a duplicate of the original normalmap. Move this new layer to the top, name it something like "details" and switch the blending mode to overlay. And here comes the trick: You can now use a highpass-filter (Filter->Other->High-Pass) on it, so that really just the details are visible above the "normal from heightmap" (instead of the whole original normalmap with its bigger structures). How big the details are can be altered by the radius of the filter. The artist has now full control over this. This trick is of course also applicable in the upper tutorial. Move the "normal from heightmap"-layer to the bottom and change it's blending mode back to normal, while the other one is changed to overlay. Use the highpass on the toplayer and you're done...
In case you're interested: The technical background behind all this is that the normalmap of high frequency structures can be estimated very well and errors aren't detected so easily by a human observer, but it's the total opposite with low frequency structures. Hence we correct the low frequency structures by hand with a heightmap and use the automatically generated detailsignal to improve it.
== See Also ==
[https://forums.thedarkmod.com/index.php?/topic/11725-need-help-with-making-a-normal-map-in-gimp-please Normal Map Thread]
[https://web.archive.org/web/20160328040221/http://charles.hollemeersch.net/sites/default/files/njob_v1_0_0.zip Njob download. (High quality Normal Map generator)]
[https://web.archive.org/web/20130308104215/http://wiki.polycount.com/NormalMap? Polycount Normal Maps]
{{textures}}

Latest revision as of 02:42, 28 October 2021

Original text copied from http://homepage.ntlworld.com/gerald.hunt1/website/nfhwta.htm, by Greg Hunt

Comments by Springheel

Running the nvidia plugin on your diffusemap usually doesn't give great results, as every bit of 'noise' in the diffusemap becomes rough and bumpy in the created normalmap. Here's an example of bricks that are too rough:

Brickwall result1.jpg

Here's how you achieve a good-looking normalmap without the noise

"The essential goal of this tutorial is to show how I go about achieving making organic (possibly rounded/curved/smooth) normalmaps that appear to be 3d-modelled."

First of all you need to create a heightmap. A heightmap is basically a black and white version of your texture, where the higher areas are light and the lower areas are dark. On something like bricks, the bricks would be pretty bright and the cracks between the bricks would be dark.

"So here is where the process begins. With a black and white heightmap. Duplicate this so we have 3 layers of the same image."

Heightmap offset.jpg

"- Use a Gaussian Blur filter with a pixel radius of 6 on the bottom layer image, use the Filter->Other->Offset tool and offset it by half the texture's size, making sure that "Wrap Around" is checked. Repeat this step and Gaussian Blur it once more. You should have offset the image twice and blurred this image 3 times now.

- On the 2nd layer image Repeat the previous step but using a Gaussian Blur filter with a pixel radius of 3, you can leave the top layer alone for now.

- Run the bottom layer through the nvidia plug-in with a scale value of 15-30 (depending on the texture), run the 2nd layer through with a scale value of 9-12 and also check "Du/Dv" in the filter type options, do the same again with the top layer but with a scale value of 5.

- Set the top and the 2nd layer's Blending mode to "Overlay" then tweak the opacity to how you see fit, then flatten the image.

You should have a normalmap like above and as you can see, it puts more emphasis on the geometry even though edge/line details are still present, they don't overthrow the overall shape. From this point onwards I can simply create additional heightmap layers for fine details, filter them through with a "Du/Dv" Filter Type and a scale between 5-10, Overlay and Merge."

The result will be something like this smooth version:

Brickwall heightmap cleaned.jpg

Further tweaking

Tips and tricks by STiFU (Based on Photoshop, but applicable in GIMP)

Sometimes there are parts in your normalmap that just don't look good enough yet and could do with some tweaking. Small alterations can be done directly on the normalmap with the Clone Stamp Tool for example. However this approach is not very intuitive to handle and requires a very good understanding of normalmaps. So we take the detour over the heightmap again.

You can generate the heightmap like described before (I'd recommend to use only one layer and less blur in this case though) or have an external program like Crazybump or SSBump do it. The heightmap does not have to be very precise, because you are going to edit it manually in just a few selected places anyway. So identify the spots you want to fix and draw the heightprofile of those places using Dodge, Burn and Brushes (White is high, black is low). You don't need to draw all the details here, because you can get those pretty well from the original normalmap. Sometimes it's also usefull to change contrast/brightness before drawing and it might help to have a semi-transparent layer with the diffusemap visible.

When you're done, convert this heightmap into a normalmap, paste it as a layer over your original normalmap and name it something convenient like "normal from heightmap". Add a layermask and paint it completely black, so that nothing of the new normalmap is visible anymore. Now use a white brush with a very low hardness and an appropriate size on the layermask to make the structures again, which have recently been edited in the heightmap. Improve the transitions with Burn and Dodge, if necessary.

Now you will want to improve the details on your "normal from heightmap". To do this, apply its layermask also to a duplicate of the original normalmap. Move this new layer to the top, name it something like "details" and switch the blending mode to overlay. And here comes the trick: You can now use a highpass-filter (Filter->Other->High-Pass) on it, so that really just the details are visible above the "normal from heightmap" (instead of the whole original normalmap with its bigger structures). How big the details are can be altered by the radius of the filter. The artist has now full control over this. This trick is of course also applicable in the upper tutorial. Move the "normal from heightmap"-layer to the bottom and change it's blending mode back to normal, while the other one is changed to overlay. Use the highpass on the toplayer and you're done...

In case you're interested: The technical background behind all this is that the normalmap of high frequency structures can be estimated very well and errors aren't detected so easily by a human observer, but it's the total opposite with low frequency structures. Hence we correct the low frequency structures by hand with a heightmap and use the automatically generated detailsignal to improve it.

See Also

Normal Map Thread

Njob download. (High quality Normal Map generator)

Polycount Normal Maps