3d z-buffer issue

David A. Smith squeak-dev at lists.squeakfoundation.org
Sun Sep 22 01:22:43 UTC 2002


Jon,

This looks like a lo-res z-buffer artifact. This is usually caused by the 
near clip distance being too small. What happens is the z buffer is 
actually a 1/z buffer (sort of) and the smaller the near distance the more 
z-buffer resolution that gets crammed into the area right in front of the 
camera. Thus the farther objects z- resolution suffers. I don't know 
Balloon 3D very well, but I will bet that it is the 
B3DCamera >>#nearDistance: method that can fix this for you. It is 
initialized to 0.0001, which is extremely small in my experience. I 
typically use 0.5 - but this depends completely on the nature of the scene 
you are rendering.

Regards,

David

At 10:04 AM 9/21/2002 -0400, you wrote:

>Hi everyone,
>
>I'm working on adding a 3D view to my AUV simulator, so I've been playing
>with the B3D stuff. I've got a model of an AUV read in to Squeak from Rhino
>(using a raw triangle format and a parser I wrote). If I put this model
>into one of the built in viewers, where you basically move the camera
>around and the sub stays still, everything looks perfect all the time, so
>I'm pretty sure I've got the normals computed correctly.
>
>I'm using an ambient light and two directional lights, and a surface
>material, but no textures. The model is a B3DMultiMesh, composed of
>B3DSimpleMesh pieces, which in turn are composed of B3DSimpleMeshFace and
>then B3DSimpleMeshVertex objects. I computed the normals relative to the
>faces, and then applied the normals to the verticies by sending
>#assureVertexNormals to each B3DSimpleMeshFace. The AUV MultiMesh is
>composed of nine simple meshes, which correspond to the different parts of
>the sub:
>
>Shell, RightFin, LeftFin, TopFin, BottomFin, LeftThrusterSupport,
>RightThrusterSupport, LeftThruster, RightThruster
>
>All the faces are triangles, so for instance the Shell mesh is composed of
>48 triangular faces.
>
>When I start moving the sub through space (using #translateBy:), and
>keeping the camera stationary (tracking the sub), some strange things start
>to happen.
>
>I start getting what look like z-buffer artifacts, and I've attached a
>couple JPGs that shows one of these. You can see it particularily near the
>back of the sub, where the top fin is -- the bottom part of the fin sticks
>down into the shell a bunch normally, but here it shows up in a ragged
>manner, and the "hidden" parts you can see change with pretty much every
>frame (as you can see if you compare the two images).
>
>Has anyone seen this, or something like this? Any ideas?
>
>Thanks,
>Jon
>
>--------------------------------------------------------------
>    Jon Hylands      Jon at huv.com      http://www.huv.com/jon
>
>   Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
>            http://www.huv.com
>




More information about the Squeak-dev mailing list