Howto:Illuminate faces: Difference between revisions

Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 142: 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 ===
408

edits

Navigation menu