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 wkitty42 » Sat Feb 10, 2018 1:51 am

vnts wrote in Fri Feb 09, 2018 11:42 pm:People that notice volcano entry in menu can't know which volcanoes are simulated yet without searching for thread (or release changelog I guess)?

as i recall, the conversation about this was along the lines of "you need to be within X range of volcano to see it. at that time it will appear in the menu."... i took the easy way out and visited each of them to turn them on and leave them on... i kinda agree with you and maybe they should be listed whether you are in range or not but i understand the desire to not waste CPU cycles on them if they are not in visible range... but you may have given me something to look at for some FPS loss i've seen recently...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4634
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

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

Postby Thorsten » Sat Feb 10, 2018 7:43 am

1. Clouds & (non)occlusion of plume(z-order?).


The particle system FG is using, sorry, sucks... it doesn't play nice with the effect and shader framework, yet there doesn't seem to be an easy way to replace it. This z-ordering mismatch happens for basically all particle systems (SRB exhaust of the Shuttle has the same problem with clouds).

2. Vegetation: translucency (Hawaii). Couldn't decide if it's intentional (to help blend in). Posting just in case.


Intentional - making the vegetation 100% solid looks very odd - in reality you can see a bit through foliage, and while not perfect, alpha-to-coverage generally is preferable over the alternative.

3. Aerosol: volcanic plume/condensation in vortices etc/smoke: don't normally take colour of sunlight after outscattering like clouds do in FG eg, eg? screen. Also randomly wondered if ALS lightsource @ ejected lava center of mass would work.


As long as ash plumes work with the particle system, we can't run custom shaders on the result like for clouds.

4. Volcano:disabling by UI toggle doesn't switch off. Plume particles messed by time accel(Just something I noticed). Test: Kiluaea, max activity. People that notice volcano entry in menu can't know which volcanoes are simulated yet without searching for thread (or release changelog I guess)?


I think the general UI toggle prevents new volcanoes from ever entering the menu, but an active volcano needs to be switched off in its own menu. The logic is a bit... odd, but then there was the requirement on the devel list to be scalable to a few hundred volcanoes, so for the three that are implemented, this seems weird.

I guess we'll just keep adding some and maintain a wiki page, eventually it'll make more sense. I hope.
Thorsten
 
Posts: 9744
Joined: Mon Nov 02, 2009 8:33 am

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

Postby wkitty42 » Sat Feb 10, 2018 10:49 am

Thorsten wrote in Sat Feb 10, 2018 7:43 am:I think the general UI toggle prevents new volcanoes from ever entering the menu, but an active volcano needs to be switched off in its own menu. The logic is a bit... odd, but then there was the requirement on the devel list to be scalable to a few hundred volcanoes, so for the three that are implemented, this seems weird.

three? i thought it was four, now... but maybe the one in hawaii that i'm thinking of is one volcano with two outlets decently far apart?

anyway, i agree that the logic is strange... i'm sitting at LICC at 20000 feet and have the F10->Environment->Volcanoes dialog open... in that dialog, i have "enable volcanic activity" unchecked but i still see Etna erupting... seems like a check in the code is missing... if this box is unchecked, all volcanic activity should be off... that's been my understanding since volcanic activity was introduced... if that check box isn't a master control for volcanic activity, then i see no need for it at all...

[time passes]

i checked my archives and found the original post about the volcano activity switch... it seems to say that that check box is a master switch and there should be no volcanic activity at all if the box is unchecked...

Thorsten Renk on developers' mailing list wrote:I think I've now made a set of design decisions which hopefully will make everyone happy:

* volcanoes are managed neither by the AI system nor the scenemodels but a new Nasal volcano manager

* the manager is an opt-in system that needs to be activated to run

* what it does is maintain a list of how distant to the plane implemented volcanoes are. Based on that list, it switches any particular volcano model on if the volcano is closer than 150 km and in visible range (whatever happens first). The advantage is that models (and particle systems) loaded that way are visible from afar, which is somewhat important for lava fountains a few hundred meters high or ash plumes.

* any implemented volcano has the option to utilize its own Nasal code that is loaded 'on demand' along with the 3d model (for instance, to time and regulate eruption plumes) - most of the volcano code will therefore be neither run nor loaded during a normal FG session

* what it will do in the future is talk to the weather system to render the ash clouds downwind - I'll probably have to extend the precipitation code to simulate ash fall - in any case the weather system will provide the property in case anyone is interested in simulating engine damage


bold highlight mine... that's what seems to say to me that the check box is the master switch... if it is checked, the volcano system is on otherwise it is completely off...

[more time passes]

i'm now at ~6500 feet ASL over LICC... i can actually see both Etna and Stromboli erupting in the distance... Stromboli is on true heading 5 degrees from LICC... it is waaaaayyy out there... almost barely visible unless you know where to look (just under the right hand zero of the climb angle meter in the center of the screen)... Etna is true heading 349-350 degrees... easier to see with its big cloud spreading out over the top of everything else...

and yes, i still have the check box unchecked...

Image
Image
Image
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4634
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

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

Postby Thorsten » Sat Feb 10, 2018 3:06 pm

but maybe the one in hawaii that i'm thinking of is one volcano with two outlets decently far apart?


Yes, it's the same volcano with two different magma chambers and craters.

* the manager is an opt-in system that needs to be activated to run


I believe that's pretty much the case - if you don't check the switch, the GUI will never search for volcanoes and not offer you the controls - since they default to inactive, they're never loaded.

Once you set the activity of individual volcanoes, the control scripts of the volcanoes will run. So if you switch the GUI volcano management off, you still have the activity continuing to drive the volcano.

It's an opt-in but not an all-off now - but if you select it off, it should be session persistent and the manager won't look for volcanoes any more to load them. See it as a config setting between settings, that's what it is intended to be.
Thorsten
 
Posts: 9744
Joined: Mon Nov 02, 2009 8:33 am

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

Postby wkitty42 » Sun Feb 11, 2018 12:48 pm

Thorsten wrote in Sat Feb 10, 2018 3:06 pm:It's an opt-in but not an all-off now - but if you select it off, it should be session persistent and the manager won't look for volcanoes any more to load them. See it as a config setting between settings, that's what it is intended to be.

oh, ok... so leaving it unchecked only stops it from looking for newly added volcanoes... volcanoes already detected and configured will be doing their thing regardless of that check box switch... i got it, now... i did think it was an on/off switch for the whole volcano thing...

it might be a good idea to have one of those master on/off switches so one doesn't have to go hunting all over the place to be able to access volcanoes and turn them off in case there's a problem (eg: FPS loss)...

Code: Select all
_X_ find new volcanoes          ( <-- existing check box )
_X_ enable volcanic eruptions   ( <-- new proposed master switch )

_____ list of close volcanoes goes here _____

     [OK]                         [BACK]
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4634
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

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

Postby Thorsten » Sun Feb 11, 2018 6:08 pm

it might be a good idea to have one of those master on/off switches


Unless you leave FG always on, they will be gone in the next session regardless of their setting, because if the master script no longer runs, the individual management scripts won't even be loaded.

Neither will volcanoes ever be loaded (regardless of their settings) if you're not reasonably close to them.

So this actually does what you need, it just doesn't do it *right now* for all visible volcanoes (it could be done, but the code would be somewhat less lean, and I frankly don't see the use case why you'd need an 'all off right now' switch)
Thorsten
 
Posts: 9744
Joined: Mon Nov 02, 2009 8:33 am

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

Postby wkitty42 » Sun Feb 11, 2018 6:29 pm

i do have FG running all the time... seriously!

the need for "all off right now" would be for debugging FPS loss ;)

in cases where FPS are low and one is in a volcanic area, turning off all the volcanoes may give one back some FPS so they might at least be able to fly... 3 and 4 FPS is not fun... i had to turn off the animated jetways because of FPS loss... went from 3-5 FPS back up to ~10-15 FPS... sadly i don't know which commit lead to that FPS loss among the various ones cleaning up this and that... what was once a 10-25 or so FPS sim system has been reduced to <10 FPS in many places...

i'll try doing a release build and see if it is that much different than the debug builds i normally use... no, i don't fly them in gdb that much any more and i'm also not doing debug logging that much... only when i find something and try to test it...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4634
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

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

Postby Thorsten » Sun Feb 11, 2018 6:46 pm

in cases where FPS are low and one is in a volcanic area, turning off all the volcanoes may give one back some FPS so they might at least be able to fly..


The situation that you

