Board index FlightGear Development Effects and shaders

Bug #2011 Random building visible through fog not fixed

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

Bug #2011 Random building visible through fog not fixed

Postby iamzac » Sat Jan 05, 2019 9:05 am

This bug: https://sourceforge.net/p/flightgear/codetickets/2011/ is still present.
I was looking around Thorsten Renk's fix at https://sourceforge.net/p/flightgear/fgdata/ci/69e8d90247df250ba552825b0e6164133314c7bf/ to see if maybe something else disabled it and while playing around I see that changing this in the file Shaders/model-ALS-ultra.frag:

Code: Select all
    vec3 up;
 
    if (building_flag == 1) // osg_ViewMatrix contains the transforms of animations, but doesn't work for random buildings
   {
    up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;
   }
   else
   {   
    up = (osg_ViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;
   }


with this:

Code: Select all
vec3 up;

up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;



fixes the bug but I am sure this probably creates other bugs that I didn't notice yet (probably it breaks the effects on the airplanes, but the planes I looked at seem fine at first glance) since I have absolutely no idea what it does because I have no knowledge of 3d programming.
I only posted this temporary solution as a possible helpful hint for the developers who know what all this means to maybe come with a proper fix.

The easiest way to reproduce for me is to set visibility at 1000 on some airport with buildings on the other end of the runway with all ALS shaders at max.
Completely disabling the model shader makes the buildings behave properly so that's where the problem seems to be.
iamzac
 
Posts: 96
Joined: Fri Nov 07, 2014 8:52 am
OS: Windows / Kubuntu

Re: Bug #2011 Random building visible through fog not fixed

Postby Thorsten » Sat Jan 05, 2019 9:49 am

That's random buildings in Honolulu with 2018.3 and model shader maxed out:

Image

Everything seems to be fogged correctly. Which is to say, I can't reproduce that. If removing the conditional fixes the problem, maybe something else is non-standard in your setup?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Bug #2011 Random building visible through fog not fixed

Postby iamzac » Sat Jan 05, 2019 10:29 am

Indeed in Honolulu the bug is not present.
But it's present at Innsbruk for at least some of the buildings:

With original flightgear code at LOWI (look in top right and left corners you can see them black at left and white at right):

Image

It's more obvious if you fly through them but I made the screenshot to be easy to reproduce.
Where I see this problem the most is at some cities where I have old osm2city custom scenery added, maybe some old buildings have some problem that the new ones don't.
At Innsbruck I don't have anything custom...well, Project3000 might have some stuff there too but that's only for the airports.

With that change that apparently fixes it:

Image

And while at the Honolulu airport I noticed a similar problem but with the roads this time:

Image
Last edited by bugman on Mon Jan 07, 2019 10:57 am, edited 1 time in total.
Reason: Please do not quote the entire previous post.
iamzac
 
Posts: 96
Joined: Fri Nov 07, 2014 8:52 am
OS: Windows / Kubuntu

Re: Bug #2011 Random building visible through fog not fixed

Postby Thorsten » Sat Jan 05, 2019 10:55 am

Are you sure these are random buildings? Roads and buildings showing the same issue sounds more like OSM2City stuff...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Bug #2011 Random building visible through fog not fixed

Postby iamzac » Sat Jan 05, 2019 11:11 am

They are not random buildings, they are scenery buildings, I didn't read the bug report properly, sorry, in my mind these two where the same thing.
And after further investigating I see that the difference from Honolulu is that buildings at LOWI use the cityLM.eff which inherits from model-combined-deferred which inherits from model-combined so putting <building-flag type="int">1</building-flag> instead of <building-flag type="int">0</building-flag> also fixes the problem in the same way that the other change I posted it does (well... I thing it might be the same thing) and it probably creates the same unknown problems.
Last edited by bugman on Mon Jan 07, 2019 10:56 am, edited 1 time in total.
Reason: Please do not quote the entire previous post.
iamzac
 
Posts: 96
Joined: Fri Nov 07, 2014 8:52 am
OS: Windows / Kubuntu

Re: Bug #2011 Random building visible through fog not fixed

Postby legoboyvdlp » Sat Jan 05, 2019 12:53 pm

I took off in Paris in quite severe fog the other day and saw this - it's more evident when you fly over a fog layer than looking at them from low level inside fog.
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Bug #2011 Random building visible through fog not fixed

Postby Thorsten » Sat Jan 05, 2019 1:24 pm

It seems easy enough to set the flag in cityLM.eff, but what is it actually for? Do scenery buildings use it regularly? I thought it's an OMS2City thing - and if other buildings refer to it, that might end poorly because we make special assumptions to render OMS2City stuff (and will make more in the future).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Bug #2011 Random building visible through fog not fixed

Postby iamzac » Sat Jan 05, 2019 1:34 pm

That could be done with a simple script under linux to insert that flag to all the cityLM files in terrasync and custom scenery if the other method is bad.

The other method also works for roads, I replaced:

Code: Select all
    vec3 up = (osg_ViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;

with
Code: Select all
    vec3 up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;

in road-ALS-ultra.frag and it fixes the road issue at Honolulu without apparently breaking the road with cars effect.
Since you are the author of that code, what potential bad side effects this would create?
Last edited by bugman on Mon Jan 07, 2019 10:56 am, edited 1 time in total.
Reason: Please do not quote the entire previous post.
iamzac
 
Posts: 96
Joined: Fri Nov 07, 2014 8:52 am
OS: Windows / Kubuntu

Re: Bug #2011 Random building visible through fog not fixed

Postby Thorsten » Sat Jan 05, 2019 2:29 pm

That could be done with a simple script under linux to insert that flag to all the cityLM files in terrasync and custom scenery if the other method is bad.


Okay, I just checked - the cityLM.eff on FGData has the flag set.

Before effect files for OSM2CIty were stored centrally, there was a period in which they were shipped with the scenery - which was a massive design flaw, as it is plain impossible to keep these in sync with the shader code.

I generally assume no responsibility for breakage of local effect files for scenery outside FGData/Effects - it's up to the people who put them there to make all necessary changes, I simply can't.

Custom (or in fact any) scenery with such local effect files should be discarded and-re-done - it's a dead end, the same problem will rear its head with every modification of the shader code.

As for roads, I think I checked fogging with the traffic shader (among other things) and it used to work okay for me, so I'm not sure what has changed there. I'll have a look when I find the time.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Bug #2011 Random building visible through fog not fixed

Postby iamzac » Mon Jan 07, 2019 7:37 am

There are 114 cityLM.eff files in TerraSync which can't be fixed by users because they would be overwritten by TerraSync so they need to be fixed upstream.
Also multiple roads.eff files that would also need this change (probably).
And the separate road issue I think also needs upstream fixing.
For me that ugly fix works for now for both of these, I still don't know what bad side effects I might have created.
Last edited by bugman on Mon Jan 07, 2019 10:56 am, edited 1 time in total.
Reason: Please do not quote the entire previous post.
iamzac
 
Posts: 96
Joined: Fri Nov 07, 2014 8:52 am
OS: Windows / Kubuntu

Re: Bug #2011 Random building visible through fog not fixed

Postby Thorsten » Mon Jan 07, 2019 9:06 am

You've taken out a correct reflection of animated objects in the cockpit as far as I know.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Bug #2011 Random building visible through fog not fixed

Postby iamzac » Mon Jan 07, 2019 9:25 am

Thanks, then it's time I'll change all those citylm files.
Last edited by bugman on Mon Jan 07, 2019 10:56 am, edited 1 time in total.
Reason: Please do not quote the entire previous post.
iamzac
 
Posts: 96
Joined: Fri Nov 07, 2014 8:52 am
OS: Windows / Kubuntu

Re: Bug #2011 Random building visible through fog not fixed

Postby Mihajlo » Tue Jan 08, 2019 11:25 am

I guess this answers my question regarding this: https://sourceforge.net/p/flightgear/codetickets/2096/
Note that these are jetways, not runway lights.
It's a local problem, since these are custom objects. Still don't know why it happens though.
Mihajlo
 
Posts: 54
Joined: Tue Aug 28, 2018 6:47 pm


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 2 guests