On Thu, Oct 30, 2008 at 5:15 AM, Stuart Buchanan wrote:

> I have come to the same conclusion.
>
> The depthrenderbin sorting doesn't work in this case because the draw order
> of the sprites is defined by the CloudShaderGeometry itself.
>
> The solution as you have pointed out is to do the sorting manually before
> rendering. Unfortunately this needs to happen every frame (in
> CloudShaderGeometry::drawImplementation)
>
> The sort needs to be on the z axis of the view fustrum, which can be
> derived
> by passing the sprite positions through the Camera ViewMatrix.


We redraw the clouds very often, but our view position relative to the
clouds isn't changing that fast.  If it turns out that constant sorting is a
big cpu hit, perhaps we could do a partial sort on each cloud for each
frame, so that over the course of a second or two (or 5 or 10?) the cloud
will be completely resorted.

Just for an example, we could do one bubble sort pass each frame, so over
the course of "n" frames the cloud would get properly sorted.  But depending
on number of clouds and rate of movement, perhaps that would even be
overkill?  Maybe we only need to run one pass of the sort algorithm for just
a few clouds each frame?

(And then maybe we have to flag a situation where the view moves a long ways
... like switching to tower view or a new airport, and then do a full sort
in one frame so we don't get stuck seeing a bunch of visual artifacts for
the first few seconds of the new view.)

Curt.
-- 
Curtis Olson: http://baron.flightgear.org/~curt/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to