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 erik » Fri Mar 20, 2015 6:04 pm

I copied the following code from the C22J:
Code: Select all
 <effect>
<inherits-from>Effects/model-combined-transparent</inherits-from>
<parameters>
<normalmap-enabled type="int">0</normalmap-enabled>
<lightmap-enabled type="int">0</lightmap-enabled>
<reflection-enabled type="int">1</reflection-enabled>
<reflection-correction type="float">0.5</reflection-correction>
<reflect-map-enabled type="int">1</reflect-map-enabled>
<reflection-fresnel type="float">0.5</reflection-fresnel>
<reflection-rainbow type="float">0.6</reflection-rainbow>
<reflection-noise type="float">0.0</reflection-noise>
<reflection-dynamic type="int">1</reflection-dynamic>
<texture n= "5" >
<type>cubemap</type>
<images>
<positive-x>Aircraft/Generic/Effects/fgfs-sky2/1.png</positive-x>
<negative-x>Aircraft/Generic/Effects/fgfs-sky2/4.png</negative-x>
<positive-y>Aircraft/Generic/Effects/fgfs-sky2/2.png</positive-y>
<negative-y>Aircraft/Generic/Effects/fgfs-sky2/3.png</negative-y>
<positive-z>Aircraft/Generic/Effects/fgfs-sky2/6.png</positive-z>
<negative-z>Aircraft/Generic/Effects/fgfs-sky2/5.png</negative-z>
</images>
</texture>
<ambient-correction type="float">0.2</ambient-correction>
<rendering-hint>transparent</rendering-hint>
<transparent>true</transparent>
<render-bin>
<bin-number>10</bin-number>
<bin-name>DepthSortedBin</bin-name>
</render-bin>
</parameters>
<object-name>CanopyForwardOutside</object-name>
<object-name>CanopyBackOutside</object-name>
<object-name>cylinder.007</object-name> <!-- HUD -->
</effect>


Erik
erik
 
Posts: 1665
Joined: Thu Nov 01, 2007 1:41 pm

Re: Glass

Postby erik » Fri Mar 20, 2015 6:05 pm

Thorsten wrote in Fri Mar 20, 2015 3:11 pm:Don't forget

Code: Select all
<rain-enabled type="int">1</rain-enabled>


to generate (coarser) outside rain splashes on the canopy.


Ah yes, thanks for the hint. I did forgot about that.

Erik
erik
 
Posts: 1665
Joined: Thu Nov 01, 2007 1:41 pm

Re: Glass

Postby AndersG » Fri Mar 20, 2015 7:10 pm

Thorsten wrote in Fri Mar 20, 2015 10:28 am:Make sure the fragment shader has a normal called 'normal', then insert as last line

Code: Select all
gl_FragColor = vec4 (normal, 1.0);


and that's all (really).


You can also try

Code: Select all
gl_FragColor = vec4 (0.5*normal + 0.5, 1.0);


to display the normal in a non-lossy way.
(Assuming that the colour components are clipped to the [0,1] range like in the HLSL shader models available in XNA.)
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2477
Joined: Wed Nov 29, 2006 9:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Glass

Postby Thorsten » Sat Mar 21, 2015 6:53 am

I've pushed support for a user-controlled glare strength of the overlay layer as well as optional alternative coordinate mappings (primarily intended to solve the side window problem. The parameters are

Code: Select all
   <surface-mapping-scheme type="int">0</surface-mapping-scheme>
   <overlay-glare type="float">0.5</overlay-glare>


Documentation also added to the wiki.
Thorsten
 
Posts: 11723
Joined: Mon Nov 02, 2009 8:33 am

Re: Glass

Postby wlbragg » Sat Mar 21, 2015 7:26 am

I've pushed support for a user-controlled glare strength of the overlay layer as well as optional alternative coordinate mappings

Excellent, thank you!
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5734
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 Mar 21, 2015 5:25 pm

optional alternative coordinate mappings

Just to verify, it is one or the other, you can't apply optional alternative coordinate mappings to side window objects and original mapping to front windshield, still only one effects/glass inheritance, correct?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5734
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 » Sat Mar 21, 2015 5:56 pm

Just to verify, it is one or the other, you can't apply optional alternative coordinate mappings to side window objects and original mapping to front windshield, still only one effects/glass inheritance, correct?


Yes, you need two effects.
Thorsten
 
Posts: 11723
Joined: Mon Nov 02, 2009 8:33 am

Re: Glass

Postby wlbragg » Sat Mar 21, 2015 6:15 pm

you need two effects.

Well, that is what I was hoping for as the other way would just relocate the less desirable effects.

The only reason I even had to ask is because I am not getting any side window rain or reflection using ANY method all the sudden (in the c172p-detailed). I can't pin this on anything you did because I think it quit working prior to pulling your new additions. I just got on here late last night and it wasn't working. So I couldn't run tests to answer my own questions because NOTHING is working.

I've looked at everything and can't figure out what the 7*9(*(&^ happened!

What is really strange is I am still getting rain reflect on glas_interior, just not on leftwindow_interior or rightwindow_interior. This is using the original single effects call.


Effects/model-transparent and Effects/glass compatibility got broke somehow

see http://forum.flightgear.org/viewtopic.php?f=47&t=25456&start=90#p236176
Last edited by wlbragg on Sun Mar 22, 2015 3:49 am, edited 2 times in total.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5734
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 Mar 21, 2015 7:04 pm

Replacing this entire posting with

Effects/model-transparent and Effects/glass compatibility got broke somehow.


See http://forum.flightgear.org/viewtopic.php?f=47&t=25456&start=90#p236176
Last edited by wlbragg on Sun Mar 22, 2015 3:48 am, edited 1 time in total.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5734
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 Mar 21, 2015 7:43 pm

Much better Thorsten, thanks.

Is the optional alternative coordinate mapping capable of movement?

Image

ludomotico, can we make the front glass's sides part of the side glass instead of the front. Or even their own 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: 5734
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 Mar 21, 2015 7:50 pm

Thorsten wrote in Sat Mar 21, 2015 5:56 pm:
Just to verify, it is one or the other, you can't apply optional alternative coordinate mappings to side window objects and original mapping to front windshield, still only one effects/glass inheritance, correct?


Yes, you need two effects.


We will still only have one set of splash coords to manipulate, the one set will control all mappings even using different effect/glass configurations for different objects?

Which ties into my other questions about movement of optional alternative coordinate mapping, the alternative coordinate mapping looses its ability to move?

These questions are just to increase my understanding and make sure I have it right and am doing everything allowed, this looks really good, and works fine.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5734
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Glass

Postby ludomotico » Sat Mar 21, 2015 8:33 pm

wlbragg wrote in Sat Mar 21, 2015 7:43 pm:ludomotico, can we make the front glass's sides part of the side glass instead of the front. Or even their own object?


The main glass cannot be joined to the side glass: the doors are animated and you can open them :) I'll make a separated object for this area of the main glass.

I'll also try to make the corner smoother. In any case, if I understood correctly, in that side of the glass the problem is not the smoothness of the angle and the effect must really use a different algorithm.
User avatar
ludomotico
 
Posts: 1126
Joined: Tue Apr 24, 2012 1:01 pm
Version: nightly
OS: Windows 10

Re: Glass

Postby wlbragg » Sat Mar 21, 2015 8:50 pm

'll also try to make the corner smoother.

Yeah, I'm not sure that is necessary now if it is a different object taking on the alternate mapping, so I wouldn't spend too much time on it, I guess.
Thanks
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5734
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 » Sun Mar 22, 2015 3:44 am

I think I got this narrowed down to Effects/model-transparent and Effects/glass compatibility got broke somehow.

I'm back to having to remove glas_interior, leftwindow_interior, rightwindow_interior from Effects/model-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: 5734
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 » Sun Mar 22, 2015 5:56 am

I'll also try to make the corner smoother. In any case, if I understood correctly, in that side of the glass the problem is not the smoothness of the angle and the effect must really use a different algorithm.


The problem on the front window are the hard changes of the splash pattern, and these are directly related to the smoothness, so I would try to smooth the lines.

The problem on the side windows is the coordinate mapping (a coordinate system which projects essentially from the front will look fairly distorted).

I think I got this narrowed down to Effects/model-transparent and Effects/glass compatibility got broke somehow. (...) I'm back to having to remove glas_interior, leftwindow_interior, rightwindow_interior from Effects/model-transparent.


As I said earlier, anything that uses ALS glass should not use model-transparent because it falls back automatically to the technique in other renderers, and the same surface should not be registered twice for different effects, there is no 'compatibility' for this use case and the results are essentially random and difficult to debug.

When I tested the side window mapping, I of course removed the surfaces from other effects.

Which ties into my other questions about movement of optional alternative coordinate mapping, the alternative coordinate mapping looses its ability to move?

We will still only have one set of splash coords to manipulate, the one set will control all mappings even using different effect/glass configurations for different objects?


The splash coordinates (default) are 'clever' because they know of the impact direction of the rain via the splash vector. The 2-coordinate system is not - it knows nothing about the rain, just about the normal. So you can't move it because you don't know which direction the rain comes from.

They can be made to know, and perhaps we will eventually, but for the moment the solution seems acceptable.
Thorsten
 
Posts: 11723
Joined: Mon Nov 02, 2009 8:33 am

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: Isaak and 2 guests