I've recently come across some interesting phenomenon with regard to the
range animation.

In the second generation of my cloud rendering system, every cloud in the
system was rotated towards the viewer, and then shaded to invisible if it
was more than 31 km away by the vertex shader.

Since I generate clouds in 40x40 km tiles (to get a control scale for
long-range weather patterns), this meant that when a new tile was created,
typically more than 2/3 of the new clouds were out of visual range. I
figured that it was quite inefficient to let the shader do all the matrix
algebra to discover in the end that the cloud is too far away and shade it
invisible. At this point all cloud models received a range animation with
the idea that the shader should only do transformations for objects
actually in visible range, leading to the 3rd generation of the system and
a nice improvement in framerate.

Recently, I changed to the 4th generation with a scheme that would write
clouds only into the scenery when they are closer than a certain distance,
i.e. an Nasal-based equivalent of the range animation. Since I don't
particularly care if an object becomes visible at 31 km distance or at 28
km, as long as it's somewhere in that range, I implemented that as a loop
which runs through all candidates at a leasurely pace, so typically a
cloud is picked up 10 seconds or so after the range was reached. Since
that made the range animation obsolete, I threw it out.

And was surprised that my framerates increased by 50% (!).

I don't know how the range animation is implemented, but I have the
impression that it checks every object every frame. Which for most
purposes isn't necessary and makes a huge difference if you have, say,
6000 objects.

It pays off better if the object in question has a lot of vertices and is
hence more demanding for the shader, so you may trade e.g. 40 vertex
operations against a range check instead of just 4 with a cloudlet. But it
seems to me there are situations where a 'sloppy' version of the range
animation would use a lot less resources. I don't know how frequent range
animations appear in static sceneries such as Paris or the detailed
airport models - but it's something to keep in mind I guess.

Cheers,

* Thorsten


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to