[Public WebGL] determining depth of z-buffer

Steve Baker [email protected]
Wed Feb 2 17:24:55 PST 2011

Well, you just have to know when this kind of thing can't happen.  It's
definitely not perfect for all applications - but in the case of
spacecraft and distant planets - or a Predator flying at 30,000' and
looking at far off terrain - you know that you can make the object some
number of times larger without it interfering.

Another simulator we built was a manipulator arm simulator for the space
station.   The ISS flies at an altitude of around 150km - and it's about
100m across.  So you could comfortably draw it 100 times too big (1km)
and move it 100 times further from the camera.  That gives you a 100
times bigger near-clip plane.   Alternatively (and equivalently) you
could leave the near clip plane alone and just draw the Earth 100 times
smaller and bring it 100 times closer to where the Z precision is better.

We had to be careful when we wanted to draw a 100x too-big shuttle
coming in to dock because when it's 1.5km away and below the ISS, it
would end up buried into the Earth and giving away the whole trick...but
so long as you are moderately in control of the situation, it can be
done.  We just scaled the shuttle smoothly from 1x size and "true"
distance to 100x size and 100x distance as it approached close enough to
the ISS to matter.

Where these tricks get messy is when you want to do things like shadow
casting...because the Z buffer contents are essentially garbage, you
can't do many of the things you'd like to do with it.

  -- Steve

On 02/02/2011 06:38 PM, Giles Thomas wrote:
> Steve,
> Thanks for the naming and the critique of depth-strip[ep]ing! 
> The trick of drawing objects up close as being larger but further away
> sounds neat, but how do you stop them from being obscured by objects
> that are further away than the objects' real depth but closer than the
> depth at which you draw them?  I can imagine that it might not be an
> issue with the Predator specifically (because most things are either
> very far away from it -- targets -- or very close -- the drone itself)
> but could it work in a more general case?
> Also:
> On 3 February 2011 00:20, Steve Baker <[email protected]
> <mailto:[email protected]>> wrote:
>     The alternative is just to turn off Z-testing and Z-writing and
>     draw the
>     sky before anything else on the screen.
> That sounds way better than my idea of clearing the Z-buffer, but if
> you're drawing the skysphere first, why do you switch off Z-testing?
> Cheers,
> Giles
> -- 
> Giles Thomas
> [email protected] <mailto:[email protected]>
> http://www.gilesthomas.com/
> http://projectdirigible.com/
> http://learningwebgl.com/

You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl

More information about the public_webgl mailing list