Board index FlightGear Development Effects and shaders

Overlay layer rendering

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

Overlay layer rendering

Postby Thorsten » Wed Sep 06, 2017 2:26 pm

Since integrating the grass shader, I've been thinking that a geometry shader extruding a couple of shells ought to be good for a lot of things - finally I've found the time to tinker with this.

Small-sized volumetric vegetation layer extruded between the trees - seeing this for the first time, I immediately realized what we've been missing forever - it looks much more real than just trees and bare terrain underneath.

Image

But it can do much more - extruding some micro-structured rocky surface from the ground:

Image

Might be a while till this is good to go, I still need to take care of pesky issues like lighting and fogging, but expect it for for the 2017.4 release.

Credit for coming up with the underlying technique goes to IcecodeGL of course!
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby wlbragg » Wed Sep 06, 2017 3:05 pm

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

Re: Overlay layer rendering

Postby icecode » Wed Sep 06, 2017 3:29 pm

That looks really, really good! The forest looks a lot more populated now.
icecode
 
Posts: 709
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: Overlay layer rendering

Postby Necolatis » Wed Sep 06, 2017 3:34 pm

Looks fantastic. Do you know if it will be lighter on the GPU than grass?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Overlay layer rendering

Postby Thorsten » Wed Sep 06, 2017 5:08 pm

Do you know if it will be lighter on the GPU than grass?


That is a joke, right?

I hope it is...

:mrgreen:

(It would depend on what your bottleneck is - there is a geometry shader involved, but I'm trying to cut down the number of layers that are extruded to about a quarter of what grass needs - so the fragment shader load gets lights - but at the same time this is rendered quite a bit farther out, which means we can't cheat so easily on fogging and lighting,... I think the bottom line is, I have no idea, but it's not going to be cheap).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby Thorsten » Thu Sep 07, 2017 6:28 pm

I've done some life case performance testing of this today. The good news is - I can't really measure the impact against all the other settings maxed out. The bad news - that's on a GeForce 1080.

So it'll do find on a high-end graphics card - on others it'll probably be like the grass (I've figured out the hard way that I need to attach a surface normal in the geometry shader for this one... so per triangle and per fragment this is more expensive than grass, but... less layers).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby icecode » Thu Sep 07, 2017 7:01 pm

I was thinking that maybe a better alternative for your purpose is parallax mapping (basically what the urban shader is using). It's cheaper on the GPU but looks worse closer up. Sides look better though, since it doesn't rely on layers like shell texturing. It also requires some more work on the artistic side and it might be hard to integrate with noise functions since it's a purely texture based approach. Just thinking out loud.
icecode
 
Posts: 709
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: Overlay layer rendering

Postby Thorsten » Thu Sep 07, 2017 8:36 pm

We do parallax mapping to simulate terrain roughness, the urban shader is using height mapping - I've tried that for terrain as well and discarded the approach again, the pain/gain ratio wasn't good.

Basically parallax mapping can't draw really elevated stuff, height mapping tiles like mad if you use a height texture and is too slow if you do it procedurally - if you mix you get into all sorts of pain due to the normal being a vector but height being a scalar, so there's no easy way to derive modified normals,...

Should I go on?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby icecode » Thu Sep 07, 2017 8:49 pm

height mapping tiles like mad if you use a height texture and is too slow if you do it procedurally


Yeah, that's what I thought. I guess there is not much else we can do about performance then. Since the bottleneck is in the geometry shader (I think), you can also try doing a more aggressive LOD if you haven't already.

I really don't get why people get a bad performance with this shader. On my 4-5 year old machine I get solid 60fps with the grass overlay enabled and ALS at max. The effect is kind of demanding, but it's reasonable enough, i.e. you can't expect to run FG on full specs with a 7-8 year old PC.
icecode
 
Posts: 709
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: Overlay layer rendering

Postby Thorsten » Thu Sep 07, 2017 8:51 pm

It's for the higher end of the GPUs, I've accepted that, I won't needlessly waste framerate but I also won't cut on appearances and if not everyone can run it, well, it's optional. Time works for us here...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby Thorsten » Sat Sep 09, 2017 9:44 am

Hm, I just realized we can have two overlay layers for almost the price of one (and an additional texture lookup), since one can use both (noise) and (1-noise) to generate two mutually exclusive bump patterns on the same geometry.

Pretty neat... So we can have both boulders and shrubs for instance if the density isn't too high.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby Thorsten » Mon Sep 11, 2017 9:49 am

... and the layer info can be used very nicely to let the whole thing vanish in snow... so this is gonna be good...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Overlay layer rendering

Postby icecode » Mon Sep 11, 2017 1:10 pm

Looking forward to the results! Sounds really nice.
icecode
 
Posts: 709
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: Overlay layer rendering

Postby Thorsten » Sun Feb 04, 2018 8:42 am

In time for the release, I've now documented the configuration of this effect (which is currently available for Hawaii, Scandinavia and parts of the Mediterranean) in the wiki - so if anyone wants to use it for his own regional definitions, this is now possible.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 7 guests