Howto:Illuminate faces: Difference between revisions

Jump to navigation Jump to search
m (→‎Related content: Lightmap is no longer experimental)
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{obsolete|Howto:Lightmap}}
Imagine you see a skyline with a countless amount of lights. Somewhere in front of you there's a stretched row of lights. That's the runway you will land on. That's how you will experience a flight in the dark of the night. In reality. But in [[FlightGear]] there aren't much illuminated buildings. So here's a [[:Category:Howto|howto]] that teaches you how to make lights and illuminated buildings. Enjoy!
Imagine you see a skyline with a countless amount of lights. Somewhere in front of you there's a stretched row of lights. That's the runway you will land on. That's how you will experience a flight in the dark of the night. In reality. But in [[FlightGear]] there aren't much illuminated buildings. So here's a [[:Category:Howto|howto]] that teaches you how to make lights and illuminated buildings. Enjoy!


Line 140: Line 142:
   </emission>
   </emission>
  </animation>
  </animation>
===Changing illumination color directly via parameters===
It is possible to perform the change of color through the use of properties through the tag '''<red-prop>, <green-prop> or <blue-prop>''' to be associated with a parameter defined in the property tree.
For example:
<source>
    <emission>
        <red>0.12</red>
        <green>0.0</green>
        <blue-prop>sim/G91/Test/V0_1B</blue-prop>
        <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
    </emission>
</source>
<factor-pro> always works on the three colors, so any color mixing should be managed using a NASAL or JSBSim function so that the colors are harmonized together.
In this example we mix two colors on a surface (for example the cockpit). The two colors correspond to the red used to illuminate the cockpit and the blue emitted by a wood lamp to illuminate the instrument quadrants. The mixing between the two colors has been assumed as 20% for Wood's light (a value quite close to reality for metallic surfaces), therefore two variables are prepared, one for red and the other for Wood's luve (UV ):
<source>
  setprop("sim/G91/re_emit/gauge_phosphorescent_light",pl_phosphorescent_emission * light_by_tension_bus);
  setprop("sim/G91/re_emit/gauge_UV_light_on_red_light",pl_phosphorescent_emission * light_by_tension_bus * 0.2);
</source>
The <factor-prop> at this point becomes constant and indicates the reflection factor of the material (high for a glossy or light and lower material for an opaque or dark material). In the example we use the value 0.12. The <factor-prop> tag cannot handle constant values and therefore the <factor> tag should be used, so it is possible to use the same function for different types of materials in different lighting contexts.
<source>
    <emission>
        <red-prop>sim/G91/re_emit/gauge_red_light</red-prop>
        <green>0.0</green>
        <blue-prop>sim/G91/re_emit/gauge_UV_light_on_red_light</blue-prop>
        <factor>0.12</factor>
    </emission>
</source>


=== Changing texture if illuminated ===
=== Changing texture if illuminated ===
Line 183: Line 218:
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.
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.


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]:
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 [https://scenery.flightgear.org/app.php?c=Models&a=view&id=1570 German village house - grey roof]:
[[File:Germanvillagehouse1_day.png|thumb|day-time textures]]  
[[File:Germanvillagehouse1_day.png|thumb|day-time textures]]  
[[File:Germanvillagehouse1_night.png|thumb|night-time textures]]
[[File:Germanvillagehouse1_night.png|thumb|night-time textures]]
403

edits

Navigation menu