Board index FlightGear Development Effects and shaders

Better smoke

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

Better smoke

Postby curt » Mon May 09, 2011 3:57 am

Image

This afternoon I took a look at the particle system configuration we use for emitting smoke trails, exhaust, and contrails from our aircraft. I had something setup for the Rascal (RC scale) aircraft that I had copied from some other aircraft a while back. The smoke config was ok, but I wasn't happy with it for several reason. I played around with quite a few of the config options to try to understand them more. My sense is that a lot of people just copy other existing configs and if we sat down and worked on this a bit more, we could really improve the smoke and contrails and exhaust in many of our aircraft. The OSG code is all there, it's just a matter of finding the right balance of parameters to make things really work.

I wrote a short "blog" entry with what I've learned so far:

http://gallinazo.flightgear.org/simulat ... ear-smoke/

Some of the highlights:

- We only want to rotate the particles in z (and not x, or y).
- I figured out the shooter phi and theta parameters and the values in the original config file I copied made absolutely no sense.
- I've always been annoyed at the lack of randomness or "swirliness" in our smoke trails. I figured out how to do that, or at least what parameters to play with and balance with each other to try to get this effect.
- particles can have mass and size and this affects how quickly they snap to the air mass speed. By increasing mass, and decreasing size, you can scatter the smoke particles a bit more to simulate how the smoke is injected into the turbulent wake of the aircraft.
- By spinning the particles *only* in the z axis, you can give them that vortex rotation effect that is so cool.

My main goals here were to get more vortex "spinning" and more variation and I think I figured out how to accomplish that. The other thing that bugs me a bit is that the smoke texture is probably a bit too dark for my tastes, so I may work on that a bit in the upcoming days.

If anyone takes this and runs with it and makes any more improvements or figures out better ways to do things, please add to the discussion here!

Thanks,

Curt.
curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN

Re: Better smoke

Postby truthsolo » Mon May 09, 2011 4:47 am

Very nice blog post explaining various aspects of the particle system in FG, curt. I have bookmarked this and will use it to tweak the wing-tip vortexes and exhaust. I was using the "hit or miss" approach before. Do you happen to know if there is a way to make a particle system move around the model? My exhaust smoke comes into the cockpit in bad weather ;)

cheers,

Rob
Rob — IRC: truthsolo — I used to run mpserver16.flightgear.org (Kansas City, MO)
Good hunting!
truthsolo
 
Posts: 234
Joined: Sat Feb 12, 2011 3:41 am
Callsign: C-FBAR, Snapper
IRC name: truthsolo
Version: git

Re: Better smoke

Postby Liam » Mon May 09, 2011 2:22 pm

Hi Curt,

Great post; I found it very useful on tweaking some properties. As you can see below I have tried to get a little more realism on the A340 model, from far away it looks very beautiful. The rotation of the billboard image especially is a great thing to note for reality. The only problem that bothers me is that from up close, where they first appear is too solid- {edit: adjusted alpha setting and looks much better- Thanks Gijs}.

From afar:
Image

From up close:
Image
Last edited by Liam on Mon May 09, 2011 2:42 pm, edited 3 times in total.
User avatar
Liam
 
Posts: 1905
Joined: Tue Dec 23, 2008 4:33 pm
Location: United Kingdom
Callsign: Liam
Version: GIT
OS: MAC OS X

Re: Better smoke

Postby Gijs » Mon May 09, 2011 2:35 pm

Nice blog Curt! The only real issue I can see at the moment is the contrast between particles. I'd say brighten both the black and grey a little for a slightly better look; but brighten the black a little more than you brighten the grey, so the contrast between the two is smaller.
Liam wrote in Mon May 09, 2011 2:22 pm:they should appear in from transparent which is something that is likely very complex to code, with using little more than one single smoke image file; and keeping the same great frame-rate.

Tried adjusting the "start alpha" setting?
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9548
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Better smoke

Postby Liam » Mon May 09, 2011 2:39 pm

Gijs wrote in Mon May 09, 2011 2:35 pm:
Liam wrote in Mon May 09, 2011 2:22 pm:they should appear in from transparent which is something that is likely very complex to code, with using little more than one single smoke image file; and keeping the same great frame-rate.

Tried adjusting the "start alpha" setting?


Ah I see, I made the value greater rather than smaller, the smaller the more transparent it is.
Much better :) Dankje
User avatar
Liam
 
Posts: 1905
Joined: Tue Dec 23, 2008 4:33 pm
Location: United Kingdom
Callsign: Liam
Version: GIT
OS: MAC OS X

Re: Better smoke

Postby Thorsten » Tue May 10, 2011 8:07 am

Image


Hm, from up close, it doesn't look too realistic, the nature of the individual puffs is too apparent. It seems like a waste of perfectly good resources to simulate a long thin structure by adding many small rotationally symmetric structures (as you get when you 3d-billboard anything) - it would seem far more efficient and better to me to simulate long thin structures by combining elementary long thin structures - kind of like making a long pipeline by individual pipe segments - you'd need a lot less of those and you wouldn't see any puffs from up close.

