Howto:Illuminate faces: Difference between revisions

Line 150: Line 150:
     <emission>
     <emission>
         <red>0.12</red>
         <red>0.12</red>
         <green>0.012</green>
         <green>0.0</green>
         <blue-prop>sim/G91/Test/V0_1B</blue-prop>
         <blue-prop>sim/G91/Test/V0_1B</blue-prop>
         <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
         <factor-prop>sim/G91/re_emit/gauge_red_light</factor-prop>
Line 157: Line 157:


<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.
<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