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!

Re: The Compositor

Postby Hooray » Fri Nov 29, 2019 4:43 am

It would be great if the people posting screen shots and instructions (d&c), could also add those to the compositor wiki article - so that we can grow a single "go to" resource over time, without having to tell people "search the forum". In addition, that would make it easier to also reuse such artwork/text elsewhere, e.g. in the newsletter/changelog.

Also, maybe the about dialog should be updated to display some kind of "compositor mode" property (available vs. on/off) ?
That way, end users would be more easily able to tell if they have the correct binary and if the compositor is enabled or not.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11987
Joined: Tue Mar 25, 2008 8:40 am

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 5:10 am

Thanks wkitty42.

I think I got it running at least partially with compositor. Although it appears to be missing effect and shader files..
Code: Select all
   23.26 [ALRT]:input      can't find "Compositor/Effects/reflect.eff"
   23.26 [ALRT]:input      can't find base effect Effects/reflect
   23.26 [ALRT]:input      can't find base effect Aircraft/Generic/Effects/Fuselagereflect
   23.26 [ALRT]:input      can't find "Compositor/Effects/reflect.eff"
   23.26 [ALRT]:input      can't find base effect Effects/reflect
   23.26 [ALRT]:input      can't find base effect Aircraft/Generic/Effects/Fuselagereflect

   43.06 [ALRT]:input      Error building technique: couldn't find shader Compositor/Shaders/ubershader.vert
   43.06 [ALRT]:io         Could not find at least one of the following objects for animation: 'LOD_bare'
   43.49 [ALRT]:input      Could not locate shaderCompositor/Shaders/ubershader.vert


And if I try to use the --compositor=Compositor/ALS/als switch I lose the transparency on the trees and grass.
Also get these additional error messages
Code: Select all
    2.89 [WARN]:input      ScenePassBuilder::build: Could not find shadow pass named 'csm0'
    2.89 [WARN]:input      ScenePassBuilder::build: Could not find shadow pass named 'csm1'
    2.89 [WARN]:input      ScenePassBuilder::build: Could not find shadow pass named 'csm2'
    2.89 [WARN]:input      ScenePassBuilder::build: Could not find shadow pass named 'csm3'


Any idea what's wrong with the installation?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby Necolatis » Fri Nov 29, 2019 6:52 am

Try start with these also:
--prop:bool:/sim/rendering/als/shadows/enabled=true
--prop:int:/sim/rendering/als/shadows/sun-atlas-size=2048

And if the aircraft has custom effects with techniques then find the paths to the frag and vert files, and update them; for example look at this diff:
- <vertex-shader>Shaders/light-ALS.vert</vertex-shader>
- <fragment-shader>Shaders/light-ALS.frag</fragment-shader>
- <fragment-shader>Shaders/noise.frag</fragment-shader>
- <fragment-shader>Shaders/hazes.frag</fragment-shader>
+ <vertex-shader>Shaders/ALS/light.vert</vertex-shader>
+ <fragment-shader>Shaders/ALS/light.frag</fragment-shader>
+ <fragment-shader>Shaders/ALS/noise.frag</fragment-shader>
+ <fragment-shader>Shaders/ALS/hazes.frag</fragment-shader>

If the path has Shaders/ infront then if will look in Compositor/Shaders, if it has Aircraft/ infront then it will look in your aircraft installation.

Same when you refer to local effects, dont just inherit from Effect/myLocalEffect (cause then it will look in Compositor/Effect/myLocalEffect), but be sure to add Aircraft/ and path from there in front.

Also in local effects that has technique, be sure to add <scheme>als-lighting</scheme> to the ALS technique.


There is also a couple of lines that has to be inserted if you have local frag/vert files in your aircraft and you want them to render shadows:

in the params of effect add:
+ <!-- BEGIN shadows include -->
+ <shadows_enabled>
+ <use>/sim/rendering/als/shadows/enabled</use>
+ </shadows_enabled>
+ <sun_atlas_size>
+ <use>/sim/rendering/als/shadows/sun-atlas-size</use>
+ </sun_atlas_size>
+ <!-- END shadows include -->

In the ALS technique program add (correct the numbering):
+ <vertex-shader n="1">Compositor/Shaders/ALS/shadows-include.vert</vertex-shader>
+ <fragment-shader n="3">Compositor/Shaders/ALS/shadows-include.frag</fragment-shader>

In the pass of same:
+ <!-- BEGIN shadows include -->
+ <uniform>
+ <name>shadow_tex</name>
+ <type>sampler-2d</type>
+ <value type="int">10</value>
+ </uniform>
+ <uniform>
+ <name>shadows_enabled</name>
+ <type>bool</type>
+ <value>
+ <use>shadows_enabled</use>
+ </value>
+ </uniform>
+ <uniform>
+ <name>sun_atlas_size</name>
+ <type>int</type>
+ <value>
+ <use>sun_atlas_size</use>
+ </value>
+ </uniform>
+ <!-- END shadows include -->

In the ALS vertice shader:
+void setupShadows(vec4 eyeSpacePos);//Compositor
...
+ setupShadows(gl_ModelViewMatrix * gl_Vertex);//Compositor

In the ALS frag shader:
+float getShadowing();
and add '* getShadowing()' to all the diffuse and specular light.

PS. There is more to add if you want spot/point lights also.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2118
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: The Compositor

Postby Necolatis » Fri Nov 29, 2019 6:54 am

But I recommend just to test it works, to startup with those 2 extra command-lines and try an aircraft that does not have custom shaders. Then it should work out of the box if your fgdata is recent enough.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2118
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: The Compositor

Postby enrogue » Fri Nov 29, 2019 9:08 am

for the d&c script under linux - if you have a recent version, you can do

Code: Select all
FG_CMAKEARGS='-DENABLE_COMPOSITOR=ON' ../download_and_compile.sh
User avatar
enrogue
 
Posts: 269
Joined: Mon May 19, 2014 6:40 pm
Location: London (UK)
Callsign: enrogue
OS: Ubuntu, macOS

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 6:21 pm

Ah, I get it, thanks Necolatis.

OK, definitely working, nice detailed exterior shadow. Indecently, that just works, no other configuration required. I guess I didn't understand that many of the effect definitions are being ported to work mostly as is?
Image



The "Could not find shadow pass named" 'csm0' errors are gone. But I still have issues with tree transparency? I don't really see anything in the logs that hint to the cause. I do have tree shadows on. ALS on or off in "Rendering" GUI makes no difference.

I haven't corrected ubershader or reflect.eff yet but I doubt they have anything ot do with the tree transparency?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby Necolatis » Fri Nov 29, 2019 6:26 pm

Tree transparency works for me. However there is an issue with seeing them at distance (z-fighting).
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2118
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 6:28 pm

Indecently, that just works, no other configuration required.


I didn't even notice until I watched the video back that the AI and buildings all have shadows. Is the old ALS tree shadow stuff the issue with the trees? Needs to be removed?
Last edited by wlbragg on Fri Nov 29, 2019 6:40 pm, 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: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby Necolatis » Fri Nov 29, 2019 6:36 pm

perhaps, I dont run with vegetation shadows.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2118
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: The Compositor

Postby Icecode GL » Fri Nov 29, 2019 8:15 pm

Transparency on trees require MSAA (anti-aliasing). Looks like your hardware/system doesn't support it.
Icecode GL
 
Posts: 633
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Fedora

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 8:53 pm

Transparency on trees require MSAA (anti-aliasing). Looks like your hardware/system doesn't support it.

Still a little confused, It did until I activated the compositor, what changed that isn't supported? My hardware didn't change?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 8:54 pm

Not to mention it works if I use the "simple" pipeline. It only breaks using the ALS pipeline?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 9:05 pm

Don't think it has anything to do with the ALS tree shadows as that still can be turned off in the Rendering GUI which is apparently what @Necolatis is doing?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 9:27 pm

Can you even get exterior shadows with the default rendering pipeline (simple)? I only get them using ALS pipe and then I lose transparency on trees.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5777
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: The Compositor

Postby wlbragg » Fri Nov 29, 2019 9:52 pm

@Icecode GL the card indicated in my sig is no longer valid. I am running an AMD RX480.

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

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest