Board index FlightGear Development Effects and shaders

Glass

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Re: Glass

Postby dtlan201 » Sat Nov 07, 2015 4:47 am

I managed to deal with the rain splash through the cockpit but the splash only work when you see it outside the cockpit.

when
I change
Code: Select all
   var splash_x = -0.1 - 1.0 * airspeed;
   var splash_y = 0.0;
   var splash_z = 0.4 - 0.7 * airspeed;

    setprop("/environment/aircraft-effects/splash-vector-x", splash_x);
    setprop("/environment/aircraft-effects/splash-vector-y", splash_y);
    setprop("/environment/aircraft-effects/splash-vector-z", splash_z);

to
Code: Select all
   var splash_x = 0.68 - 1.0 * airspeed;
   var splash_y = 0.0;
   var splash_z = 0.4 - 0.7 * airspeed;

    setprop("/environment/aircraft-effects/splash-vector-x", splash_x);
    setprop("/environment/aircraft-effects/splash-vector-y", splash_y);
    setprop("/environment/aircraft-effects/splash-vector-z", splash_z);

I can see the rain drop inside the cockpit but can't from the outside
dtlan201
 
Posts: 191
Joined: Sun Sep 29, 2013 4:49 am
Callsign: MIA0774
Version: nightly
OS: Windows 10

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 6:16 am

Flip the normal

What do you mean? Which way are the normal's pointing. In the c172p they are pointing out. In fact, if I am remembering correctly, if they point in it won't work. If you look at Nasal/weather.nas and also look at the different glass object in Models/c172p.blend. It's fairly complex because we're using multiple glass for different effects. The rain is being applied to the "glas_interior" object.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby dtlan201 » Sat Nov 07, 2015 6:27 am

If I flip the normal outside how can I see it from inside cockpit?
dtlan201
 
Posts: 191
Joined: Sun Sep 29, 2013 4:49 am
Callsign: MIA0774
Version: nightly
OS: Windows 10

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 6:40 am

It's transparent!
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 10:48 am

For anyone interested in improving the rain code that we currently do in nasal. If your aircraft is jsbsim, you can get the rain code out of nasal and use FDM functions and XML in its place. I just finished setting up the c172p this way. It is every bit as flexible and seems to be much smoother. I think this example code can be improved considerably, which I plan to do eventually.
First
Code: Select all
<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>

And then a property rule
Code: Select all
<?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>


That's all there is to it.

The areas for improvement is to have a "max" on the lower end of the airspeed. The low end of the original nasal function acted strange in my opinion. Also I think a "switch" is needed for when the prop is turned on/off.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 7:07 pm

You can eliminate the property rule filters

Code: Select all
<?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>


I'm not finished with this. It needs some adjustment to the front end of the effect (no speed to lower speeds)
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby wlbragg » Thu Nov 12, 2015 1:06 am

@Thorsten, how hard would it be for you to add another (third) switch similar to the surface-mapping-scheme for the side windows but fo the back window?

I think what we need is one for the back window that would make the rain act opposite what the front window does. Right now we have rain stream up from bottom to top. It does the same in the back but really needs to stream from top to bottom. So would the inverse of what we have now be difficult to program and create a separate switch for?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby Thorsten » Thu Nov 12, 2015 8:13 am

If you point the splash vector onto the front window, the dot product with the normal of a rear window should actually be zero, i.e. if done correctly there should only ever be static raindrops shown on it.

I'm kind of lost as to the use case - do you want to taxi backward?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Glass

Postby dtlan201 » Thu Nov 12, 2015 11:27 am

Finally working ! Cheers!!
dtlan201
 
Posts: 191
Joined: Sun Sep 29, 2013 4:49 am
Callsign: MIA0774
Version: nightly
OS: Windows 10

Re: Glass

Postby wlbragg » Thu Nov 12, 2015 12:11 pm

dtlan201 wrote in Thu Nov 12, 2015 11:27 am:Finally working ! Cheers!!

Glad to hear, did you identify what was wrong?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby wlbragg » Thu Nov 12, 2015 12:21 pm

Thorsten wrote in Thu Nov 12, 2015 8:13 am:If you point the splash vector onto the front window, the dot product with the normal of a rear window should actually be zero, i.e. if done correctly there should only ever be static raindrops shown on it.

Well then I am not doing it correctly. Our back window on the c172p mimics what is happening on the front window.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Glass

Postby legoboyvdlp » Thu Nov 12, 2015 2:20 pm

Dtlan, just a question, what airport is that?
Best,
Lego
(Glad you got it to work. Will it be in the private gitlab dev branch?)
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Glass

Postby dtlan201 » Thu Nov 12, 2015 3:18 pm

It is VVNB(noibai) my custom scenery, you can get ithttp://www.mediafire.com/download/tr9o949eex3rp37/Noibai+Intl.rar
The terminal on the right is using real textures that I taken.I can't remeber if I updated the airport to mediafire yet( so it might not look like in my video)? Also I'm going to replace all of them with real texure soon.Btw I'm trying to test the new rain effectr b4 pushing it to git.
dtlan201
 
Posts: 191
Joined: Sun Sep 29, 2013 4:49 am
Callsign: MIA0774
Version: nightly
OS: Windows 10

Re: Glass

Postby Thorsten » Thu Nov 12, 2015 3:43 pm

Well then I am not doing it correctly. Our back window on the c172p mimics what is happening on the front window.


Well, could you check where the normal is pointing?

In other matters - I think your approach of using property rules rather than Nasal for the splash vector is actually superior - once you are satisfied with it, would you consider altering the Wiki accordingly to establish the property rules as 'best practice'?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Glass

Postby legoboyvdlp » Thu Nov 12, 2015 5:03 pm

@dtlan, that's great. I'll download it...
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests