Has Z-clipping anything to do with desktop resolut

Hi Community!

Strange things going on…

Our app uses a 800x600 canvas and configures Z-clipping to

mView.setFrontClipDistance( 1 );
mView.setBackClipDistance( 4500 );

Now I placed a Text2D in front of my camera. I didn’t know why, but I had to
give a Z-value < -5.538 (we are looking to -Z) in order to make it display.
Putting it nearer to the camera, it gets clipped away. I didn’t understand
that, bc. I set the FrontClipDistance to 1, but ok.

The miracle: I used to do this with a desktop resolution of 1280x1024. If I
now reduce desktop resolution to lets say 1024x768, the Text2D vanished!! If
I push it farther away, it appears again???

Here is a table of desktop resolutions and approx. minimal Z-distances:

1280x1024 -5.6
1152x864 -6.2
1024x768 -7.0

What the hell does the desktop resolution have to do with Z-clipping??? My
Canvas3D always is 800x600, View settings always the same, no changes in
aspect ratio. Desktop bitdepth (I tried 32 and 16) doesn’t matter neither.

Environment: XP, JDK1.4.1, Java3D 1.3/DirectX

Anybody has a clue?

Thanks,

  • J

Sounds like you’ve got an 8-bit Z-buffer.

Assuming 256 different values available to your Z-buffer, 256*100/4500 = 5.6888, so the Z-buffer’s minimum value will be 5.6888 or thereabouts, depending on implementation. That number is too close to your observation for my liking! :wink:

However, why the Z-buffer resolution goes down with smaller resolutions, or why it isn’t affected by the colour bit-depth, I don’t know. I’d expect it to go up in resolution with smaller resolutions, and for the difference between 16- and 32-bit to be drastic.

Maybe I’m completely off track - anyone else got any ideas?

I can answer myself, Mark Hood answered very quickly on the Java3D mailinglist.
The error was mine, not setting the correct value in the View object. With the help of marks comments I now can place the Text2D at a distance of 1, exactly as expected.

Here is what Mark says:

Heh, so that was a coincidence? Amazing. :o