> From: Dean Keeler <[EMAIL PROTECTED]>
>
> I have an application that loads in a VRML file.  Whenever I manipulate the
> model by rotating it, zooming in on it, etc, the model starts hiding and
> showing different VRML nodes.  Some nodes that should show behind other nodes
> that are in the foreground are showing in front.  How can I keep this from
> happening?  Can someone please give me some suggestions?

I'm assuming that you have depth buffering turned on (it is by default).  In
that case, a common cause of this problem is setting the front clip plane too
close to the eye. If the ratio

        back clip distance / front clip distance

is greater than 1000 or so, you see problems like you describe, especially in
the back of the view volume.   Setting front clip dist = 0.00000001, back clip
dist = 1000000.0 is effectively the same as turning off depth buffering.

You can get away with higher ratios (3000-10000) if your hardware has a lot of
z-buffer resolution or if the objects that are in the back of the view volume
have a lot of spacial separation.

Try setting your clip planes like this:

        view.setFrontClipPolicy(View.VIRTUAL_EYE);
        view.setBackClipPolicy(View.VIRTUAL_EYE);
        double frontDist = 0.1; // <-- set this to what you need
        view.setFrontClipDistance(frontDist);
        view.setBackClipDistance(frontDist * 1000.0);

Adjust frontDist to make your picture look right.

Doug Gehringer
Sun Microsystems

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to