The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » Java 3D

Thread: Possibility of no-render zones?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered. Helpful answers available: 1. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 3 - Last Post: Nov 5, 2009 6:38 AM by: dwsubc Threads: [ Previous | Next ]
dwsubc

Posts: 9
Possibility of no-render zones?
Posted: Nov 4, 2009 6:53 AM
 
  Click to reply to this thread Reply

Hi,
I just started in java 3D and I am wondering if it is possible to set up 3D zones where all objects are invisible? For instance, any part of any object with a positive Y-coordinate would be invisible.

I tried this with a BoundingBox but all that happens is that the objects in the 'invisible zone' are black but you can still see them when they pass in front of other objects.

My intention is to show cutaway type views of 3D scenes.

Many thanks
Dave

weiland

Posts: 117
Re: Possibility of no-render zones?
Posted: Nov 4, 2009 7:46 AM   in response to: dwsubc
Helpful
  Click to reply to this thread Reply

Have you seen the ModelClip node? Sounds like that could do something like what you're asking.

Bill

dwsubc

Posts: 9
Re: Possibility of no-render zones?
Posted: Nov 4, 2009 7:55 AM   in response to: weiland
 
  Click to reply to this thread Reply

Many thanks Bill. It looks like this will do exactly what I want.

Thanks again for the quick reply.
Dave

dwsubc

Posts: 9
Re: Possibility of no-render zones?
Posted: Nov 5, 2009 6:38 AM   in response to: dwsubc
 
  Click to reply to this thread Reply

Below is how I used Bill's idea to allow me to turn various parts of my scene invisible. For instance, to make the positive X half of the universe invisible, call mc.setEnable(0, true); You can combine these calls to show quarters or eigths as well.

I can now show cross sections, cutaways and segments of my scene. Very cool.

Dave


//Create Model Clip
ModelClip mc = new ModelClip();
mc.setCapability(ModelClip.ALLOW_ENABLE_WRITE);
boolean enables[] = { false, false, false, false, false, false };
mc.setEnables(enables);
Vector4d vector4d = new Vector4d(1.0, 0.0, 0.0, 0.0);// +X
mc.setPlane(0, vector4d);
mc.setEnable(0, false);
vector4d = new Vector4d(-1.0, 0.0, 0.0, 0.0);// -X
mc.setPlane(1, vector4d);
mc.setEnable(1, false);
vector4d = new Vector4d(0.0, 1.0, 0.0, 0.0);// +Y
mc.setPlane(2, vector4d);
mc.setEnable(2, false);
vector4d = new Vector4d(0.0, -1.0, 0.0, 0.0);// -Y
mc.setPlane(3, vector4d);
mc.setEnable(3, false);
vector4d = new Vector4d(0.0, 0.0, 1.0, 0.0);// +Z
mc.setPlane(4, vector4d);
mc.setEnable(4, false);
vector4d = new Vector4d(0.0, 0.0, -1.0, 0.0);// -Z
mc.setPlane(5, vector4d);
mc.setEnable(5, false);
mc.setInfluencingBounds(bounds);
objRoot.addChild(mc);




 XML java.net RSS