Board index FlightGear Development Effects and shaders

Relativistic winter arrives... In the tank balistic descent

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

Relativistic winter arrives... In the tank balistic descent

Postby abassign » Tue Apr 17, 2018 8:42 pm

We are adding new features for the FIAT G91R1B, for example the subjective view of the release of some loads.

The test is done by unhooking a wing tank, the tank drops with a ballistic trajectory, until the impact with the ground (the wing tank normally does not explode even if it contains fuel). But there is a flaw, when it comes close to the ground, suddenly, the ground takes on a winter look, but we are in the summer!



I did the test both with a Linux machine with NVIDIA 1050 (4 GB of RAM) and with another Linux machine with only Intel I7 CPU-GPU. But the result has always been to see the snow coming on the ground as if a Warp drive had been activated!

This is the view code for the sub-model view:

Code: Select all
    <view n="100">
        <name>Submodel view</name>
        <type>lookfrom</type>
        <config>
            <eye-lat-deg-path>sim/G91/views/view_submodel/latitude-deg</eye-lat-deg-path>
            <eye-lon-deg-path>sim/G91/views/view_submodel/longitude-deg</eye-lon-deg-path>
            <eye-alt-ft-path>sim/G91/views/view_submodel/altitude-ft</eye-alt-ft-path>

            <eye-roll-deg-path>sim/G91/views/view_submodel/roll-deg</eye-roll-deg-path>
            <eye-pitch-deg-path>sim/G91/views/view_submodel/pitch-deg</eye-pitch-deg-path>
            <eye-heading-deg-path>sim/G91/views/view_submodel/heading-deg</eye-heading-deg-path>
           
            <x-offset-m type="double">2</x-offset-m>
            <y-offset-m type="double">2</y-offset-m>
            <z-offset-m type="double">10</z-offset-m>
            <heading-offset-deg> 0.0 </heading-offset-deg>
            <at-model type="bool">false</at-model>
            <at-model-idx type="int">0</at-model-idx>
            <from-model type="bool">false</from-model>
            <from-model-idx type="int">0</from-model-idx>

        </config>
        <dynamic>
            <enabled type="bool">false</enabled>
        </dynamic>
    </view>


Can anyone tell me how to solve this problem? Thank you !

Note:
I have already noted, in the past, this problem with tower views in areas far from take-off.
abassign
 
Posts: 791
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Relativistic winter arrives... In the tank balistic desc

Postby Thorsten » Wed Apr 18, 2018 3:50 am

The terrain shader (and also the weather system and the sky shader) use approximations and techniques that rely on viewpoint and airplane position being 'close' (which is, hands down, kind of the essence of a flight simulator...)

When you separate the two too far, you're violating that assumption an gradually all sorts of artifacts appear.

I suppose in this case you might get by with a hack upping the snowline while your view descends...
Thorsten
 
Posts: 10819
Joined: Mon Nov 02, 2009 8:33 am

Relativistic winter arrives... In the tank balistic descent

Postby abassign » Wed Apr 18, 2018 7:42 am

Second example:

The airplane is near the airport of Orio al Serio (LIME) near Milan (Italy) I placed it at about 30000 ft. If I make a view from the tower of Orio Al Serio (LIME) I see that the ground has snow, but from the plane if you look at the airport area there is no snow.

View from the plane flying at 30,000 ft compared to Orio Al Serio airport, the airport is visible at about "11 hours" than the plane:

Image

The same moment, which can be seen from the control tower at Orio al Serio airport (LIME):

Image
Last edited by Gijs on Wed Apr 18, 2018 8:43 am, edited 1 time in total.
Reason: Merged with existing topic
abassign
 
Posts: 791
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Relativistic winter arrives... In the tank balistic desc

Postby Thorsten » Wed Apr 18, 2018 8:15 am

Yes. You can also move any cockpit view far enough and you'll see the same thing. Or take the walker and go really far. Or do in fact anything that separates airplane and view position. It's always the same explanation though, no matter how many different scenarios you post. I promise - that's really the reason! :D
Thorsten
 
Posts: 10819
Joined: Mon Nov 02, 2009 8:33 am

Re: Relativistic winter arrives... In the tank balistic desc

Postby abassign » Wed Apr 18, 2018 8:36 pm

In this piece of code terrain-ALS-ultra.frag we can see the problem:

Image

I believe, reading this code, that the height of the point displayed on the image is obtained through the quota of relPos (relative position?) And the dimension of the point of view (eye_alt) the sum of these two values from the point's share with respect to the geoid, once the height of the point is enough to verify that the altitude is higher than that of the snow quota and that's it. This is a good technique to avoid having to put the snow on a model of the real 3D world, but only on the actual pixels in the view.
If I calculate msl_altitude without the height reported by "eye_alt", the problem no longer occurs (but also the snow ... at least for the most part!). At this point I wonder if you can modify eye_alt according to the actual view so as to avoid the problem.
abassign
 
Posts: 791
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Relativistic winter arrives... In the tank balistic desc

Postby Thorsten » Thu Apr 19, 2018 5:21 am

Feel free to experiment - I seem to remember there was a reason why this wasn't a good idea, but it's been a few years. And you could cure the issue at hand by changing to an absolute altitude reference (though then I think you needed more calculations or another varying float).

But don't expect this to be the only issue, the assumption that plane and view are close is used in more than one place to speed things up.
Thorsten
 
Posts: 10819
Joined: Mon Nov 02, 2009 8:33 am

Re: Relativistic winter arrives... In the tank balistic desc

Postby abassign » Thu Apr 19, 2018 3:02 pm

In my opinion the part of the code for the snow you wrote in 2011 is excellent and fast!

Obviously the problem is almost completely non-existent if the point of view is a few meters away from the plane, as in normal views, but becomes important for particular views, such as that of the control tower, the walker, and in my case of the fuel tank going down to the ground. One day, I hope soon ... the same problem will be for the ejection seat, which is the next animation I want to do for the G91R1B.

I don't not know where <use>eye_alt</ use> variable is it defined, I see it in the XML code of write in the .eff file connected with the code .frag or .vert

Code: Select all
     <uniform>
        <name>eye_alt</name>
        <type>float</type>
        <value><use>eye_alt</use></value>
      </uniform>


I do not know where this variable is calculated, maybe someone knows and avoids me doing a more complex analysis of the code. Being a variable <use>eye_alt</ use> it certainly define the code that interprets the XML that I do not know which module it define it and therefore is it set, if someone knows I can better analyze the problem.

The view that I created to chase the drop tank in its descent running is this:

Code: Select all
<view n="100">
        <name>Submodel view</name>
        <type>lookfrom</type>
        <config>
            <eye-lat-deg-path>sim/G91/views/view_submodel/latitude-deg</eye-lat-deg-path>
            <eye-lon-deg-path>sim/G91/views/view_submodel/longitude-deg</eye-lon-deg-path>
            <eye-alt-ft-path>sim/G91/views/view_submodel/altitude-ft</eye-alt-ft-path>


Therefore I believe that the problem is not very complicated to solve, you just need to find the right point to make the correction, all the necessary parameters are present.
abassign
 
Posts: 791
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: Relativistic winter arrives... In the tank balistic desc

Postby Thorsten » Thu Apr 19, 2018 5:00 pm

I do not know where this variable is calculated, maybe someone knows and avoids me doing a more complex analysis of the code


By a property rule - I think it's done inside the environment subsystem property rules.
Thorsten
 
Posts: 10819
Joined: Mon Nov 02, 2009 8:33 am

Re: Relativistic winter arrives... In the tank balistic desc

Postby abassign » Thu Apr 19, 2018 6:03 pm

Thorsten wrote in Thu Apr 19, 2018 5:00 pm:
I do not know where this variable is calculated, maybe someone knows and avoids me doing a more complex analysis of the code

By a property rule - I think it's done inside the environment subsystem property rules.


I did a test, I went down together with the drop-tanks with the sight on the drop-tanks ... in this case there were no problems. Surely the variable is a function of the altitude of the plane or the main view 0.
abassign
 
Posts: 791
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest