Board index FlightGear Development Scenery

dist-scale animation only works for short distances

Questions and discussion about enhancing and populating the FlightGear world.

dist-scale animation only works for short distances

Postby richter » Sun Oct 17, 2021 12:52 pm

I'm using the dist-scale animation for obstruction lights on buildings.

https://wiki.flightgear.org/Howto:Anima ... Dist-scale

It seems to work, but only at short distances. Beyond a certain distance, about 200m, the object does not display at all.

I want the light to be visible and scaled at great distances, since this is on a building.

Here is the animation tag I am using.

Code: Select all
    <animation>
        <type>dist-scale</type>
        <object-name>light</object-name>
        <interpolation>
            <entry><ind>0</ind><dep>1</dep></entry>
            <entry><ind>160000</ind><dep>1600</dep></entry>
        </interpolation>
    </animation>


Can anyone help?
Aircraft: Britten-Norman BN-2 Islander
Airports: RJTT
richter
 
Posts: 119
Joined: Tue Jan 27, 2009 5:58 pm
Location: Tokyo
Version: 2
OS: Slackware Linux 12.2

Re: dist-scale animation only works for short distances

Postby erik » Sun Oct 17, 2021 2:54 pm

I'm afraid LOD is kicking in and culls the model based on it's (original) scale.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: dist-scale animation only works for short distances

Postby wkitty42 » Sun Oct 17, 2021 4:51 pm

i wonder if that's the problem with the lights on the AI craft? they should be visible when the craft is a lot further out than they are... if i zoom in (using x i think) then they will appear but that's not how it should work, really... if it is, in this case of the AI craft lights, LOD culling, something's not right...

without looking, i think the AI craft lights are also using dist-scale to try to keep/make the lights visible when the craft is further out than 3km... i think that was the range... might have been 5km... it has been a while since i messed with 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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: dist-scale animation only works for short distances

Postby benih » Sun Oct 17, 2021 5:27 pm

It would train be good if we would have some configuration means to define lod culling for different objects. Some are more important then others and especially Aircraft position lights should be visible very far out; long before the actual model is visible.

I also have an unsolved scenery problem very similar to this one here, where a light landmark is drawn not anymore way too early.
User avatar
benih
 
Posts: 1688
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: dist-scale animation only works for short distances

Postby erik » Mon Oct 18, 2021 8:40 am

We used to have a property to specify distance culling per model. The only problem was that the values where all over the place making it highly inefficient. Letting FligthGear/OSG make the decision resulted in much better frame rates.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: dist-scale animation only works for short distances

Postby erik » Mon Oct 18, 2021 8:48 am

wkitty42 wrote in Sun Oct 17, 2021 4:51 pm:i wonder if that's the problem with the lights on the AI craft? they should be visible when the craft is a lot further out than they are... if i zoom in (using x i think) then they will appear but that's not how it should work, really... if it is, in this case of the AI craft lights, LOD culling, something's not right...

Does this still hold with ALS procedural lights combined with Compositor lights?
That would be my preffered way anyway these days since it does it 's scaling automatically in the effect framework.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: dist-scale animation only works for short distances

Postby richter » Mon Oct 18, 2021 12:37 pm

I found a quick solution by scaling up the object model, and using a fractional dist-scale for distance 0.
The model is a light that is 0.5m in size, so I scaled it up 20x. This works quite well, with the light unculled at great distances until it appears as only 1 pixel on the screen.

Code: Select all
    <animation>
        <type>dist-scale</type>
        <object-name>light-large-lod</object-name>
        <interpolation>
            <entry><ind>0</ind><dep>0.05</dep></entry>
            <entry><ind>4000</ind><dep>1</dep></entry>
        </interpolation>
   </animation>
Aircraft: Britten-Norman BN-2 Islander
Airports: RJTT
richter
 
Posts: 119
Joined: Tue Jan 27, 2009 5:58 pm
Location: Tokyo
Version: 2
OS: Slackware Linux 12.2

Re: dist-scale animation only works for short distances

Postby wkitty42 » Mon Oct 18, 2021 1:21 pm

erik wrote in Mon Oct 18, 2021 8:48 am:Does this still hold with ALS procedural lights combined with Compositor lights?

TBH i don't know... it has been a while since i waded in that particular pool... i may try to fire up FG later today and either record or stream a session testing this to see if it is still the same as it was...

erik wrote in Mon Oct 18, 2021 8:48 am:That would be my preffered way anyway these days since it does it 's scaling automatically in the effect framework.

AFAIK the AI lights code has not been changed since compositor came out... all of my testing was done with various versions of the next branch... all of them did the same thing and were doing the same the last time i looked...

i know at one time i worked on some AI lights stufff... i went through numerous methods... one had separate lights definitions for each craft to avoid all lights blinking in sync... that was highly tedious and consumed a lot of memory... i think i tried this using two different formats... one was object based and the other was shader based... i think... i don't have any of that work any more, though... i do recall that one method was very similar to the current method used which has main code based in FGData/AI/Lights... the other method put those files into each craft's directory... i think this 2nd method was the memory consuming one... especially at airports with huge numbers of AI craft with lights on them... the AI craft are slowly having their models updated to include lights... i think that, at this time, only a portion of the commercial craft have them... in my case, i was working with them on GA and smaller commercial craft...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: dist-scale animation only works for short distances

Postby wkitty42 » Mon Oct 18, 2021 1:27 pm

richter wrote in Mon Oct 18, 2021 12:37 pm:I found a quick solution by scaling up the object model, and using a fractional dist-scale for distance 0.
The model is a light that is 0.5m in size, so I scaled it up 20x. This works quite well, with the light unculled at great distances until it appears as only 1 pixel on the screen.

Code: Select all
    <animation>
        <type>dist-scale</type>
        <object-name>light-large-lod</object-name>
        <interpolation>
            <entry><ind>0</ind><dep>0.05</dep></entry>
            <entry><ind>4000</ind><dep>1</dep></entry>
        </interpolation>
   </animation>

this looks very similar to the code used by the AI craft... you can see this code in FGData/AI/Lights... each craft is responsible for settings its lights' positions and then using the code in FGData to make them work... the AI turn their beacons on at one point and other lights at other points... these points are based on (IIRC) them having a transponder ID and their various speeds... unfortunately once a craft lands, the current AI code does not (always?) turn the lights off once the craft has parked... but anyway, i just thought i'd point out the similarity in your code and that in the AI craft... if your's works better, it might be an idea to get it into the AI craft... especially so they can be seen when further out than currently happens...
"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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04


Return to Scenery

Who is online

Users browsing this forum: No registered users and 3 guests