Board index FlightGear Development Effects and shaders

Porting effects to FG 2016.2.1

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

Porting effects to FG 2016.2.1

Postby haviojet » Tue Jun 14, 2016 11:43 am

Hi there,

I am not able to run our own shader in FG 2016 2.1, although it works in FG 3.0.

I copied the technique into skydome.eff (I created a new effect file, but it didn't work), such as:

Code: Select all
<technique n="6">
    <predicate>
       <property>/my_boolean_property</property>
    </predicate>
    <pass>
      <program>
        <vertex-shader>Shaders/fullscreen.vert</vertex-shader>
        <fragment-shader>Shaders/my_code.frag</fragment-shader>
      </program>
    </pass>
  </technique>


my_code.frag just set a RGB vector to gl_FragColor like the "Fragment Shader " example in http://www.clockworkcoders.com/oglsl/tutorial1.htm. The same code works in FG3.0.

my_boolean_property changes according to some conditions. In fact, I see how my_boolean_property is set to true/false (according the conditions) when I run FG 2016 2.1. Therefore, the predicate is true. This property is initialized in preferences.xml.

I read the documentation, but I cannot find how to fix the issue.

Thanks in advance.
haviojet
 
Posts: 5
Joined: Tue Jun 14, 2016 10:33 am

Re: Porting effects to FG 2016.2.1

Postby Thorsten » Tue Jun 14, 2016 12:24 pm

What exactly does it do? Does it generate an error and refuse to compile, do you just not see any output? If you insert this into the skydome, how does the sky look like when your predicate gets true?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Porting effects to FG 2016.2.1

Postby haviojet » Tue Jun 14, 2016 3:28 pm

Hi Thorsten,

I didn't see the expected output. I have changed from fullscreen.vert to default.vert (and skydom-ALS.vert) and now I see how the sky turns to black. However, what I expect is that all of visible elements (terrain, clouds, etc.) turn to black (using fullscreen.vert). Perhaps skydome.eff is not the right place. Do you know how can I get this? Shall I copy the same technique to each eff file?

thanks
haviojet
 
Posts: 5
Joined: Tue Jun 14, 2016 10:33 am

Re: Porting effects to FG 2016.2.1

Postby Thorsten » Tue Jun 14, 2016 4:16 pm

Each element in the scene has an effect associated - partially that's done by the C++ code, partially specified in 3d model *.xml wrappers.

If you want to run the same shader for every scene element, you indeed have to insert it into pretty much every effect (well, you can cover lots by inserting a low technique into model-default.eff and terrain-default.eff as they are checked first).

But that has never been different - so that's not something that changed from FG 3.0 to now, just inserting a technique into the skydome should never have worked.

I don't know what your specific background knowledge is, and I don't know what you're trying to achieve, so it's a bit difficult to give good advice, sorry.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Porting effects to FG 2016.2.1

Postby haviojet » Wed Jun 15, 2016 8:51 am

What I pretend is creating a "black filter" (it simulates the sensor output when is off) and a "black and white filter" (when sensor is recording). I was wrong when I said it was working in FG3.0. It was working in rembrandt (extending the display effect), and now I would like to do the same for ALS.
haviojet
 
Posts: 5
Joined: Tue Jun 14, 2016 10:33 am

Re: Porting effects to FG 2016.2.1

Postby Thorsten » Wed Jun 15, 2016 9:44 am

Try inserting your code into Shaders/filters-ALS.frag - that's what it's for.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Porting effects to FG 2016.2.1

Postby haviojet » Thu Jun 16, 2016 8:04 am

Hi Thorsten, thanks for your suggestion.

I have modified the filters-ALS.frag in order to create the "black" and "B&W" filters, like the IR filter does. The problem is, I am not able to apply the filters to some clouds, the sun, stars, etc. (even IR filter has the same issue).

I wonder if it is possible to change the FG rendering pipelines to allow global filters, instead of applying the filter element to element.
haviojet
 
Posts: 5
Joined: Tue Jun 14, 2016 10:33 am

Re: Porting effects to FG 2016.2.1

Postby Thorsten » Thu Jun 16, 2016 10:21 am

The issue is that 2d clouds, the sun or the stars never enter the effect framework, so it's impossible to assign anything to them.

I wonder if it is possible to change the FG rendering pipelines to allow global filters, instead of applying the filter element to element.


Much is possible, you just need to do it (and the performance cost needs to be paid). It's part of the difference between deferred renderers and forward renderers like ALS.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Porting effects to FG 2016.2.1

Postby haviojet » Fri Jun 24, 2016 8:09 am

Thanks for your help Thorsten. We have created a workaround and we will try to implement a global filter in the future.
haviojet
 
Posts: 5
Joined: Tue Jun 14, 2016 10:33 am


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests