Board index FlightGear Development Effects and shaders

Volumetric grass (was 3D textures and volumetric data)

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

Re: Volumetric grass (was 3D textures and volumetric data)

Postby wlbragg » Thu Jun 29, 2017 7:58 pm

Here are a couple more with a bit more control. One over green grass and the other over water. Expect a Bambi-bucket in the not to distant future.



Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3979
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Volumetric grass (was 3D textures and volumetric data)

Postby wlbragg » Fri Jun 30, 2017 9:03 am

One more video combining the particle and shader effects. You may want to turn the sound down, the audio apparently had a problem during recording. Only problem is, now I don't want to fly higher than a few feet AGL so I can admire the effects. So cool!

Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3979
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Thu Jul 06, 2017 7:30 am

Since everyone seems to be happy with the rotor wash interface, I propose we fix it and I add it to the documentation. Anyone who disagrees, please speak now.
Thorsten
 
Posts: 9529
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby wlbragg » Thu Jul 06, 2017 8:38 am

I'm not the best person technically speaking to have an opinion on it, but I am certainly happy with it. It is so simple to implement and has enough parameters to make it plenty versatile.

I was thinking though about the possibility of adding prop wash on the horizontal plane for standard aircraft using grass runways. I imagine that would be not difficult to add?
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3979
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Thu Jul 06, 2017 9:08 am

I was thinking though about the possibility of adding prop wash on the horizontal plane for standard aircraft using grass runways. I imagine that would be not difficult to add?


Not impossible, but generally more tricky unfortunately.
Thorsten
 
Posts: 9529
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby bugman » Thu Jul 06, 2017 9:18 am

wlbragg wrote in Thu Jul 06, 2017 8:38 am:...adding prop wash on the horizontal plane for standard aircraft using grass runways...


That would work for jet engines and the grass around a non-grass runway as well ;)

Regards,
Edward
bugman
Moderator
 
Posts: 1524
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Fri Jul 07, 2017 5:56 am

Just... be careful - you're asking relatively expensive things on top of what probably is the most expensive effect already. A top-end GPU has performance to spare with this, but has yours?
Thorsten
 
Posts: 9529
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby wlbragg » Fri Jul 07, 2017 9:42 am

Buzz kill! :lol:

Not a big deal, but if it is easy enough to explain, how come it is more difficult to create than the down wash and why is it more expensive, or are you talking cumulatively? I just figured it would be no more or less expensive than the rotor wash by itself.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3979
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Fri Jul 07, 2017 11:59 am

It's the degree of symmetry that can be used (or not).

For the downwash you need a position, because the shader knows 'up', so you can build a windfield based on position and strength.

For prop/jet wash you need in addition to a position and a strength a direction and a lateral size of the wind region - and if you think of a 747, some people are probably going to ask to quadruple the wind generating points,... there you go....
Thorsten
 
Posts: 9529
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Richard » Sun Sep 10, 2017 6:32 pm

With my R9-290 I get the follow error (recent fgdata).

FRAGMENT glCompileShader "e:/temp/fgdata/Shaders/grass-ALS.frag" FAILED

FRAGMENT Shader "e:/temp/fgdata/Shaders/grass-ALS.frag" infolog:
Fragment shader failed to compile with the following errors:
ERROR: 0:32: error(#133) Reserved word: in
ERROR: 0:32: error(#138) "varying in" supported in geometry shaders only
ERROR: 0:33: error(#133) Reserved word: in
ERROR: 0:33: error(#138) "varying in" supported in geometry shaders only
ERROR: 0:34: error(#133) Reserved word: in
ERROR: 0:35: error(#133) Reserved word: in

It doesn't like the following

flat in float g_layer; // The layer where the fragment lives (0-1 range)
flat in int g_num_layers;

With the "in" it complains like this;

FRAGMENT glCompileShader "e:/temp/fgdata/Shaders/grass-ALS.frag" FAILED

FRAGMENT Shader "e:/temp/fgdata/Shaders/grass-ALS.frag" infolog:
Fragment shader failed to compile with the following errors:
ERROR: 0:34: error(#133) Reserved word: in
ERROR: 0:35: error(#133) Reserved word: in
ERROR: error(#273) 2 compilation errors. No code generated


Without it it complains like this:

FRAGMENT glCompileShader "e:/temp/fgdata/Shaders/grass-ALS.frag" FAILED

FRAGMENT Shader "e:/temp/fgdata/Shaders/grass-ALS.frag" infolog:
Fragment shader failed to compile with the following errors:
ERROR: 0:34: error(#393) Qualifier "flat" requires qualifier "in/out"
ERROR: 0:35: error(#393) Qualifier "flat" requires qualifier "in/out"
ERROR: error(#273) 2 compilation errors. No code generated



After some experimentation the following appears to work. I get an error
on the int if I omit flat.

varying vec2 g_rawpos; // Horizontal position in model space
varying float g_distance_to_eye; // Distance to the camera. Layers were disregarded
varying float g_layer; // The layer where the fragment lives (0-1 range)
varying flat int g_num_layers;

Note sure if it is working correctly though. It seems to bleed through
onto the hud glass effect; ima

Image
Last edited by Richard on Mon Sep 11, 2017 9:27 am, edited 1 time in total.
Richard
 
Posts: 591
Joined: Sun Nov 02, 2014 10:17 pm
Version: Git
OS: Win10

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Sun Sep 10, 2017 7:45 pm

By default, values from the vertex/geometry shader are interpolated for every fragment. When a variable is set as flat, it'll be constant for every fragment in a triangle. This qualifier is a feature introduced in OpenGL 3, so your driver is probably picky about the #version 120 at the beginning of the file. The only fix is to remove the flat keyword and pass the interpolated value every time for every fragment, which might compromise performance and the amount of layers that can be done in the geometry shader. Thorsten should decide if it's worth to change it or not.
Icecode GL
 
Posts: 432
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Mon Sep 11, 2017 5:05 am

Actually, the situation seems to be that Richard gets it to work with flat qualifier (that's the only one he can't omit) - it's just that the varying in in the fragment shader have to be replaced by varying?

Because the code as quoted above does work for Richard (?)

I've made a short test whether I can omit them late yesterday, and that seems to be working okay with the NVIDIA driver (I like that driver - always tries to be helpful...)
Thorsten
 
Posts: 9529
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Mon Sep 11, 2017 12:08 pm

As far as I know integers can't be varyings. In fact, I just tried to do that and I get
Code: Select all
0(27) : error C7514: OpenGL does not allow varying of type int
Icecode GL
 
Posts: 432
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Thorsten » Mon Sep 11, 2017 12:11 pm

Hm, no, and integer wouldn't make sense as a varying... EmilianH claimed on the mailing list flat in could be changed to uniform - can a geometry shader set uniforms?? Otherwise the suggestion makes no sense to me.
Thorsten
 
Posts: 9529
Joined: Mon Nov 02, 2009 8:33 am

Re: Volumetric grass (was 3D textures and volumetric data)

Postby Icecode GL » Mon Sep 11, 2017 12:14 pm

can a geometry shader set uniforms??


Well, uniforms are set outside the shader pipeline by definition, so no. I think that what he means is that since the value is constant you should be able to set it as an uniform outside the shader. The problem is that the value is constant for each triangle, not for every triangle. The number of layers for each triangle is calculated at the geometry shader as part of the LOD.


The only true solutions are to remove the flats and replace the integers by floats or set the #version to 130 instead of 120, but that would require some refactoring for the rest of the shader.
Icecode GL
 
Posts: 432
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest