コード例 #1
0
  @Deprecated
  public void addAmbientLight(Color3f color) {
    AmbientLight ambientLight = new AmbientLight(color);
    ambientLight.setInfluencingBounds(getSettings().getRenderSettings3D().getBounds());

    getScene().addChild(ambientLight);
    getLogger().info("Light (ambient) added to scene.");
  }
コード例 #2
0
ファイル: Scene3D.java プロジェクト: TeMPOraL/Sparkle
 private void setSceneAppearance() {
   AmbientLight lightA = new AmbientLight();
   lightA.setColor(new Color3f(255, 0, 100));
   _contents.addChild(lightA);
   Background background = new Background();
   background.setColor(EnvSettings.BACKGROUND_COLOR);
   _bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 0.1);
   background.setApplicationBounds(_bounds);
   _contents.addChild(background);
 }
コード例 #3
0
  public void lightScene(Bounds bounds) {
    AmbientLight ambient = new AmbientLight(GameColors.LIGHT_COLOR);
    ambient.setInfluencingBounds(bounds);
    branchGroup.addChild(ambient);

    Vector3f lightDirection = new Vector3f(0.0f, -1.0f, 0.0f);
    DirectionalLight direct1 = new DirectionalLight(GameColors.LIGHT_COLOR, lightDirection);
    direct1.setInfluencingBounds(bounds);
    branchGroup.addChild(direct1);
  }
コード例 #4
0
ファイル: ComplexViewer.java プロジェクト: hkb/IKChainTree
  private BranchGroup createSceneGraph() {
    BranchGroup root = new BranchGroup();
    root.setCapability(BranchGroup.ALLOW_DETACH);
    createSpinTG();
    root.addChild(spin);

    SimpleBehavior myRotationBehavior = new SimpleBehavior(spin);
    myRotationBehavior.setSchedulingBounds(new BoundingSphere());
    root.addChild(myRotationBehavior);

    KeyNavigatorBehavior behavior = new KeyNavigatorBehavior(spin);
    BoundingSphere bounds = new BoundingSphere();
    behavior.setSchedulingBounds(bounds);
    root.addChild(behavior);

    // mouse-directed rotation
    MouseRotate rotator = new MouseRotate(spin);
    rotator.setSchedulingBounds(bounds);
    root.addChild(rotator);

    // mouse-based translation
    MouseTranslate translator = new MouseTranslate(spin);
    translator.setSchedulingBounds(bounds);
    root.addChild(translator);

    // mouse-directed zoom
    MouseZoom zoom = new MouseZoom();
    zoom.setSchedulingBounds(bounds);
    root.addChild(zoom);

    // make background blue
    Background background = new Background(Colors.blue);
    background.setApplicationBounds(bounds);
    root.addChild(background);

    // light
    AmbientLight light = new AmbientLight(true, new Color3f(Color.red));
    light.setInfluencingBounds(bounds);
    root.addChild(light);
    PointLight ptlight =
        new PointLight(new Color3f(Color.red), new Point3f(0f, 0f, -5f), new Point3f(1f, 0f, 0f));
    ptlight.setInfluencingBounds(bounds);
    root.addChild(ptlight);
    PointLight ptlight2 =
        new PointLight(
            new Color3f(Color.orange), new Point3f(-2f, 2f, 2f), new Point3f(1f, 0f, 0f));
    ptlight2.setInfluencingBounds(bounds);
    root.addChild(ptlight2);

    // let Java3d perform optimization on this scene graph
    root.compile();
    return root;
  }
コード例 #5
0
ファイル: Java3DViewer.java プロジェクト: alexeyivanov/FEM
  public void createSceneGraph(DrawModel drawing) {
    // Branch group which can be deattached for changing scene;
    view = new BranchGroup();
    view.setCapability(BranchGroup.ALLOW_DETACH);
    // BranchGroup for rotation
    rotation = new TransformGroup();
    rotation.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    rotation.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
    view.addChild(rotation);
    bounds = new BoundingSphere();
    DirectionalLight lightD = new DirectionalLight();
    lightD.setDirection(new Vector3f(0.0f, 0.0f, -0.7f));
    lightD.setInfluencingBounds(bounds);
    view.addChild(lightD);

    AmbientLight lightA = new AmbientLight();
    lightA.setInfluencingBounds(bounds);
    view.addChild(lightA);

    Background background = new Background();
    background.setColor(1.0f, 1.0f, 1.0f);
    background.setApplicationBounds(bounds);
    view.addChild(background);

    //		MouseRotate myMouseRotate = new MouseRotate();
    //        myMouseRotate.setTransformGroup(rotation);
    //        myMouseRotate.setSchedulingBounds(bounds);
    //        root.addChild(myMouseRotate);
    //
    //        MouseTranslate myMouseTranslate = new MouseTranslate();
    //        myMouseTranslate.setTransformGroup(rotation);
    //        myMouseTranslate.setSchedulingBounds(new BoundingSphere());
    //        root.addChild(myMouseTranslate);

    //        MouseZoom myMouseZoom = new MouseZoom();
    //        myMouseZoom.setTransformGroup(rotation);
    //        myMouseZoom.setSchedulingBounds(new BoundingSphere());
    //        root.addChild(myMouseZoom);
    //
    PickMouse pick = new PickMouse(this, view, bounds);
    view.addChild(pick);

    addKeyListener(new KeyListener());

    angleV = (float) Math.PI / 4;
    angleH = (float) Math.PI / 5;

    draw(drawing);
    zoomAll();
  }
コード例 #6
0
ファイル: IfcVisualiser.java プロジェクト: joojump/BIMserver
  private void addLights(BranchGroup transformGroup) {
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100000.0);

    AmbientLight ambientLight = new AmbientLight(new Color3f(0.5f, 0.5f, 0.5f));
    ambientLight.setInfluencingBounds(bounds);
    transformGroup.addChild(ambientLight);

    Color3f lightColor = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
    DirectionalLight light1 = new DirectionalLight(true, lightColor, light1Direction);
    light1.setInfluencingBounds(bounds);
    transformGroup.addChild(light1);

    light1Direction.negate();
    DirectionalLight light2 = new DirectionalLight(true, lightColor, light1Direction);
    light2.setInfluencingBounds(bounds);
    transformGroup.addChild(light2);
  }
コード例 #7
0
ファイル: KainCorak.java プロジェクト: danurwenda/JB4
  public void prepareCorak(
      String projectPath, CorakLSystem cor, CorakDataObject obj, boolean encloseOBJ) {

    this.projectPath = projectPath;

    // initiate our "turtle" -> Canting
    canting = new Canting(cor, obj);

    // start creating shapes based on Cor
    timer = System.currentTimeMillis();
    canting.generate(encloseOBJ);

    BoundingSphere lightingBounds = new BoundingSphere(new Point3d(0, 0, 0), FARTHEST);
    camLamp = new PointLight();
    camLamp.setCapability(PointLight.ALLOW_POSITION_READ);
    camLamp.setCapability(PointLight.ALLOW_POSITION_WRITE);
    camLamp.setColor(new Color3f(1.0f, 1.0f, 1.0f));
    camLamp.setInfluencingBounds(lightingBounds);

    ambient = new AmbientLight();
    ambient.setColor(new Color3f(1.0f, 1.0f, 1.0f));
    ambient.setInfluencingBounds(lightingBounds);

    canting.getBatikBG().addChild(camLamp);
    canting.getBatikBG().addChild(ambient);

    // attach generated shapes to root TransformGroup
    Enumeration kaintgchildren = kainTG.getAllChildren();
    while (kaintgchildren.hasMoreElements()) {
      Node child = (Node) kaintgchildren.nextElement();
      if (child instanceof Measurer) {
        ((Measurer) child).removeAllChildren();
      } else {
        kainTG.removeChild(child);
      }
    }
    //        canting.getBatikBG().compile();
    kainTG.addChild(canting.getBatikBG());

    timer = System.currentTimeMillis() - timer;
    // System.out.println("Timer= " + timer);

    bs = (BoundingSphere) canting.getBatikBG().getBounds();
  }
