Howto:Use the normal map effect in aircraft: Difference between revisions

Jump to navigation Jump to search
(Add information about inverting Y axis for proper OpenGL normal maps)
Line 6: Line 6:
==Creating the Normal Map==
==Creating the Normal Map==


To create the Normal Map, we need a plugin that can convert a texture representing height to a set of normals. There is a good [http://registry.gimp.org/node/69 normalmap plugin] for GIMP available. Those on Ubuntu should be able to install it directly from the package manager.
To create the Normal Map, there are two options.


Once you have it installed, create the normal map as follows.
We can use a plugin that can convert a 2D texture representing height to a set of normals. There is a good [http://registry.gimp.org/node/69 normalmap plugin] for GIMP available. Those on Ubuntu should be able to install it directly from the package manager.
 
On the other hand, we can create a high polygon density model of the object in a 3D editor, and generate the normal map from this model. You can find more informations on this approach , applied to blender,  [http://wiki.blender.org/index.php/Doc:Manual/Textures/Maps/Bump_and_Normal_Maps here]
 
 
 
Lets see the 2D approach first:
 
Once you have the GIMP plugin installed, create the normal map as follows.


# Identify an object that you intend to apply the normal map to using Blender AC3D etc.  
# Identify an object that you intend to apply the normal map to using Blender AC3D etc.  
Line 23: Line 31:
# The default options will work fine, except that you should invert the Y axis (as OpenGL vectors origin is the bottom left rather than top left). However, the author of the plugin recommends the Prewitt 5x5 filter. Once you are happy with the options, press OK, and your image should turn generally blue, but with some strange colours around the areas that you coloured white. This is the normal map.
# The default options will work fine, except that you should invert the Y axis (as OpenGL vectors origin is the bottom left rather than top left). However, the author of the plugin recommends the Prewitt 5x5 filter. Once you are happy with the options, press OK, and your image should turn generally blue, but with some strange colours around the areas that you coloured white. This is the normal map.
# Save off the normal map as a new png file in your aircraft directory, remembering the correct path.
# Save off the normal map as a new png file in your aircraft directory, remembering the correct path.
Now lets see the 3D approach ( this method is independent of the above instruction, and can be done apart )
# In Blender, you created a low poly count model. This is the one that will be exported to FlightGear. Let's call it "low poly"
# Create a UV mapping for this object ( edit mode, select all, U ), then associate a new image to this UV mapping ( UV/image editor, new )
# Duplicate the "low poly" object, and call the new copy "High poly".
# Add details to the "high poly" model, where needed. ( don't MOVE the new copy ! This methods needs that both copies share the same center to work. You could use layers to clarify the viewport when working). You could use "multires", or subsurf modifiers, or you could even do the job by hand. The sculpture tools of blender can be handy too. The workflow depends only on your habits !
Once you are satisfied with the detail level of the "high poly" copy, it is time to create the normal map from this copy, and to transfer it to  the "low poly" copy. Blender's powerful interface allows to do this in a single operation :
# In object mode, FIRST select the "high poly" object, THEN "SHIFT-select" the "low poly" object to add it to the selection.
# In the "scene" buttons ( F10 ) , click on the "bake" tab, and make sure you check the "selected to active" and "normals" options. In the menu under "dist" and "bias", choose 'tangent' as the normal space. You can leave 'quad split auto' at the bottom.
# It is wise to specify a bleeding margin in the "margin" option, to ensure the texture will cover the faces entirely. A dozen pixels is usually enough for FG.
# When everything is set, click the big "bake" button. If you followed the instructions carefully, you should see your normal map appear in the UV/image editor. Save it as a png file, and remember where you saved it.
Unfortunately, the space axes of blender and those of the FlightGear shader are different... You will need to invert the X and Y axes of your normal map, or the effect will look inverted. This is easy :
# Open your normal map in GIMP, and go to "Colors -> Components -> Decompose". Choose the RVB option, and "decompose as layers". Validate.
# In the new image that opens, invert the values in the RED and GREEN layers.
# Again, go to "Colors -> Components", but now, "Compose". Choose the RVB option.
# A new image opens, quite similar to the original, but with slight differences. Save this image.
While the main blue tone remains, if you look closely , you will notice that the red and green levels have been inverted. Your normal map is now ready to be used by the FlightGear shader.
Despite it is more complex, this method allows to generate complicated displacement effects, in a much more accurate way than using converted relief maps. This way it is possible to work on 3 axes, to simulate folds, concave zones, etc...etc, all this keeping total control on the desired effect amount, just be sculpting the high poly model accordingly. You can see an image tutorial of this technique [http://vi-wer.de.tl/Normalmap-Tutorial.htm here]


[[Image:normalmap2.png|thumb|Final normal map]]
[[Image:normalmap2.png|thumb|Final normal map]]
40

edits

Navigation menu