I believe it can be done by a combination of billboard matrix rotation, followed by coordinate scaling in two of the target axes relative to a specified third axis (which would have to be an object-specific shader parameter). I don't know how easy it would be to pass that info on a per-cloudlet basis to the shader, but if it can be done, it would solve any long thin smoke/cloud/... structure problem for good.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Better smoke

Postby Gijs » Tue May 10, 2011 9:39 am

You might be interested in http://wiki.flightgear.org/Howto:_Add_c ... _Contrails for that... (forgot to mention it in my previous post)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9548
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Better smoke

Postby Thorsten » Tue May 10, 2011 10:24 am

As far as I can see in Vivian's contrail vertex shader, he uses individual rotation of texture sheets in a stack after the sheet has been scaled to the required coordinates. The thing I'm talking about is a post-rotation scaling (like I use for layered clouds) that deformes the texture dependent on from which direction you're looking at it in a different way.

You'd no longer see circular puffs, you'd see overlapping ellipsoid/rectangular shapes when looking at the contrail from the side, but you'd see a circle when looking from behind, the same way an elementary element of one of my cloud layers looks like a square when seen from above, but like a rectangle when seen from the side.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Better smoke

Postby Liam » Wed May 11, 2011 5:21 pm

True Thorsten I have seen that before, but found it to be also very unattractive up close, the horizontal "tubelike" shapes overlapped and made even more visual abnormalities. Experimenting with the alpha at the start however solved my problems:

Image
Image
Image
As you can see from up close if anything it just looks like engine wake (although its better in sim than in that screenshot). It would be an effective way to simulate engine wake in my opinion, but on the ground at slow speeds it unfortunately accumulates if you are still, even with a short lifespan so it doesn't look too attractive. Also, my framerate is very very good and unnoticeably hit by the vapour thankfully, although I did make the cockpit only visible internally except for a lowpoly version which may be the main reason it's much faster now.
The only downside is they glow in the dark...
User avatar
Liam
 
Posts: 1905
Joined: Tue Dec 23, 2008 4:33 pm
Location: United Kingdom
Callsign: Liam
Version: GIT
OS: MAC OS X

Re: Better smoke

Postby xiii » Wed May 11, 2011 6:24 pm

hi Liam,

The transparency at beginning has a very nice effect on the contrail.
And the particles glowing at night is a very-very long standing bug (maybe older than the bugtracker). I just hope someone will jump on it.

Alexis
If the engines are Pratt and Whitney, the seats best be Martin Baker
xiii
 
Posts: 472
Joined: Tue Jan 08, 2008 11:04 pm

Re: Better smoke

Postby ot-666 » Wed May 11, 2011 11:11 pm

xiii wrote in Wed May 11, 2011 6:24 pm:The transparency at beginning has a very nice effect on the contrail.
And the particles glowing at night is a very-very long standing bug (maybe older than the bugtracker). I just hope someone will jump on it.


The particles work but in liams contrail-eng1.xml he uses:

Code: Select all
 
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>


if you use the code below instead... it will work.

Code: Select all
<emissive>false</emissive>
<lighting>true</lighting>


@Liam: The engine wake idea is nice... on ground and with low speeds the particle propertys could be changed based on some propertys to make it look nice.
Callsign: ot-666
Working on LOWI and other stuff - Custom Scenery Overlay Repo: http://gitorious.org/fgfs-custom-scenery/custom-scenery-overlay/
VMX22 - Osprey... sometimes in 2014
ot-666
 
Posts: 746
Joined: Sun Nov 08, 2009 6:14 pm
Location: Germany, Konstanz
Callsign: ot-666
IRC name: ot666
Version: GIT
OS: win7 64bit

Re: Better smoke

Postby curt » Thu May 12, 2011 9:00 pm

Here's a video showing my best (so far) smoke/particle configuration in action.

curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN

Re: Better smoke

Postby someguy » Fri May 13, 2011 4:14 am

Wow. Very nice, Curt. Perhaps you could implement Liam's alpha effect as well, to mask the slight putt-putt appearance near the aircraft. Then you'd be good to go.

Got any video using this smoke as wingtip vortices at high G?
User avatar
someguy
 
Posts: 1650
Joined: Tue Nov 25, 2008 6:54 am
Location: USA
Version: 2019.1.1
OS: Mac OS X 10.11.6

Re: Better smoke

Postby planetacancun » Sat May 14, 2011 11:25 pm

Wow nice micro- adjustments there on the autopilot curt, you mastered that :)
That smoke would look awesome on a biplane ride video :) GIT? :D
Callsign:Fallen-
Videos: http://youtube.com/planetacancun2
planetacancun
 
Posts: 322
Joined: Thu Jul 30, 2009 5:52 pm
Callsign: Fallen-
IRC name: Fallen-
Version: GIT
OS: Ubuntu

Re: Better smoke

Postby curt » Sun May 15, 2011 3:15 am

So compare the simulated UAV wing view (showing the micro aileron adjustments of the autopilot) compared to the exact same FlightGear autopilot code running on a real UAV flying autonomously in real life:



This second video is entirely manually flown, but it's the take offs and landings so I thought it turned out pretty cool.

curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests