ALS technical notes: Difference between revisions

Jump to navigation Jump to search
Line 421: Line 421:


Note the timing constant of the loop — running the update per-frame leads to a spurious movement of the coordinate system in which rain is rendered and spoils the effect.
Note the timing constant of the loop — running the update per-frame leads to a spurious movement of the coordinate system in which rain is rendered and spoils the effect.
Another method when using JSBSIM would be to use a combination of FCS Functions and Filters
<syntaxhighlight lang="xml">
<system name="c172p-glass-effects">
    <channel name="rain">
        <fcs_function name="glass-effects/splashx">
            <function>
                <difference>
                    <value>-0.1</value>
                    <product>
                        <value>2.0</value>
                        <sqrt>
                            <quotient>
                                <min>
                                    <property>/velocities/airspeed-kt</property>
                                    <value>40</value>
                                </min>
                                <value>40</value>
                            </quotient>
                        </sqrt>
                    </product>
                </difference>
            </function>
        </fcs_function>
        <fcs_function name="glass-effects/splashz">
            <function>
                <difference>
                    <value>1.0</value>
                    <product>
                        <value>1.35</value>
                        <sqrt>
                            <quotient>
                                <min>
                                    <property>/velocities/airspeed-kt</property>
                                    <value>40</value>
                                </min>
                                <value>40</value>
                            </quotient>
                        </sqrt>
                    </product>
                </difference>
            </function>
        </fcs_function>
    </channel>
</system>
</syntaxhighlight>
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
    <filter>
        <name>splashX</name>
        <type>gain</type>
        <input>
            <property>/fdm/jsbsim/glass-effects/splashx</property>
        </input>
        <output>
            <property>/environment/aircraft-effects/splash-vector-x</property>
        </output>
    </filter>
    <filter>
        <name>splashY</name>
        <type>gain</type>
        <input>
            <value>0.0</value>
        </input>
        <output>
            <property>/environment/aircraft-effects/splash-vector-y</property>
        </output>
    </filter>
    <filter>
        <name>splashZ</name>
        <type>gain</type>
        <input>
            <property>/fdm/jsbsim/glass-effects/splashz</property>
        </input>
        <output>
            <property>/environment/aircraft-effects/splash-vector-z</property>
        </output>
    </filter>
</PropertyList>
</syntaxhighlight>
You could reduce the above method to
<syntaxhighlight lang="xml">
<?xml version="1.0"?>
<system name="c172p-glass-effects">
    <channel name="rain">
        <fcs_function name="glass-effects/airspeed-clamped-sqrt">
            <function> 
                <sqrt>
                    <quotient>
                        <min>
                            <property>/velocities/airspeed-kt</property>
                            <value>40</value>
                        </min>
                        <value>40</value>
                    </quotient>
                </sqrt>
            </function>
        </fcs_function>
        <fcs_function name="glass-effects/splashx">
            <function>
                <difference>
                    <value>-0.1</value>
                    <product>
                        <value>2.0</value>
                        <property>/fdm/jsbsim/glass-effects/airspeed-clamped-sqrt</property>
                    </product>
                </difference>
            </function>
            <output>/environment/aircraft-effects/splash-vector-x</output>
        </fcs_function>
        <fcs_function name="glass-effects/splashy">
            <function>
              <value>0.0</value>
            </function>
            <output>/environment/aircraft-effects/splash-vector-y</output>
        </fcs_function>
        <fcs_function name="glass-effects/splashz">
            <function>
                <difference>
                    <value>1.0</value>
                    <product>
                        <value>1.35</value>
                        <property>/fdm/jsbsim/glass-effects/airspeed-clamped-sqrt</property>
                    </product>
                </difference>
            </function>
            <output>/environment/aircraft-effects/splash-vector-z</output>
        </fcs_function>
    </channel>
</system>
</syntaxhighlight>


=== Frost and fogging ===
=== Frost and fogging ===
373

edits

Navigation menu