コード例 #8
0
  // Some light is added to the scene here.
  public void addLight(SimpleUniverse su) {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), Double.MAX_VALUE);

    // Directional light.
    Color3f lightColour = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f lightDir = new Vector3f(1.0f, -1.0f, -1.0f);
    DirectionalLight light = new DirectionalLight(lightColour, lightDir);
    light.setInfluencingBounds(bounds);
    bgLight.addChild(light);

    // Ambient light.
    Color3f ambientLightColour = new Color3f(0.5f, 0.5f, 0.5f);
    AmbientLight ambLight = new AmbientLight(ambientLightColour);
    ambLight.setInfluencingBounds(bounds);
    bgLight.addChild(ambLight);

    su.addBranchGraph(bgLight);
  }
コード例 #9
0
  // Directional light rotating around the scene and some ambient light.
  public void addLight(SimpleUniverse su) {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), Double.MAX_VALUE);

    // Directional light (to be rotated).
    Color3f lightColour = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f lightDir = new Vector3f(0.0f, 0.0f, -1.0f);
    DirectionalLight light = new DirectionalLight(lightColour, lightDir);
    light.setInfluencingBounds(bounds);

    // The transformation group for the directional light and its rotation.
    TransformGroup tfmLight = new TransformGroup();
    tfmLight.addChild(light);

    // The Alpha for the rotation.
    Alpha alphaLight = new Alpha(-1, 4000);
    // The rotation
    RotationInterpolator rot =
        new RotationInterpolator(
            alphaLight, tfmLight, new Transform3D(), 0.0f, (float) Math.PI * 2);
    rot.setSchedulingBounds(bounds);

    tfmLight.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tfmLight.addChild(rot);

    bgLight.addChild(tfmLight);

    // Ambient light.
    Color3f ambientLightColour = new Color3f(0.5f, 0.5f, 0.5f);
    AmbientLight ambLight = new AmbientLight(ambientLightColour);
    ambLight.setInfluencingBounds(bounds);
    bgLight.addChild(ambLight);

    su.addBranchGraph(bgLight);
  }
コード例 #10
0
 /** Creates the objects on the scene, adds behavior effects and so on. */
 public void addChildren() {
   BranchGroup group = new BranchGroup(); // Root group of the applet.
   Appearance ap = new Appearance(); // Configurate a material for the branch.
   Material mat = new Material();
   mat.setAmbientColor(new Color3f(43 / 255f, 23 / 255f, 5 / 255f)); // Brown.
   ap.setMaterial(mat);
   TransformGroup tg =
       new TransformGroup(); // This will actually store all leaf nodes because we want them to
   // rotate with mouse movements.
   tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
   tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
   BranchShape bs =
       new BranchShape(
           new Branch(
               6,
               0f,
               -0f,
               0.9f,
               new Random(1253312432),
               6,
               0.1f,
               new Point3f(0, -2, 0),
               new Vector3f(0, 1, 0),
               0),
           ap,
           0,
           10);
   bs.addChildren(10, 0.5f, 0.2f, 0.3f, 0.3f, 0.5f, 4, -0.3f, 0.3f, 0.1f, 1.2f, ap);
   tg.addChild(bs);
   bs =
       new BranchShape(
           new Branch(
               6,
               0.0f,
               -0.0f,
               0.9f,
               new Random(125462432),
               6,
               0.1f,
               new Point3f(0, -2, 0),
               new Vector3f(0, 1, 0),
               0),
           ap,
           0,
           10);
   bs.addChildren(10, 0.5f, 0.2f, 0.3f, 0.3f, 0.5f, 4, -0.3f, 0.3f, 0.1f, 1.2f, ap);
   tg.addChild(bs);
   bs =
       new BranchShape(
           new Branch(
               6,
               0.0f,
               -0.0f,
               0.9f,
               new Random(3755678),
               6,
               0.1f,
               new Point3f(0, -2, 0),
               new Vector3f(0, 1, 0),
               0),
           ap,
           0,
           10);
   bs.addChildren(10, 0.5f, 0.2f, 0.3f, 0.3f, 0.5f, 4, -0.3f, 0.3f, 0.1f, 1.2f, ap);
   tg.addChild(bs);
   bs =
       new BranchShape(
           new Branch(
               6,
               0.0f,
               -0.0f,
               0.9f,
               new Random(8765683),
               6,
               0.1f,
               new Point3f(0, -2, 0),
               new Vector3f(0, 1, 0),
               0),
           ap,
           0,
           10);
   bs.addChildren(10, 0.5f, 0.2f, 0.3f, 0.3f, 0.5f, 4, -0.3f, 0.3f, 0.1f, 1.2f, ap);
   tg.addChild(bs);
   // Four branches initialized by three different roots for Random.
   MouseRotate mr = new MouseRotate(tg);
   mr.setSchedulingBounds(new BoundingSphere(new Point3d(), 100));
   mr.setFactor(0.005, 0.001); // Slow rotation.
   tg.addChild(mr);
   group.addChild(tg);
   Color3f light1Color =
       new Color3f(1f, 1f, 1f); // Just to see the model, as a temporary solution.
   BoundingSphere bounds = new BoundingSphere(new Point3d(), 100);
   AmbientLight light1 = new AmbientLight(light1Color);
   light1.setInfluencingBounds(bounds); // Some more j3d magic.
   group.addChild(light1);
   universe.addBranchGraph(group);
 }
コード例 #11
0
  //
  //  Build scene
  //
  public Group buildScene() {
    // Turn off the example headlight
    setHeadlightEnable(false);

    // Build the scene group
    Group scene = new Group();

    // Build foreground geometry into two groups.  We'll
    // create three directional lights below, one each with
    // scope to cover the first geometry group only, the
    // second geometry group only, or both geometry groups.
    content1 =
        new SphereGroup(
            0.25f, // radius of spheres
            1.5f, // x spacing
            0.75f, // y spacing
            3, // number of spheres in X
            5, // number of spheres in Y
            null); // appearance
    scene.addChild(content1);

    content2 =
        new SphereGroup(
            0.25f, // radius of spheres
            1.5f, // x spacing
            0.75f, // y spacing
            2, // number of spheres in X
            5, // number of spheres in Y
            null); // appearance
    scene.addChild(content2);

    // BEGIN EXAMPLE TOPIC
    // Create influencing bounds
    BoundingSphere worldBounds =
        new BoundingSphere(
            new Point3d(0.0, 0.0, 0.0), // Center
            1000.0); // Extent

    // Add three directional lights whose scopes are set
    // to cover one, the other, or both of the shape groups
    // above.  Also set the lights' color and aim direction.

    // Light #1 with content1 scope
    light1 = new DirectionalLight();
    light1.setEnable(light1OnOff);
    light1.setColor(Red);
    light1.setDirection(new Vector3f(1.0f, 0.0f, -1.0f));
    light1.setInfluencingBounds(worldBounds);
    light1.addScope(content1);
    light1.setCapability(Light.ALLOW_STATE_WRITE);
    scene.addChild(light1);

    // Light #2 with content2 scope
    light2 = new DirectionalLight();
    light2.setEnable(light2OnOff);
    light2.setColor(Blue);
    light2.setDirection(new Vector3f(1.0f, 0.0f, -1.0f));
    light2.setInfluencingBounds(worldBounds);
    light2.addScope(content2);
    light2.setCapability(Light.ALLOW_STATE_WRITE);
    scene.addChild(light2);

    // Light #3 with universal scope (the default)
    light3 = new DirectionalLight();
    light3.setEnable(light3OnOff);
    light3.setColor(White);
    light3.setDirection(new Vector3f(1.0f, 0.0f, -1.0f));
    light3.setInfluencingBounds(worldBounds);
    light3.setCapability(Light.ALLOW_STATE_WRITE);
    scene.addChild(light3);

    // Add an ambient light to dimly illuminate the rest of
    // the shapes in the scene to help illustrate that the
    // directional lights are being scoped... otherwise it looks
    // like we're just removing shapes from the scene
    AmbientLight ambient = new AmbientLight();
    ambient.setEnable(true);
    ambient.setColor(White);
    ambient.setInfluencingBounds(worldBounds);
    scene.addChild(ambient);
    // END EXAMPLE TOPIC

    return scene;
  }