* never re-start FG
* have low FPS
* decide to turn volcano activity on anyway
* leave them on after seeing the fps impact
* but discover later you need all off
* and dialing activity down individually is not an option

seems a tad constructed to me :D But yes, if that is absolutely what you need, the current GUI won't do it.
Thorsten
 
Posts: 9744
Joined: Mon Nov 02, 2009 8:33 am

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

Postby wkitty42 » Sun Feb 11, 2018 10:05 pm

ummm... you've reconstructed my statements a "tad" ;)

  • i never said FG is never restarted.
  • i haven't always had low FPS. only at certain times in certain situations. when we upgraded to the current video card about a year or so back, we went from ~10FPS to ~30FPS. since then, only the sources to and scenery options for FG have changed. we still run the AI like we have always done. we don't run the animated jetways any more because we found they were chewing up FPS. at least, when we disabled them, we gained FPS which made things nicer again.
  • i didn't have low FPS when the volcanoes were introduced.
  • i didn't have low FPS after enabling the volcanoes.
  • i wanted to turn them off *easily* to /test/ if they were contributing to the low FPS that has appeared in the *last several weeks*. "easily" as in uncheck the box and they stop immediately... check the box and they start immediately... this so we can look at the FPS and see if it changes.
  • dialing the volcano's activity down cannot be done without visiting the neighborhood of each volcano so that it appears in the selection box. i understand why this is and don't want to see that changed. especially if hundreds or thousands of active volcanoes are added.

yes, i/we know that the current GUI won't do it, that's why we asked what we did ;)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4634
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

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

Postby Thorsten » Mon Feb 12, 2018 6:27 am

i never said FG is never restarted.


But then, what is the problem Unless you leave FG always on, they will be gone in the next session . You uncheck the box, next restart will have no active volcanoes?

dialing the volcano's activity down cannot be done without visiting the neighborhood of each volcano


Yes - because the activity is zero (aka the volcano script isn't loaded and doesn't run) by construction if you're not in the neighbourhood. So there's no need to change the activity of volcanoes not in range, they won't affect your framerate - but you can change those that can affect you.

(I deal with people who are paranoid about even loading additional Nasal code into memory - so the whole thing is extremely low-key unless you opt in - and then it loads only what it needs when it needs).

this so we can look at the FPS and see if it changes.


So you open all the dialogs (the whopping number of 2) if you're near Etna and Stromboli, watch framerate and move a few sliders - granted, it's going to take you 15 seconds instead of just 2 seconds, but since it's not a task you perform regularly, I suspect it's doable...)

Sorry, I'm just not getting what makes your use case so special...
Thorsten
 
Posts: 9744
Joined: Mon Nov 02, 2009 8:33 am

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

Postby wkitty42 » Mon Feb 12, 2018 1:11 pm

Thorsten wrote in Mon Feb 12, 2018 6:27 am:
i never said FG is never restarted.


But then, what is the problem Unless you leave FG always on, they will be gone in the next session . You uncheck the box, next restart will have no active volcanoes?

restarting affects too many other things that could be contributing to, in this case, FPS loss... restarting is not an effective troubleshooting method... this ain't m$ winwhatever, ya know? :mrgreen:

Thorsten wrote in Mon Feb 12, 2018 6:27 am:
dialing the volcano's activity down cannot be done without visiting the neighborhood of each volcano


Yes - because the activity is zero (aka the volcano script isn't loaded and doesn't run) by construction if you're not in the neighbourhood. So there's no need to change the activity of volcanoes not in range, they won't affect your framerate - but you can change those that can affect you.

ahhhh... a tidbit of information (they're not running when they're not in range) that was overlooked...

Thorsten wrote in Mon Feb 12, 2018 6:27 am:(I deal with people who are paranoid about even loading additional Nasal code into memory - so the whole thing is extremely low-key unless you opt in - and then it loads only what it needs when it needs).

:thumbsup: if they only knew, eh?
/me looks at his 372M FGFS release build binary and shakes his head...
Code: Select all
 -rwxr-xr-x 1 myuser mygroup 7.1M Feb 11 19:17 fgcom
 -rwxr-xr-x 1 myuser mygroup  64M Feb 11 19:17 fgelev
>-rwxr-xr-x 1 myuser mygroup 372M Feb 11 19:17 fgfs
 -rwxr-xr-x 1 myuser mygroup 4.9M Feb 11 19:17 fgjs
 -rwxr-xr-x 1 myuser mygroup 9.8M Feb 11 19:17 fgpanel
 -rwxr-xr-x 1 myuser mygroup  29K Feb 11 19:11 fgtraffic
 -rwxr-xr-x 1 myuser mygroup  67M Feb 11 19:17 fgviewer
 -rwxr-xr-x 1 myuser mygroup 2.2M Feb 11 19:17 GPSsmooth
 -rwxr-xr-x 1 myuser mygroup  32M Feb 11 19:17 JSBSim
 -rwxr-xr-x 1 myuser mygroup  45K Feb 11 19:17 js_demo
 -rwxr-xr-x 1 myuser mygroup 6.4M Feb 11 19:17 metar
 -rwxr-xr-x 1 myuser mygroup 2.6M Feb 11 19:17 MIDGsmooth
 -rwxr-xr-x 1 myuser mygroup 3.2M Feb 11 19:17 UGsmooth
 -rwxr-xr-x 1 myuser mygroup 7.6M Feb 11 19:17 yasim
 -rwxr-xr-x 1 myuser mygroup 7.5M Feb 11 19:17 yasim-proptest


Thorsten wrote in Mon Feb 12, 2018 6:27 am:
this so we can look at the FPS and see if it changes.


So you open all the dialogs (the whopping number of 2) if you're near Etna and Stromboli, watch framerate and move a few sliders - granted, it's going to take you 15 seconds instead of just 2 seconds, but since it's not a task you perform regularly, I suspect it's doable...)

it takes more than just those few movements... you probably forgot that all those particles have to go away, too... yes, i do see the frame rate climb as they diminish...

Thorsten wrote in Mon Feb 12, 2018 6:27 am:Sorry, I'm just not getting what makes your use case so special...

i'm not asking for anything... i pointed out a tricky UI area that could use some reworking... it was a suggestion, that's all... the FPS loss hunt was an example of why having full on/off switches is a good thing... don't worry about it, though... it seems that something else is going on since a native debug build on my system running outside of gdb averages 5-10 FPS but the same code compiled as a release build results in 25-70 FPS... a debug build shouldn't result in that much of a FPS loss... it didn't in the recent past... oh well :shrug:
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4634
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

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

Postby vnts » Thu Apr 12, 2018 2:01 am

Misc typo-bug in Grass.geom: int numLayers = MIN_LAYERS + int(smoothstep(500.0, 50.0, minDistance)..
Should be 50.0, 500.0. Fine in terrain-overlay version. Does mean LoD is inactive.

Edit: By this I mean smoothstep isn't defined when 1st edge > 2nd edge. Testing, it seems NVIDIA at least work both ways in which case, if this is reliable, maybe the terrain-overlay version has an unnecessary OP: (1 - smoothstep()..)

Came across it as I wanted to randomly experiment if outputting a single primitive (tri strip instead of triangles) made a difference. Saw some claims earlier when I was seeing what made GS fast that it helped on much, much older hardware. Possibly older than minimum target for running grass shader. Idea was to discard the two extra tris per layer in the fragment shader (but that required an extra variable..). Just moving EndPrimitive to end of the loop creates a valid strip. Couldn't really tell a difference on current gen hardware & bottle neck was likely elsewhere anyway.

Icecode GL wrote in Tue Sep 12, 2017 5:48 pm:
This will almost certainly make performance worse - the crucial question is by how much?

Not by much, but we are gonna be passing another variable to the fragment shader. You remember that we tried to send as few variables as possible to the fragment shader to have more layers available. I can't try the code right now to see how much of a reduction we're talking about, but I suppose it won't be critical. In my opinion we should just change it to varying float and save ourselves the headaches.

To save on varyings it's probably(?) possible to combine g_layer & g_distance_to_eye. Saves interpolation at the cost of a bit of extra math, if the tradeoff is worth it. g_layer remains constant across triangle, is bounded, & has discrete values. g_dist has a maximum useful value before being discarded in the fragment shader. Combined value = floor(g_layer*1000.0)+ min(g_dist, maxdist) / some large number e.g. max dist*something ? Just off the top of my head. Integer and fractional parts can be split in the frag shader.

Kind regards,
vnts
vnts
 
Posts: 60
Joined: Thu Apr 02, 2015 12:29 am

Previous

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest