8,564
edits
m (Add link to Howto: Lightmap) |
(Cleanup, remove faults) |
||
Line 189: | Line 189: | ||
[[File:Germanvillagehouse1.png]] | [[File:Germanvillagehouse1.png]] | ||
When you have made that texture map, you apply the day-time textures as default textures to the model | When you have made that texture map, you apply the day-time textures as default textures to the model in your favourite modeling software (e.g. [[Blender]] or [[SketchUp]]). | ||
Finally you have to add two bits of code to the XML file: | Finally you have to add two bits of code to the XML file: | ||
# Code that tells FG to move the texture to the left during night-time | |||
# Code that illuminates the model during night-time | |||
The following code tells | The following code tells FlightGear to translate the texture halfway across horizontally at nightfall (setting <tt>y</tt> instead would translate it vertically): | ||
<syntaxhighlight lang="xml"> | |||
<animation> | <animation> | ||
<type>textranslate</type> | <type>textranslate</type> | ||
Line 201: | Line 204: | ||
<step> 1.57 </step> | <step> 1.57 </step> | ||
<factor>0.318471338</factor> | <factor>0.318471338</factor> | ||
<axis> | <axis> | ||
<x> -1 </x> | <x> -1 </x> | ||
<y> 0 </y> | <y> 0 </y> | ||
</axis> | </axis> | ||
</animation> | </animation> | ||
</syntaxhighlight> | |||
In order to illuminate the object during dark, add the block of code introduced above: [[Howto: Illuminate faces#Illuminate during dark|Illuminate during dark]]. Finally you will have two blocks of code: One that moves the texture at dusk and one that illuminates the object at dusk. Make sure both of them use the right object name. The light will be switched off and the texture will be switched back to day-time texture when the sun rises above an angle of 1.57. Two essential tags here are <step> and <factor>. | The 3d object (the house) which "wears" the texture is called <tt>germanvillagehouse1</tt> here. This name refers to the name given to the respective object in the AC file. For more information on object names, see [[AC files: Understanding and changing .ac code#Identifying an object|AC files: identifying an object]]. | ||
In order to illuminate the object during dark, add the block of code introduced above: [[Howto: Illuminate faces#Illuminate during dark|Illuminate during dark]]. Finally you will have two blocks of code: One that moves the texture at dusk and one that illuminates the object at dusk. Make sure both of them use the right object name. The light will be switched off and the texture will be switched back to day-time texture when the sun rises above an angle of 1.57. Two essential tags here are <step> and <factor>. | |||
* '''<step>''' indicates that the texture should be translated in a single step only when the value passes 1.57 or a multiple thereof; without it the texture would be translated continuously. | |||
* '''<factor>''' is equal to 0.5/1.57, which normalizes the sun angle in radians to a value between 0 and 1 for translating the texture. | |||
=== Flashing light === | === Flashing light === |