コード例 #12
0
ファイル: MapCanvas3D.java プロジェクト: orlanthi/healpix
  /**
   * principal method used to configure the java3D model of the sky.
   *
   * @return a BranchGroup with the model contents.
   */
  protected BranchGroup createSceneGraph() {
    // ##### Transform Groups ################
    // Create the transform group node and initialize it to the
    // identity. Enable the TRANSFORM_WRITE capability so tha
    // our behavior code can modify it at runtime.
    objTrans = new TransformGroup();
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    objTrans.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
    objTrans.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
    objTrans.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);

    // #### Grid ########################################
    if (this.showGrid) {
      gridGroup = new BranchGroup();
      gridGroup.setCapability(BranchGroup.ALLOW_DETACH);
      Group3DSphere sphereRaster = new Group3DSphere(12, 24);
      Appearance sphereRasterApp = new Appearance();
      ColoringAttributes sphereRasterColor = new ColoringAttributes();
      sphereRasterColor.setColor(0.0f, 0.41176f, 0.80f); // royal blue
      sphereRasterApp.setColoringAttributes(sphereRasterColor);
      sphereRaster.setAppearance(sphereRasterApp);
      gridGroup = new BranchGroup();
      gridGroup.addChild(sphereRaster);
      objTrans.addChild(gridGroup);
    }
    // ##### Equator ########################
    equatorGroup = new BranchGroup();
    equatorGroup.setCapability(BranchGroup.ALLOW_DETACH);

    Group3DCircle equator = new Group3DCircle(EQUATOR_RADIUS, EQUATOR_RES);
    Appearance equatorApp = equator.getAppearance();

    ColoringAttributes equatorColor = new ColoringAttributes();
    equatorColor.setColor(new Color3f(java.awt.Color.YELLOW));
    equatorApp.setColoringAttributes(equatorColor);

    LineAttributes eqLine = new LineAttributes();
    eqLine.setLineWidth(3.0f);
    equatorApp.setLineAttributes(eqLine);

    equator.setAppearance(equatorApp);
    equatorGroup.addChild(equator);
    objTrans.addChild(equatorGroup);
    // ######################################

    // ##### Axis ###########################
    axisGroup = new Group3DAxis();
    axisGroup.setCapability(BranchGroup.ALLOW_DETACH);
    objTrans.addChild(axisGroup);
    // ######################################

    objScale = new TransformGroup();
    objScale.addChild(objTrans);

    // ##### root of the branch graph #######
    BranchGroup objRoot = new BranchGroup();
    objRoot.setCapability(BranchGroup.ALLOW_DETACH);
    objRoot.addChild(objScale);
    // ######################################

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), BOUNDINGSPHERE_RADIUS);

    // ##### Background #####
    Background bgNode = new Background(new Color3f(java.awt.Color.BLACK));
    bgNode.setApplicationBounds(bounds);
    objRoot.addChild(bgNode);
    // ######################################

    // ##### Lighting #######################
    // Set up the ambient ligh
    AmbientLight ambientLightNode = new AmbientLight();
    ambientLightNode.setInfluencingBounds(bounds);
    objRoot.addChild(ambientLightNode);
    // ######################################
    // ##### Behaviour ######################
    // Create the rotate behavior node
    // MouseRotateY behavior = new MouseRotateY();
    MouseRotate behavior = new MouseRotate();
    behavior.setTransformGroup(objTrans);
    objTrans.addChild(behavior);
    behavior.setSchedulingBounds(bounds);

    // Create the zoom behavior node
    zoom = new MouseZoom();
    zoom.setTransformGroup(objTrans);
    objTrans.addChild(zoom);
    zoom.setSchedulingBounds(bounds);

    // Create the translate behavior node
    MouseTranslate behavior3 = new MouseTranslate();
    behavior3.setTransformGroup(objTrans);
    objTrans.addChild(behavior3);
    behavior3.setSchedulingBounds(bounds);

    // Auto rotator
    Transform3D axis = new Transform3D();
    axis.set(new AxisAngle4f(0, 0, 1, 2)); // theta,x,y,z.
    Alpha mover = new Alpha(0, ALPHA_INC_DURATION); // loop count, period
    rotator = new RotationInterpolator(mover, objTrans);
    rotator.setTransformAxis(axis);
    rotator.setSchedulingBounds(bounds);
    objTrans.addChild(rotator);

    return objRoot;
  }
