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 3: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: 187
Joined: Sun Sep 29, 2013 3:49 am
Callsign: MIA0774
Version: 3.7
OS: Windows 7

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 5: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(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

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

If I flip the normal outside how can I see it from inside cockpit?
dtlan201
 
Posts: 187
Joined: Sun Sep 29, 2013 3:49 am
Callsign: MIA0774
Version: 3.7
OS: Windows 7

Re: Glass

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

It's transparent!
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 9: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(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby wlbragg » Sat Nov 07, 2015 6: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(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby wlbragg » Thu Nov 12, 2015 12: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(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby Thorsten » Thu Nov 12, 2015 7: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: 11212
Joined: Mon Nov 02, 2009 8:33 am

Re: Glass

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

Finally working ! Cheers!!
dtlan201
 
Posts: 187
Joined: Sun Sep 29, 2013 3:49 am
Callsign: MIA0774
Version: 3.7
OS: Windows 7

Re: Glass

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

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

Glad to hear, did you identify what was wrong?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby wlbragg » Thu Nov 12, 2015 11:21 am

Thorsten wrote in Thu Nov 12, 2015 7: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(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 4991
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby legoboyvdlp » Thu Nov 12, 2015 1: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: 7186
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

Re: Glass

Postby dtlan201 » Thu Nov 12, 2015 2: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: 187
Joined: Sun Sep 29, 2013 3:49 am
Callsign: MIA0774
Version: 3.7
OS: Windows 7

Re: Glass

Postby Thorsten » Thu Nov 12, 2015 2: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: 11212
Joined: Mon Nov 02, 2009 8:33 am

Re: Glass

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

@dtlan, that's great. I'll download it...
User avatar
legoboyvdlp
 
Posts: 7186
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest