Board index FlightGear Development Effects and shaders

The Compositor

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

The Compositor

Postby Necolatis » Fri Aug 30, 2019 4:59 pm

Experimented with the ALS compositor in 2019.2.0. The Viggen in these pics have shadows and occlusion map and normal map. Note that I did not fix the afterburner flame or canopy glass.
The red cones are spot-light light bounds, I did not manage to get them to illuminate the runway.
The G91 has some geometry perpendicular to the camera on its back, thats why there is an extra shadow there.

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

Image

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

Re: The Compositor

Postby wlbragg » Fri Aug 30, 2019 7:04 pm

The Viggen in these pics have shadows

Wow!
How does that work?
That is really something, what is stopping us from using this in earnest?
Would you be willing to write up a short example and how to implement this?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7574
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: The Compositor

Postby Necolatis » Fri Aug 30, 2019 7:58 pm

Well its not released yet, and I think tons of effects/shaders have to be ported first.
An example, yes, but it wont be short, lol. Took me hours to figure out some of this, should cover everything you need that is not mentioned in Icecode GL's readme:

First compile 2091.2.0 with COMPOSITOR cmake flag enabled.
Then extract and overwrite in $FGDATA with the zip file from FG Discord.
Edit Compositor/default.xml to say: <PropertyList include="ALS/als.xml"/>
Edit Compositor/ALS/als.xml and comment out the first quad.
Edit Compositor/ALS/als.xml and change the second quad's buffer to color.
Edit Compositor/ALS/als.xml and change the geometry of second quad to cover entire screen.
Edit Compositor/ALS/als.xml and change the properties in sun-shadowmap-atlas to say /sim/rendering/als/shadows/atlas-size
Edit your fuselage effect to add <scheme>als-lighting</scheme> in the ALS technique
Add this uniform to the same technique:
Code: Select all
            <uniform>
              <name>shadow_tex</name>
              <type>sampler-2d</type>
              <value type="int">10</value>
            </uniform>

Add to same technique these shaders, and edit their numbering accordingly:
Code: Select all
<vertex-shader n="0">Compositor/Shaders/shadow-util.vert</vertex-shader>
<fragment-shader n="0">Compositor/Shaders/shadow-util.frag</fragment-shader>

Edit the ALS model fragment shader you use in same technique and add this in declarations: float getShadowing();
In same technique multiply specular and diffuse color terms with getShadowing().
Edit the ALS model vertex shader you use in same technique and add this in declarations: void setupShadows(vec4 eyeSpacePos);
Add this to bottom of same shader: setupShadows(gl_ModelViewMatrix * gl_Vertex);
Move all your local aircraft fuselage effect into Compositor (including what they inherit from), so they have same path just with compositor prepended. For example $FGDATA/Compositor/JA37/Models/Effect/fuselage/myEffect.eff
That step is so you dont have to edit hundreds of model effect paths. As in 2019.2 effects inside aircraft is no longer supported. :(
Start Fg with:
--prop:bool:/sim/rendering/als/shadows/enabled=true
--prop:int:/sim/rendering/als/shadows/atlas-size=2048
Make sure to run with ALS and enough model shader setting to run your desired technique.

Hope I didn't forget something.
If you want occlusion-map also you will have to implement that yourself in the shader/effect code and bake a map.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2232
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: The Compositor

Postby Necolatis » Fri Aug 30, 2019 9:00 pm

Also note that the old effect "noshadow" still is respected by compositor, so use that for geometry you don't want to cast shadow.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2232
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: The Compositor

Postby icecode » Fri Aug 30, 2019 9:40 pm

Very cool screenshots! It's very nice to finally see shadows in ALS on someone else's FlightGear. :)

The red cones are spot-light light bounds, I did not manage to get them to illuminate the runway.


Spot lights aren't supported yet for clustered shading, i.e. they are registered and parsed but aren't processed as lights. Point lights are, but I don't remember what's their current status regarding shaders.

That is really something, what is stopping us from using this in earnest?


Nothing! As Necolatis said, it's mostly tedious work to port all effects to the Compositor.

An example, yes, but it wont be short, lol. Took me hours to figure out some of this, should cover everything you need that is not mentioned in Icecode GL's readme:


I guess I left my WIP in a worse state than I imagined. :lol: Feel free to distribute your own zip with the changes if you want.

Also note that the old effect "noshadow" still is respected by compositor, so use that for geometry you don't want to cast shadow.


It is for now. I've thought of other (more flexible) ways to allow users to select which scene objects they want casting shadows. Nothing is set in stone yet, so if any aircraft devs are planning to add support for shadows/lights, please wait a bit more until this kind of stuff is decided. :)
icecode
 
Posts: 708
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: The Compositor

Postby Alant » Fri Aug 30, 2019 11:27 pm

Congratulations.

Lesser mortals (e.g. Alan) are awaiting a cook book giving us some clues as how we can use this.

Thanks

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: The Compositor

Postby wlbragg » Sat Aug 31, 2019 7:41 am

Yes, thank you for what you already posted. I think it is a good enough to get me to at least try it.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7574
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: The Compositor

Postby SurferTim » Tue Oct 08, 2019 10:51 am

Thorsten mentioned this was coming months ago. It was supposed to be the answer to my lighting problems. Any docs yet on this feature?
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1688
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: The Compositor

Postby icecode » Tue Oct 08, 2019 11:00 am

I wouldn't classify it as a feature, more as a complete rework. These things take time, and even when it becomes available it probably won't be stable and you'll generally prefer using the legacy renderer.
icecode
 
Posts: 708
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: The Compositor

Postby SurferTim » Tue Oct 08, 2019 11:21 am

Icecode GL wrote in Tue Oct 08, 2019 11:00 am:I wouldn't classify it as a feature, more as a complete rework. These things take time, and even when it becomes available it probably won't be stable and you'll generally prefer using the legacy renderer.

Fair enough. Have you had an opportunity to test this in a multiple monitor situation? I'm using Ubuntu 18.04, and setting the three monitors to act as one big monitor has been a daunting undertaking. Will this rework require I set up as one big monitor?

Edit: I am using a compiled version of FG 2019.2.0. When you think it would be worth recompiling for, let me know.
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1688
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: The Compositor

Postby icecode » Tue Oct 08, 2019 11:52 am

I haven't been able to test it myself, but it's supposed to work with multiple monitors.
icecode
 
Posts: 708
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: The Compositor

Postby SurferTim » Tue Oct 08, 2019 12:12 pm

Thanks for that. BTW, if you need a beta tester, I would like to volunteer. I can run multiple versions of FG (so far), so I should be able to test one while using a stable version for my flying.
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1688
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: The Compositor

Postby icecode » Fri Nov 01, 2019 4:14 pm

Here are some more pictures after porting most effects to the Compositor:

Image

Image

Image

Image
icecode
 
Posts: 708
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: The Compositor

Postby wlbragg » Fri Nov 01, 2019 5:24 pm

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

Re: The Compositor

Postby Necolatis » Fri Nov 01, 2019 6:44 pm

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

Next

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest

cron