java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Java3D arrow How to implement LOD Animation by DistanceLOD class
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4089
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to implement LOD Animation by DistanceLOD class E-mail
User Rating: / 0
PoorBest 

Level of Detail (LOD) is a general term for a technique that varies the amount of detail in a visual object based on some value from the virtual world. The typical application is to vary the level of detail based on the distance to the viewer.As the distance to a visual object increases, the fewer details will appear in the rendering.

The DistanceLOD Class provides LOD behavior based on distance to the viewer.

Here is the usage recipe for DistanceLOD class:

  1. create a target Switch object(s) with ALLOW_SWITCH_WRITE capability
  2. create list of distance thresholds array for the DistanceLOD object
  3. create DistanceLOD object using the distance thresholds array
  4. set the target switch object for the DistanceLOD object
  5. supply a scheduling bounds (or bounding leaf) for the DistanceLOD object
  6. assemble the scene graph, including adding children to target Switch object(s)

Image

Image

public BranchGroup createSceneGraph() {

     BranchGroup objRoot = new BranchGroup();
     BoundingSphere bounds = new BoundingSphere();

     // create target TransformGroup with Capabilities
     TransformGroup objMove = new TransformGroup();
 
     // create DistanceLOD target object
     Switch targetSwitch = new Switch();
     targetSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);

     // add visual objects to the target switch 
     targetSwitch.addChild(new Sphere(.40f025));
     targetSwitch.addChild(new Sphere(.40f015));
     targetSwitch.addChild(new Sphere(.40f010));
     targetSwitch.addChild(new Sphere(.40f04));

     // create DistanceLOD object
     float[] distances = 5.0f10.0f20.0f};
     DistanceLOD dLOD = new DistanceLOD(distances, new Point3f());
     dLOD.addSwitch(targetSwitch);
     dLOD.setSchedulingBounds(bounds);
   
     // assemble scene graph
     objRoot.addChild(objMove);
     objMove.addChild(dLOD)// make the bounds move with object
     objMove.addChild(targetSwitch)// must add switch to scene graph
  
     return objRoot;
}

 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.