[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] determining depth of z-buffer



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 <steve@sjbaker.org
> <mailto:steve@sjbaker.org>> 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
> giles@giles.net <mailto:giles@giles.net>
> http://www.gilesthomas.com/
> http://projectdirigible.com/
> http://learningwebgl.com/

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------