Board index FlightGear Development

Cross-talk between animations?

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Cross-talk between animations?

Postby Thorsten » Tue May 04, 2010 4:01 pm

I recently had the rather clever idea that I might squeeze a bit more framerate out of heavily clouded skies by using the range animation - basically there is no need to ask the shader to render a cloud completely transparent.

A normal cloud model xml wrapper looks more or less like this

Code: Select all
<?xml version="1.0"?>

<PropertyList>
 <path>altocumulus1.ac</path>
 
 
<animation>
  <object-name>rect</object-name>
  <enable-hot type="bool">false</enable-hot>
</animation>

<effect>
  <inherits-from>Effects/clouds-thin</inherits-from>
  <object-name>rect</object-name>
</effect>

</PropertyList>


and I just added a range tag to that like this

Code: Select all
<?xml version="1.0"?>

<PropertyList>
 <path>altocumulus1.ac</path>

<animation>
  <object-name>rect</object-name>
  <enable-hot type="bool">false</enable-hot>
</animation>

<effect>
  <inherits-from>Effects/clouds-thin</inherits-from>
  <object-name>rect</object-name>
</effect>

<animation>
  <type>range</type>
  <object-name>rect</object-name>
  <min-m>0</min-m>
  <max-m>31000</max-m>
</animation>

</PropertyList>


What happened cannot be called a complete success - I got a 30% improvement in framerate (good) - but I collided with a cloud - apparently the enable-hot tag was ignored. The weird thing is that I didn't collide with the first cloud I met. I was descending for 30 seconds through a dense layer, during which time I must have crossed probably hundred cloudlets. Since I'm using only six distinct cloudlet models for layers, I must have hit that particular cloud model a few times before without problems.

I checked the obvious thing first and I did not in modifying the files delete the enable-hot tag in a xml file. So my next hypothesis is that there is some cross-talk between animations which can induce errors if a large number (thousands) of models need to be rendered - maybe the order in which one declares animations matters?

I'd really like to keep the 30% gain in framerate - so if anyone who knows the internals of animation handling can advise me if there is a more reliable way to declare clouds as non-substantial objects than I'm doing now, I'd be very happy!
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Cross-talk between animations?

Postby AndersG » Tue May 04, 2010 4:57 pm

IIRC animations are applied in bottom up order from the end of the file, so you can try moving the hot animation below the range animation.
Further, if you remove the object-name tag from these animations they will apply to the whole file instead of just the rect object (probably doesn't make any difference w.r.t. this problem, though).
In any case, as I've understood the semantics of a range animation it only inhibits the rendering of the object so presumably collision detection with its bounding volume still takes place.

Cheers,

Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2524
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Cross-talk between animations?

Postby Thorsten » Wed May 05, 2010 1:11 pm

IIRC animations are applied in bottom up order from the end of the file, so you can try moving the hot animation below the range animation.


Seems to be working - I just spent 10 minutes blasting with the F-16 through various layers without hitting anything... Thanks.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Cross-talk between animations?

Postby fredb » Wed May 05, 2010 9:43 pm

enable-hot (height over terrain, the collision algorithm) can be applied to any animation, range included :

Code: Select all
<?xml version="1.0"?>

<PropertyList>
<path>altocumulus1.ac</path>

<effect>
  <inherits-from>Effects/clouds-thin</inherits-from>
  <object-name>rect</object-name>
</effect>

<animation>
  <type>range</type>
  <object-name>rect</object-name>
  <enable-hot type="bool">false</enable-hot>
  <min-m>0</min-m>
  <max-m>31000</max-m>
</animation>

</PropertyList>
User avatar
fredb
 
Posts: 753
Joined: Fri Dec 01, 2006 11:41 am
Location: Paris, France

Re: Cross-talk between animations?

Postby AndersG » Wed May 05, 2010 10:11 pm

fredb wrote:enable-hot (height over terrain, the collision algorithm) can be applied to any animation, range included :


Cool, I didn't know that. :)
Btw. would it be more efficient to apply the range animation to the whole file (by removing the <object-name> element) in this case?
It seems to me that that might move the range test one level up in the scene graph and also (with the change above) make sure that the entire contents of altocumulus1.ac is excluded from collision tests.

Cheers,

Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2524
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Cross-talk between animations?

Postby Thorsten » Fri May 07, 2010 10:25 am

Btw. would it be more efficient to apply the range animation to the whole file (by removing the <object-name> element) in this case?
It seems to me that that might move the range test one level up in the scene graph and also (with the change above) make sure that the entire contents of altocumulus1.ac is excluded from collision tests.


In my standard test situation, this didn't make a measurable difference.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am


Return to Development

Who is online

Users browsing this forum: No registered users and 8 guests