Board index FlightGear Support Graphics

weird graphic bugs with "atmospheric light scattering"

Graphics issues like: bad framerates, weird colors, OpenGL errors etc. Bad graphics ar usually the result of bad graphics cards or drivers.
Forum rules
In order to help you, we need to know a lot of information. Make sure to include answers to at least the following questions in your initial post.

- what OS (Windows Xp/Vista, Mac etc.) are you running?
- what FlightGear version do you use?
- what graphics card do you have?
- does the problem occur with any aircraft, at any airport?
- is there any output printed to the console (black window)?
- copy&paste your commandline (tick the "Show commandline box on the last page of FGRun or the "Others" section on the Mac launcher).
- please upload a screenshot of the problem.

If you experience FlightGear crashes, please report a bug using the issue tracker (can be also used for feature requests).
To run FlightGear on old computers with bad OpenGL support, please take a look at this wiki article. If you are seeing corrupted/broken textures, please see this article.

Note: If you did not get a reponse, even after 7 days, you may want to check out the FlightGear mailing lists to ask your question there.

Re: weird graphic bugs with "atmospheric light scattering"

Postby Thorsten » Sun Oct 19, 2014 7:04 am

Okay, since you compile the code yourself, I assumed some background in coding, so I didn't want to patronize you by spelling out every step, but I'm happy to do so if you feel more comfortable with details:

So, I would like you to keep this line

Code: Select all
float intensity = clamp(ray * exp(-40.0 * r * r) + exp(-80.0*r*r),0.0,1.0) + 0.1 * fogEffect * (1.0-smoothstep(0.3, 0.6,r));


as it is - you've removed 'ray' and established that ray contains the problem before - so we need to put that line back and focus on when 'ray' gets problematic.

You've previously put in

Code: Select all
float ray = clamp(pow(sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)),10.0),0.0,1.0);


and you reported seeing a star-shaped structure even with the mod() being inserted. I'd like you to successively try

Code: Select all
float ray = clamp(pow(sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)),2.0),0.0,1.0);


Code: Select all
float ray = clamp(sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)),0.0,1.0);


Code: Select all
float ray = clamp(sin((sinphi-3.0) * (sinphi-3.0)),0.0,1.0);


Code: Select all
float ray = clamp(((sinphi-3.0) * (sinphi-3.0)),0.0,1.0);


Code: Select all
float ray = clamp(((sinphi-3.0) ),0.0,1.0);


till you see in essence a lit disc rather than a star (I don't need screenshots of all intermediate steps, I just want to know when it stops looking weird).

Thanks! Oh, and if you could have a look into the log file .fgfs/fgfs.log for shader compilation errors or warnings please? Maybe we get lucky...
Thorsten
 
Posts: 10982
Joined: Mon Nov 02, 2009 8:33 am

Re: weird graphic bugs with "atmospheric light scattering"

Postby Curtis » Sun Oct 19, 2014 9:26 am

here are the results for the 5 tests, I did a screenshot for each steps

1)
Code: Select all
 float ray = clamp(pow(sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)),2.0),0.0,1.0);


the display of VASI/PAPI seems weird, not good :

Image

2)
Code: Select all
float ray = clamp(sin(mod((sinphi-3.0) * (sinphi-3.0),6.2832)),0.0,1.0);


the display of VASI/PAPI seems worse, distorted flares

Image

3)
Code: Select all
float ray = clamp(sin((sinphi-3.0) * (sinphi-3.0)),0.0,1.0);


the display is not good again, always this weird star instead of a circular VASI/PAPI :

Image

4)
Code: Select all
float ray = clamp(((sinphi-3.0) * (sinphi-3.0)),0.0,1.0);


it's much better, no flares, I get a perfect circular disc for VASI/PAPI

Image

5)
Code: Select all
float ray = clamp(((sinphi-3.0) ),0.0,1.0);


same like 4) but the circular disc seems too small for the VASI/PAPI :

Image

if I had to choose I prefer the 4) ( float ray = clamp(((sinphi-3.0) * (sinphi-3.0)),0.0,1.0); ),

it seems more natural to see a perfect circular disc without these lens/flare effects, I think that a real pilot doesn't see lens flares if this pilot has a perfect vision,

a pilot will see "flare effect shape" only if he is suffering from myopia

in ~/.fgfs/fgfs.log I don't see error or warning messages about shader compilation during the 5 tests
Curtis
 
Posts: 105
Joined: Wed Jun 17, 2009 3:09 pm
OS: archlinux 64 bits

Re: weird graphic bugs with "atmospheric light scattering"

Postby Thorsten » Sun Oct 19, 2014 5:00 pm

the display of VASI/PAPI seems weird, not good :


It's a bit difficult to gauge from the screenshot - I'd need a close-up on the light - but that looks sort of okayish to me - it seems there's a central disc with some rays around, which is the intended visual.

if I had to choose I prefer the 4) ( float ray = clamp(((sinphi-3.0) * (sinphi-3.0)),0.0,1.0); ),


Well, I just told you what line to edit, and you can leave that line in whatever state you prefer. This is OpenSource, which means you can modify the whole shader code in any way you like, discard it, replace it by your own. You don't have a moral duty to use the effect as I designed it :-)


it seems more natural to see a perfect circular disc without these lens/flare effects, I think that a real pilot doesn't see lens flares if this pilot has a perfect vision,

a pilot will see "flare effect shape" only if he is suffering from myopia


Well, that's a deep discussion.

First of all, how the eye perceives scenes at low light are tricky to begin with, because you don't only have to get the intensities of the lights right, you also have to get the response of the eye right, which ceases to be approximately logarithmic at low intensities and becomes more complicated. It actually depends (a lot) on the adaption state of the eye, i.e. ultimately on the question of how bright your instrument panel is lit.

Rendering such scenes is an order of magnitude more tricky, because what you see now depends not only on the adaption state of your virtual eyes, but also on the light in the room you run FG and the adaption state of your real eyes (ALS in general assumes you're viewing simulated night scenes in a dark room with your eyes adapted to screen light only - hence they will always come out too dark if you view them during the day and don't dial your monitor's gamma correction up). Even if you have the formula how perception of intensity works tied down, for lights it still leaves the problem how to translate that into (completely unphysical) sprite color, alpha and size values - for which there's no unique recipe.

Whether the eye sees a flare depends on a number of things - if you squint, the eye-lashes produce rather pronounced flares. Reflections on a glass may produce some. For sure, the eye doesn't perceive a simple disc (the light bulb in fact never is one...) - I've seen too many cars on the opposite lane on my daily winter commute to buy into that disc idea.

So, what is rendered is... well... a halfway educated guess at how true intensity of the lights should translate into size and alpha value given the other scene lights, and the rays are, let's say, an iconic effect. A reminder that we don't see these lights as a simple disc. It's not 'correct' in any physical or physiological sense, but I think it's better than the simple disc. We see bright lights as somewhat sparkling. I won't try to defend it more than that.

So, actually, this is how it's intended to look (in fog, where an additional halo forms because the light illuminates the fog):

Image

Okay - bottomline - I will try to find a replacement for the sine function, which seems to be the root of the problem, and get back with something else to test.
Thorsten
 
Posts: 10982
Joined: Mon Nov 02, 2009 8:33 am

Re: weird graphic bugs with "atmospheric light scattering"

Postby Curtis » Sat Oct 25, 2014 3:39 pm

Hello Thorsten,

it would be interesting to add an option "--without-lens-flare-effect" in command line if some people don't want this lens effect flare for lights,

if I search real photos of airports I can see this :

Image

http://fineartamerica.com/featured/airp ... moudi.html

http://www.fotothing.com/photos/63e/63e ... 22_2a1.jpg

sometimes we can find a photo with the lens flare effect, but I don't know if it's a special effect with a filter on the photo lens :

Image
Curtis
 
Posts: 105
Joined: Wed Jun 17, 2009 3:09 pm
OS: archlinux 64 bits

Re: weird graphic bugs with "atmospheric light scattering"

Postby radi » Sat Oct 25, 2014 9:32 pm

Grab your DSLR and a tripod and take two pictures of a point light source at night, one with the aperture open/short exposure and another with aperture closed/long exposure. The latter will give you those sparkling lights. But a realistic rendering should not reproduce photos, it should reproduce what your eyes would preceive.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: weird graphic bugs with "atmospheric light scattering"

Postby Thorsten » Sun Oct 26, 2014 10:29 am

it would be interesting to add an option "--without-lens-flare-effect" in command line if some people don't want this lens effect flare for lights,


I think I have stated before that this is not lense flare but the way the eyes perceive a bright dot of light.

I have explained my reasoning, and I even did extra tests two nights ago to test how I see headlights of cars and runway lighting when I look into the dots, and I have satisfied myself that rendering them as discs is quite wrong. Personally, I think the GUI we present to the user has to have a useful balance between ease of use (few option) and configurability (many options). Allowing to micro-manage the user every aspect of rendering is not what I am interested in (you have no idea how complicated the interdependence of different rendering options makes the code to write), and so no, I don't think it'd be interesting.

But FG is OpenSource - if you think it useful to have that option, feel free to create it :-)


But a realistic rendering should not reproduce photos, it should reproduce what your eyes would preceive.


Quite so - this case is especially bad - photos constitute zero evidence for what you see when you look into a bright light dot.
Thorsten
 
Posts: 10982
Joined: Mon Nov 02, 2009 8:33 am

Re: weird graphic bugs with "atmospheric light scattering"

Postby Curtis » Sun Oct 26, 2014 6:26 pm

Thorsten wrote in Sun Oct 26, 2014 10:29 am:I think I have stated before that this is not lense flare but the way the eyes perceive a bright dot of light.


sorry but I'm still not convinced by your explanation :)

when I see lights the night ( on road when I drive a car, cities lights ) they don't seem like your screenshoot :

Image

but I will understand if you don't want to add an option for disabling this special effect

Thorsten wrote in Sun Oct 26, 2014 10:29 am:But FG is OpenSource - if you think it useful to have that option, feel free to create it


a good conclusion for this discussion, as long as FG is open-source the solution for me is simply to modify the file /fgdata/Shaders/surface-light-lightfield.frag with my own value for the value "float intensity"
Curtis
 
Posts: 105
Joined: Wed Jun 17, 2009 3:09 pm
OS: archlinux 64 bits

Re: weird graphic bugs with "atmospheric light scattering"

Postby Thorsten » Sun Oct 26, 2014 7:11 pm

sorry but I'm still not convinced by your explanation

when I see lights the night ( on road when I drive a car, cities lights ) they don't seem like your screenshoot


Presumably because you never read it :-) What I actually wrote is

It's not 'correct' in any physical or physiological sense, but I think it's better than the simple disc. We see bright lights as somewhat sparkling. I won't try to defend it more than that.

so it's a moot point to tell me that real lights don't look like the screenshot - I said so quite explicitly myself. I didn't claim the ray pattern is correct, I claimed that it's better than a simple disc. Which is quite a difference.
Thorsten
 
Posts: 10982
Joined: Mon Nov 02, 2009 8:33 am

Previous

Return to Graphics

Who is online

Users browsing this forum: No registered users and 1 guest