Board index FlightGear Development Aircraft

More realistic Blackout/Redout

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

More realistic Blackout/Redout

Postby Necolatis » Sun Nov 13, 2016 1:44 am

I often had trouble adjusting the blackout/redout values in flightgear.
If the aircraft is rated for 9G and the pilot should be able to control it at that G you cannot just enter 9G in flightgear, as that will render the screen completely black at 9G.
You also cannot just set it to 10.5G, cause the pilot will then be able to operate at 9G in infinity.

So how about a more realistic blackout/redout system, that works like a real military simulator. (anno 1979)

Get it here, enjoy:

http://wiki.flightgear.org/Custom_blackout_system

Its easy to install in your aircraft, and we have extensively tested this in OPRF virtual airforce for approx half a year in both Yasim and JSBSim aircraft, there seems to be no bugs or degradation of performance.

You can customize it to whatever G-suit performance you want your pilot to wear.

PS: The G-LOC has not been implemented, consciousness and control of aircraft is retained at all times.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby Thorsten » Sun Nov 13, 2016 8:15 am

What about adding tunnel vision and removing the color while we're at it? I'm thinking desaturation filter and vignette faded in...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: More realistic Blackout/Redout

Postby Necolatis » Sun Nov 13, 2016 9:31 am

That sounds nice. However I don't know how to integrate/make a shader that works on the entire screen. Have only tinkered a little with the ubershader so far.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby Thorsten » Sun Nov 13, 2016 9:54 am

ALS filters are called by every ALS shader, so in essence they operate on the whole screen. It'd work like the night vision or IR vision. There's an equivalent different way of doing it in Rembrandt, though I never looked into this myself.

I didn't mean you have to do this on your own - I know the technical means (and have toyed with the idea before) but I don't have the research done to make this look good.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: More realistic Blackout/Redout

Postby Necolatis » Sun Nov 13, 2016 10:24 am

Just in case you would want to look into it at some point, this describes simulation of tunnel vision, greyout, blackout in detail:

http://www.dtic.mil/dtic/tr/fulltext/u2/a109127.pdf
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby Thorsten » Sun Nov 13, 2016 1:31 pm

Yay - thanks - that looks fairly cool and interesting!
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: More realistic Blackout/Redout

Postby Thorsten » Sun Nov 13, 2016 2:47 pm

Actually, I think this is too good to be implemented the way it is. Not playing nice with a default dialog isn't the best of things...

I would much prefer a solution where this replaces the current default on fgdata, i.e. is available optionally for all aircraft and allows the aircraft then to set the defaults of the dialog which the user can change.

For such a general solution, I would also prefer a formulation in terms of property rules rather than a Nasal script. Are you interested in doing that? I would try to get the corresponding ALS filter hooks done to make the visuals a bit more interesting.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: More realistic Blackout/Redout

Postby Necolatis » Sun Nov 13, 2016 3:07 pm

I have no experience with property rules, but I will try and learn that. If I succeed in that, the answer is yes.

Will start doing learning that now. Thank you.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby Johan G » Sun Nov 13, 2016 6:01 pm


Added some links to the bottom of that article, including the technical report, and to Howto:Add blackout and redout settings (and links back from that one). Will hopefully be of help to someone.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: More realistic Blackout/Redout

Postby Necolatis » Sun Nov 13, 2016 6:02 pm

Okay, made the blackout part in property rules, did not realize it was just same syntax as autopilot. Redout next. :)

Does any know: Can I make params inside the rule file that is just for internal use that is not exposed in the property tree? If yes, how?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby Thorsten » Sun Nov 13, 2016 6:39 pm

I don't think you can... My experience is mostly with JSBSim systems (and they work kind of similar), but everything internal gets exposed. Which is sort of useful for debugging. Usually it doesn't matter, but you can always have internal stuff in a subdirectory of the tree and only the input/output nodes in the base directory if you like it clean.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: More realistic Blackout/Redout

Postby Necolatis » Mon Nov 14, 2016 9:10 am

Roger.

Its done as a property rules now.

Here is the rules file: (not sure what the standard for $FGData headers are)

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!--
###################################################################################
##                                                                               ##
## Improved redout/blackout system for Flightgear                                ##
##                                                                               ##
## Author: Nikolai V. Chr.                                                       ##
##                                                                               ##
## Todo: Tie in with Thorstens ALS greyout and tunnel vision filters             ##
##                                                                               ##
##                                                                               ##
## Version 2.02            License: GPL 2.0                                      ##
##                                                                               ##
###################################################################################
-->
<PropertyList>

    <params>
        <onset-b>sim/rendering/redout/parameters/blackout-onset-g</onset-b>
        <fast-b>sim/rendering/redout/parameters/blackout-complete-g</fast-b>
        <onset-r>sim/rendering/redout/parameters/redout-onset-g</onset-r>
        <fast-r>sim/rendering/redout/parameters/redout-complete-g</fast-r>
        <onset-t-b>sim/rendering/redout/parameters/onset-blackout-sec</onset-t-b>
        <fast-t-b>sim/rendering/redout/parameters/fast-blackout-sec</fast-t-b>
        <onset-t-r>sim/rendering/redout/parameters/onset-redout-sec</onset-t-r>
        <fast-t-r>sim/rendering/redout/parameters/fast-redout-sec</fast-t-r>
        <rec-f>sim/rendering/redout/parameters/recover-fast-sec</rec-f>
        <rec-s>sim/rendering/redout/parameters/recover-slow-sec</rec-s>
        <log>
            <g-force>sim/rendering/redout/internal/log/g-force</g-force>
            <onset-b>sim/rendering/redout/internal/log/onset-b</onset-b>
            <fast-b>sim/rendering/redout/internal/log/fast-b</fast-b>
            <g-force-r>sim/rendering/redout/internal/log/g-force-r</g-force-r>
            <onset-r>sim/rendering/redout/internal/log/onset-r</onset-r>
            <fast-r>sim/rendering/redout/internal/log/fast-r</fast-r>
        </log>
        <g-force>sim/rendering/redout/internal/g-force</g-force>
        <g-force-inv>sim/rendering/redout/internal/g-force-inv</g-force-inv>
        <blackout>sim/rendering/redout/internal/blackout</blackout>
        <redout>sim/rendering/redout/internal/redout</redout>

        <alpha>sim/rendering/redout/alpha</alpha>
        <red>sim/rendering/redout/red</red>
        <inside>sim/current-view/internal</inside>
        <sum>sim/rendering/redout/internal/sum</sum>
        <enable>sim/rendering/redout/enabled</enable>
    </params>

    <filter><!-- check for NaN -->
        <type>gain</type>
        <gain>0</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <not>
                    <less-than>
                        <property alias="/params/blackout"/>
                        <value>1000.0</value>
                    </less-than>
                    <greater-than>
                        <property alias="/params/blackout"/>
                        <value>-1000.0</value>
                    </greater-than>
                </not>
            </condition>
        </enable>
        <input>
            <value>0</value>
        </input>
        <output alias="/params/blackout"/>
    </filter>

    <filter><!-- check for NaN -->
        <type>gain</type>
        <gain>0</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <not>
                    <less-than>
                        <property alias="/params/redout"/>
                        <value>1000.0</value>
                    </less-than>
                    <greater-than>
                        <property alias="/params/redout"/>
                        <value>-1000.0</value>
                    </greater-than>
                </not>
            </condition>
        </enable>
        <input>
            <value>0</value>
        </input>
        <output alias="/params/redout"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>-1</gain>
        <enable>
            <!-- check if JSBSim is the FDM. -->
            <condition>
                <property alias="/params/enable"/>
                <less-than>
                    <property>fdm/jsbsim/aero/alpha-deg</property>
                    <value>180.0</value>
                </less-than>
                <greater-than>
                    <property>fdm/jsbsim/aero/alpha-deg</property>
                    <value>-180.0</value>
                </greater-than>
            </condition>
        </enable>
        <input>
            <expression>
                <div>
                    <property>accelerations/pilot/z-accel-fps_sec</property>
                    <value>32.174</value>
                </div>
            </expression>
        </input>
        <output alias="/params/g-force"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <!-- check if YaSim is the FDM. -->
            <condition>
                <property alias="/params/enable"/>
                <not>
                    <less-than>
                        <property>fdm/jsbsim/aero/alpha-deg</property>
                        <value>180.0</value>
                    </less-than>
                    <greater-than>
                        <property>fdm/jsbsim/aero/alpha-deg</property>
                        <value>-180.0</value>
                    </greater-than>
                </not>
            </condition>
        </enable>
        <input>
            <property>accelerations/pilot-g[0]</property>
        </input>
        <output alias="/params/g-force"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
            </condition>
        </enable>
        <input>
            <expression>
                <log10>
                    <property alias="/params/fast-b"/>
                </log10>
            </expression>
        </input>
        <output alias="/params/log/fast-b"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
            </condition>
        </enable>
        <input>
            <expression>
                <log10>
                    <property alias="/params/onset-b"/>
                </log10>
            </expression>
        </input>
        <output alias="/params/log/onset-b"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <less-than-equals>
                    <property alias="/params/g-force"/>
                    <value>1</value>
                </less-than-equals>
            </condition>
        </enable>
        <input>
            <value>0</value>
        </input>
        <output alias="/params/log/g-force"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <greater-than>
                    <property alias="/params/g-force"/>
                    <value>1</value>
                </greater-than>
            </condition>
        </enable>
        <input>
            <expression>
                <log10>
                    <property alias="/params/g-force"/>
                </log10>
            </expression>
        </input>
        <output alias="/params/log/g-force"/>
    </filter>

    <filter><!-- reduce blackout -->
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <less-than>
                    <property alias="/params/g-force"/>
                    <property alias="/params/onset-b"/>
                </less-than>
            </condition>
        </enable>
        <input>
            <expression>
                <min>
                    <value>1</value>
                    <max>
                        <value>0</value>
                        <dif>
                            <property alias="/params/blackout"/>
                            <product>
                                <property>sim/time/delta-sec</property>
                                <div>
                                    <value>1</value>
                                    <max>
                                        <value>0</value>
                                        <sum>
                                            <property alias="/params/rec-f"/>
                                            <product>
                                                <div>
                                                    <dif>
                                                        <property alias="/params/log/g-force"/>
                                                        <log10>
                                                            <value>1</value>
                                                        </log10>
                                                    </dif>
                                                    <dif>
                                                        <property alias="/params/log/onset-b"/>
                                                        <log10>
                                                            <value>1</value>
                                                        </log10>
                                                    </dif>
                                                </div>
                                                <dif>
                                                    <property alias="/params/rec-s"/>
                                                    <property alias="/params/rec-f"/>
                                                </dif>
                                            </product>
                                        </sum>
                                    </max>
                                </div>
                            </product>
                        </dif>
                    </max>
                </min>
            </expression>
        </input>
        <output alias="/params/blackout"/>
    </filter>   

    <filter><!-- increase blackout -->
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <greater-than-equals>
                    <property alias="/params/g-force"/>
                    <property alias="/params/onset-b"/>
                </greater-than-equals>
            </condition>
        </enable>
        <input>
            <expression>
                <min>
                    <value>1</value>
                    <max>
                        <value>0</value>
                        <sum>
                            <property alias="/params/blackout"/>
                            <product>
                                <property>sim/time/delta-sec</property>
                                <div>
                                    <value>1</value>
                                    <max>
                                        <value>0</value>
                                        <pow>
                                            <value>10</value>
                                            <sum>
                                                <log10>
                                                    <property alias="/params/onset-t-b"/>
                                                </log10>
                                                <product>
                                                    <div>
                                                        <dif>
                                                            <property alias="/params/log/g-force"/>
                                                            <property alias="/params/log/onset-b"/>
                                                        </dif>
                                                        <dif>
                                                            <property alias="/params/log/fast-b"/>
                                                            <property alias="/params/log/onset-b"/>
                                                        </dif>
                                                    </div>
                                                    <dif>
                                                        <log10>
                                                            <property alias="/params/fast-t-b"/>
                                                        </log10>
                                                        <log10>
                                                            <property alias="/params/onset-t-b"/>
                                                        </log10>
                                                    </dif>
                                                </product>
                                            </sum>
                                        </pow>
                                    </max>
                                </div>
                            </product>
                        </sum>
                    </max>
                </min>
            </expression>
        </input>
        <output alias="/params/blackout"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
            </condition>
        </enable>
        <input>
            <expression>
                <log10>
                    <product>
                        <value>-1</value>
                        <dif>
                            <property alias="/params/fast-r"/>
                            <value>2</value>
                        </dif>
                    </product>
                </log10>
            </expression>
        </input>
        <output alias="/params/log/fast-r"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
            </condition>
        </enable>
        <input>
            <expression>
                <log10>
                    <product>
                        <value>-1</value>
                        <dif>
                            <property alias="/params/onset-r"/>
                            <value>2</value>
                        </dif>
                    </product>
                </log10>
            </expression>
        </input>
        <output alias="/params/log/onset-r"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>-1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
            </condition>
        </enable>
        <input>
            <expression>
                <dif>
                    <property alias="/params/g-force"/>
                    <value>2</value>
                </dif>
            </expression>
        </input>
        <output alias="/params/g-force-inv"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <less-than-equals>
                    <property alias="/params/g-force-inv"/>
                    <value>1</value>
                </less-than-equals>
            </condition>
        </enable>
        <input>
            <value>0</value>
        </input>
        <output alias="/params/log/g-force-r"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <greater-than>
                    <property alias="/params/g-force-inv"/>
                    <value>1</value>
                </greater-than>
            </condition>
        </enable>
        <input>
            <expression>
                <log10>
                    <property alias="/params/g-force-inv"/>
                </log10>
            </expression>
        </input>
        <output alias="/params/log/g-force-r"/>
    </filter>

    <filter><!-- reduce redout -->
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <greater-than>
                    <property alias="/params/g-force"/>
                    <property alias="/params/onset-r"/>
                </greater-than>
            </condition>
        </enable>
        <input>
            <expression>
                <min>
                    <value>1</value>
                    <max>
                        <value>0</value>
                        <dif>
                            <property alias="/params/redout"/>
                            <product>
                                <property>sim/time/delta-sec</property>
                                <div>
                                    <value>1</value>
                                    <max>
                                        <value>0</value>
                                        <sum>
                                            <property alias="/params/rec-f"/>
                                            <product>
                                                <div>
                                                    <dif>
                                                        <property alias="/params/log/g-force-r"/>
                                                        <log10>
                                                            <value>1</value>
                                                        </log10>
                                                    </dif>
                                                    <dif>
                                                        <property alias="/params/log/onset-r"/>
                                                        <log10>
                                                            <value>1</value>
                                                        </log10>
                                                    </dif>
                                                </div>
                                                <dif>
                                                    <property alias="/params/rec-s"/>
                                                    <property alias="/params/rec-f"/>
                                                </dif>
                                            </product>
                                        </sum>
                                    </max>
                                </div>
                            </product>
                        </dif>
                    </max>
                </min>
            </expression>
        </input>
        <output alias="/params/redout"/>
    </filter>   

    <filter><!-- increase redout -->
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <less-than-equals>
                    <property alias="/params/g-force"/>
                    <property alias="/params/onset-r"/>
                </less-than-equals>
            </condition>
        </enable>
        <input>
            <expression>
                <min>
                    <value>1</value>
                    <max>
                        <value>0</value>
                        <sum>
                            <property alias="/params/redout"/>
                            <product>
                                <property>sim/time/delta-sec</property>
                                <div>
                                    <value>1</value>
                                    <max>
                                        <value>0</value>
                                        <pow>
                                            <value>10</value>
                                            <sum>
                                                <log10>
                                                    <property alias="/params/onset-t-r"/>
                                                </log10>
                                                <product>
                                                    <div>
                                                        <dif>
                                                            <property alias="/params/log/g-force-r"/>
                                                            <property alias="/params/log/onset-r"/>
                                                        </dif>
                                                        <dif>
                                                            <property alias="/params/log/fast-r"/>
                                                            <property alias="/params/log/onset-r"/>
                                                        </dif>
                                                    </div>
                                                    <dif>
                                                        <log10>
                                                            <property alias="/params/fast-t-r"/>
                                                        </log10>
                                                        <log10>
                                                            <property alias="/params/onset-t-r"/>
                                                        </log10>
                                                    </dif>
                                                </product>
                                            </sum>
                                        </pow>
                                    </max>
                                </div>
                            </product>
                        </sum>
                    </max>
                </min>
            </expression>
        </input>
        <output alias="/params/redout"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
            </condition>
        </enable>
        <input>
            <expression>
                <dif>
                    <property alias="/params/blackout"/>
                    <property alias="/params/redout"/>
                </dif>
            </expression>
        </input>
        <output alias="/params/sum"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <equals>
                    <property alias="/params/inside"/>
                    <value>1</value>
                </equals>
                <less-than>
                    <property alias="/params/sum"/>
                    <value>0</value>
                </less-than>
            </condition>
        </enable>
        <input>
            <value>1</value>
        </input>
        <output alias="/params/red"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <equals>
                    <property alias="/params/inside"/>
                    <value>1</value>
                </equals>
                <less-than>
                    <property alias="/params/sum"/>
                    <value>0</value>
                </less-than>
            </condition>
        </enable>
        <input>
            <expression>
                <product>
                    <property alias="/params/sum"/>
                    <value>-1</value>
                </product>
            </expression>
        </input>
        <output alias="/params/alpha"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <equals>
                    <property alias="/params/inside"/>
                    <value>1</value>
                </equals>
                <greater-than-equals>
                    <property alias="/params/sum"/>
                    <value>0</value>
                </greater-than-equals>
            </condition>
        </enable>
        <input>
            <value>0</value>
        </input>
        <output alias="/params/red"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>1</gain>
        <enable>
            <condition>
                <property alias="/params/enable"/>
                <equals>
                    <property alias="/params/inside"/>
                    <value>1</value>
                </equals>
                <greater-than-equals>
                    <property alias="/params/sum"/>
                    <value>0</value>
                </greater-than-equals>
            </condition>
        </enable>
        <input>
            <property alias="/params/sum"/>
        </input>
        <output alias="/params/alpha"/>
    </filter>

    <filter>
        <type>gain</type>
        <gain>0</gain>
        <enable>
            <condition>
                <or>
                    <not>
                        <property alias="/params/enable"/>
                    </not>
                    <equals>
                        <property alias="/params/inside"/>
                        <value>0</value>
                    </equals>
                </or>
            </condition>
        </enable>
        <input>
            <value>0</value>
        </input>
        <output alias="/params/alpha"/>
    </filter>

</PropertyList>



Here is the definition of the properties inside sim/rendering:

Code: Select all
    <redout>
      <enabled type="bool">true</enabled>
      <internal>
        <g-force type="double">1</g-force>
        <g-force-inv type="double">1</g-force-inv>
        <blackout type="double">0</blackout>
        <redout type="double">0</redout>
        <sum type="double">0</sum>
        <log>
          <g-force type="double">0</g-force>
          <onset-b type="double">0</onset-b>
          <fast-b type="double">0</fast-b>
          <g-force-r type="double">0</g-force-r>
          <onset-r type="double">0</onset-r>
          <fast-r type="double">0</fast-r>
        </log>
      </internal>
      <parameters>
          <blackout-onset-g type="double">2.5</blackout-onset-g>
          <blackout-complete-g type="double">4</blackout-complete-g>
          <onset-blackout-sec type="double">300</onset-blackout-sec>
          <fast-blackout-sec type="double">10</fast-blackout-sec>
          <redout-onset-g type="double">-2</redout-onset-g>
          <redout-complete-g type="double">-4</redout-complete-g>
          <onset-redout-sec type="double">45</onset-redout-sec>
          <fast-redout-sec type="double">7.5</fast-redout-sec>
          <recover-fast-sec type="double">7</recover-fast-sec>
          <recover-slow-sec type="double">15</recover-slow-sec>
      </parameters>
    </redout>


Here is the modified $FGDATA/Nasal/redout.nas where blackout/redout has been factored out, and only head-shake is left:

Code: Select all
# Damped G value - starts at 1.
var GDamped = 1.0;
var previousG = 1.0;
var running_compression = 0;
var fdm = "jsb";

var compression_rate = nil;
var internal = nil;

var lp_black = nil;
var lp_red = nil;

var run = func {

  if (running_compression)
  {
    var GCurrent = 1.0;

    if (fdm == "jsb")
    {
      GCurrent = getprop("/accelerations/pilot/z-accel-fps_sec");
      if (GCurrent != nil) GCurrent = - GCurrent / 32;
    }
    else
    {
      GCurrent = getprop("/accelerations/pilot-g[0]");
    }

    if (GCurrent == nil)
    {
      GCurrent = 1.0;
    }

    # Updated the GDamped using a filter.
    if (GDamped < 0)
    {
        # Redout happens faster and clears quicker
        GDamped = lp_red.filter(GCurrent);
    }
    else
    {
        GDamped = lp_black.filter(GCurrent);
    }

    setprop("/accelerations/pilot-gdamped", GDamped);

    if (internal)
    {
      if (running_compression)
      {
        # Apply any compression due to G-forces
        if (GDamped != previousG)
        {
          var current_y_offset = getprop("/sim/current-view/y-offset-m");
          setprop("/sim/current-view/y-offset-m", current_y_offset - (GDamped - previousG) * compression_rate);
          previousG = GDamped;
        }
      }
    }

    settimer(run, 0);
  }
}

var fdm_init_listener = _setlistener("/sim/signals/fdm-initialized",
  func {
    removelistener(fdm_init_listener); # uninstall, so we're only called once
    fdm = getprop("/sim/flight-model");
    running_compression = getprop("/sim/rendering/headshake/enabled");
    internal = getprop("/sim/current-view/internal");
    lp_black = aircraft.lowpass.new(0.2);
    lp_red = aircraft.lowpass.new(0.25);

    setlistener("/sim/current-view/internal", func(n) {
      internal = n.getBoolValue();
    });

    setlistener("/sim/rendering/headshake/rate-m-g", func(n) {
      compression_rate = n.getValue();
    }, 1);

    setlistener("/sim/rendering/headshake/enabled", func(n) {
      if ((running_compression == 0) and (running_redout == 0) and n.getBoolValue())
      {
        running_compression = 1;
        # start new timer now
        run();
      }
      else
      {
        running_compression = n.getBoolValue();
      }
    }, 1);

    # Now we've set up the listeners (which will have triggered), run it.
    run();
  }
);


Not tested with Yasim yet, but should work.

So do you think all parameters should be exposed in the GUI, or will that be too messy? Could work with only the two sliders that is exposed now, and let aircraft makers adjust the details.
But I guess it needs minimum a toggle for old or new system, unless that should be left up to aircraft. I really have no experience with making pretty PUI dialogs (only made an ugly simple one), but if you want me to modify the dialog, I can try.
Last edited by Necolatis on Sun Nov 20, 2016 7:59 am, edited 5 times in total.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby Thorsten » Mon Nov 14, 2016 10:10 am

Huh- that's fast...

I will not push anything just before release (for obvious reasons...) but wait till the branching is done.

I would boldly discard the old system - on the grounds that you've actually done some research to make it realistic. If anyone is really attached to the old, we can perhaps make it resurrectable via property flag.

I don't think many people appreciate the fine-print of modeling and will just be interested in adjusting rough limits when g-forces are felt, so perhaps a 2-slider system is okay, and you can set the other parameters to reasonable defaults for no g-suits and let them be fine-adjusted by the plane if the plane is usually flown with a g-suit (and if desired offer a plane-side dialog).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: More realistic Blackout/Redout

Postby Necolatis » Mon Nov 14, 2016 10:37 am

Sounds like a plan. :)
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2240
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: More realistic Blackout/Redout

Postby D-EKEW » Mon Nov 14, 2016 5:40 pm

per definition 'g' is per g_0 = 9.80665 m/s2 (or 32.174 ft/s2).
I think you are dividing though a variable acceleration that depends on latitude (vicinity to the earth rotation axis) or even altitude, I am not sure. But you should just divide by the above constant.

cheers,

Eric
D-EKEW
 
Posts: 174
Joined: Mon Jan 10, 2011 9:22 pm
Callsign: D-EKEW, ELLX-TWR
Version: git
OS: Linux

Next

Return to Aircraft

Who is online

Users browsing this forum: No registered users and 6 guests