Howto:Illuminate faces: Difference between revisions

Jump to navigation Jump to search
→‎Switch to another part of texture if illuminated: rewrite for clarity; texture does not have to be 512
(→‎Illuminate during dark: explanation of the 1.57 horizon)
(→‎Switch to another part of texture if illuminated: rewrite for clarity; texture does not have to be 512)
Line 181: Line 181:


===Switch to another part of texture if illuminated===
===Switch to another part of texture if illuminated===
You can no longer change the texture (see section above), but you can switch to another part of the same texture map and illuminate it.
For v1.9 or later, the way to change textures is the textranslate animation, which lets you "slide" across a texture map. This animation is applied to a single image which has the daytime and nighttime textures placed next to each other.


You need to make a texture map that is exactly 512 pixels wide (see [[Textures & Texture Maps in SketchUp]]. The height must be any square of two (eg. 2<sup>0</sup>=1, 2<sup>1</sup>=2, 2<sup>2</sup>=4, 2<sup>3</sup>=8, 2<sup>4</sup>=16 and so on). This texture map has two sides that are each 256 pixels wide. The '''left side''' is for day-time textures, the '''right side''' is for night-time textures. Each night-time texture is positioned exactly 256 pixels to the right of the day-time texture. Here is an example taken from the shared model [http://scenemodels.flightgear.org/modeledit.php?id=1570 German village house - grey roof]:
The width in pixels of texture map (if it is being moved sideways) should be an integral power of two (eg. 2<sup>0</sup>=1, 2<sup>1</sup>=2, 2<sup>2</sup>=4, 2<sup>3</sup>=8, 2<sup>4</sup>=16 and so on). For this example, this texture map has two sides that are each 256 pixels wide. The '''left side''' is for day-time textures, the '''right side''' is for night-time textures. Each night-time texture is positioned exactly 256 pixels to the right of the day-time texture. Here is an example taken from the shared model [http://scenemodels.flightgear.org/modeledit.php?id=1570 German village house - grey roof]:
[[Image:Germanvillagehouse1_day.png|thumb|day-time textures]]  
[[Image:Germanvillagehouse1_day.png|thumb|day-time textures]]  
[[Image:Germanvillagehouse1_night.png|thumb|night-time textures]]
[[Image:Germanvillagehouse1_night.png|thumb|night-time textures]]
Line 193: Line 193:
Finally you have to add two bits of code to the XML file: 1) Code that tells FG to move the texture to the left during night-time and 2) code that illuminates the model during night-time.
Finally you have to add two bits of code to the XML file: 1) Code that tells FG to move the texture to the left during night-time and 2) code that illuminates the model during night-time.


The following code tells FG to move the texture 256 pixel to the left at nightfall:
The following code tells FG to translate the texture halfway across horizontally at nightfall:


   <animation>
   <animation>
67

edits

Navigation menu