コード例 #13
0
ファイル: DefaultUniverse.java プロジェクト: philjord/3DTools
  public DefaultUniverse() {
    super(
        createVWorldPlatform(),
        new Viewer(new Canvas3D(SimpleUniverse.getPreferredConfiguration())));

    // some useful parts of this universe
    // Viewer viewer = getViewer();
    // ViewingPlatform viewingPlatform = getViewingPlatform();
    // View view = viewer.getView();
    // ViewPlatform viewPlatform = viewingPlatform.getViewPlatform();
    // TransformGroup viewTransGroup = getViewingPlatform().getViewPlatformTransform();

    // set up the view
    getViewer().getView().setFrontClipPolicy(View.VIRTUAL_EYE);
    getViewer().getView().setBackClipDistance(BACK_CLIP);
    getViewer().getView().setFrontClipDistance(FRONT_CLIP);
    // set max frame rate to 50 so server can get in
    getViewer().getView().setMinimumFrameCycleTime(2);

    // TODO: I believe I can remove these calls
    PlatformGeometry pg = new PlatformGeometry();
    pg.setCapability(Group.ALLOW_CHILDREN_EXTEND);
    getViewingPlatform().setPlatformGeometry(pg);

    getViewer().createAudioDevice();

    // set capabilities for the various branch groups
    mainSceneGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
    mainSceneGroup.setCapability(Group.ALLOW_CHILDREN_WRITE);
    environmentGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
    environmentGroup.setCapability(Group.ALLOW_CHILDREN_WRITE);
    behaviorGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
    behaviorGroup.setCapability(Group.ALLOW_CHILDREN_WRITE);
    terrainGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
    terrainGroup.setCapability(Group.ALLOW_CHILDREN_WRITE);
    terrainGroup.setCapability(BranchGroup.ALLOW_DETACH);
    terrainGroup.setUserData("Terrain Group");

    // initialise the sound system
    // SoundEngine mt = new SoundEngine();
    // behaviorGroup.addChild(mt);

    // put a sky in place
    sky.setApplicationBounds(Utils3D.defaultBounds);
    environmentGroup.addChild(sky);

    // Create ambient light	and add it
    Color3f alColor = new Color3f(0.6f, 0.6f, 0.6f);
    ambLight = new AmbientLight(true, alColor);
    ambLight.setCapability(Light.ALLOW_INFLUENCING_BOUNDS_WRITE);
    ambLight.setInfluencingBounds(Utils3D.defaultBounds);
    environmentGroup.addChild(ambLight);

    // Create sun light and add it
    Color3f slColor = new Color3f(1.0f, 1.0f, 1.0f);
    sunLight = new DirectionalLight(slColor, new Vector3f(0.2f, -1.0f, -0.2f));
    sunLight.setCapability(Light.ALLOW_INFLUENCING_BOUNDS_WRITE);
    sunLight.setInfluencingBounds(Utils3D.defaultBounds);
    environmentGroup.addChild(sunLight);

    // Add the fog
    fog.setCapability(Fog.ALLOW_INFLUENCING_BOUNDS_WRITE);
    environmentGroup.addChild(fog);

    nightClip.setApplicationBounds(Utils3D.defaultBounds);
    fogClip.setApplicationBounds(Utils3D.defaultBounds);
    nightClipGroup.addChild(nightClip);
    nightClipGroup.setCapability(BranchGroup.ALLOW_DETACH);
    fogClipGroup.addChild(fogClip);
    fogClipGroup.setCapability(BranchGroup.ALLOW_DETACH);

    // initialise the rain model
    // Color3f rainColor = new Color3f(0.6f, 0.6f, 0.65f);
    // Vector3f windVector = new Vector3f(0.2f, 0f, 0f);
    // rainyModel = new RainyArea(14, 0, 25000, rainColor, 4.5f, 0.8f, 50, windVector, 80f, 80f,
    // 20f, 20000);
    // rainyModel.hoverOver(getViewingPlatform().getViewPlatformTransform());
    // environmentGroup.addChild(rainyModel);

    mainSceneGroup.setCapability(BranchGroup.ALLOW_DETACH);
    environmentGroup.setCapability(BranchGroup.ALLOW_DETACH);
    behaviorGroup.setCapability(BranchGroup.ALLOW_DETACH);

    addBranchGraph(mainSceneGroup);
    addBranchGraph(environmentGroup);
    addBranchGraph(behaviorGroup);
    addBranchGraph(terrainGroup);
  }