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

Jump to navigation Jump to search
m
typo, add templates
m (Robot: Cosmetic changes)
m (typo, add templates)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{caution|
The [[model-combined effect]] shader has '''replaced''' the separate normal map effect shader.
The separate normal map effect shader should be considered '''deprecated''' and '''should not be used for new development'''.}}
[[FlightGear]] 2.0.0 introduced effects, a powerful way to use shaders within FG without having to write C code. As of March 2010, [[FlightGear Git]] has a normal map effect (Effects/bumpspec.eff), which provides both bump mapping and specular mapping. This [[:Category:Howto|howto]] provides a tutorial on using this effect for [[aircraft]]. Similar techniques can be used to use other effects on aircraft.
[[FlightGear]] 2.0.0 introduced effects, a powerful way to use shaders within FG without having to write C code. As of March 2010, [[FlightGear Git]] has a normal map effect (Effects/bumpspec.eff), which provides both bump mapping and specular mapping. This [[:Category:Howto|howto]] provides a tutorial on using this effect for [[aircraft]]. Similar techniques can be used to use other effects on aircraft.


If you don't know how a normal map works, have a look [http://en.wikipedia.org/wiki/Normal_mapping here].
If you don't know how a normal map works, have a look {{wikipedia|normal mapping|here|noicon=1}}.


The latest documentation on the FlightGear effects system is to be found in [http://gitorious.org/fg/fgdata/blobs/master/Docs/README.effects $FG_ROOT/Docs/README.effects]
The latest documentation on the FlightGear effects system is to be found in {{readme file|effects}}.


== Creating the normal map ==
== Creating the normal map ==
To create the normal map, there are two options.
To create the normal map, there are two options.
* 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.
* 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]
* 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 information 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: ===
=== Lets see the 2D approach first: ===
Line 98: Line 103:
* If you find that the effect is too pronounced, try varying the scaling in the normalmap filter. 0.1 seems to work well for "rivet" effects.
* If you find that the effect is too pronounced, try varying the scaling in the normalmap filter. 0.1 seems to work well for "rivet" effects.
* Make sure all the faces of the object that you assign the effect to have a texture assigned to them, otherwise you will cause a crash in the [[OpenGL]] layer (below [[OSG]]), because the effect's tangent and binormal vectors are computed using object's texture mapping coordinates. If you try to feed an untextured object to the generator, it should abort with a null vector, and then passing this null vector to the driver leads to a segfault.
* Make sure all the faces of the object that you assign the effect to have a texture assigned to them, otherwise you will cause a crash in the [[OpenGL]] layer (below [[OSG]]), because the effect's tangent and binormal vectors are computed using object's texture mapping coordinates. If you try to feed an untextured object to the generator, it should abort with a null vector, and then passing this null vector to the driver leads to a segfault.
[[Category:Aircraft enhancement]]
[[Category:Shaders]]


[[fr:Tutoriel: Usage de l'effet de Normal Maps]]
[[fr:Tutoriel: Usage de l'effet de Normal Maps]]

Navigation menu