CLOD + models

Hi all!



I`am bulding a virtual city demo. I have a number of building models (from google scketchup, he-he) in collada format.

I would like to show all of them using CLOD feature. So, I’am loading a model (for example this one), making a ClodAreaMesh for each Trimesh in the model with:


        private Node getClodNodeFromParent(Node meshParent) {
      Node clodNode = new Node("New clod node");
      for (int i = 0; i < meshParent.getQuantity(); i++) {
         final Spatial child = meshParent.getChild(i);

         if (child instanceof Node) {
            clodNode.attachChild(getClodNodeFromParent((Node) child));
         } else if (child instanceof TriMesh) {
            AreaClodMesh acm = new AreaClodMesh("part" + i, (TriMesh) child, null);

            acm.setModelBound(new BoundingSphere());
            acm.updateModelBound();

            acm.setTrisPerPixel(0.1f);

            acm.setDistanceTolerance(5);
            acm.setCullHint(Spatial.CullHint.Dynamic);

            acm.setTextureCombineMode(child.getTextureCombineMode());
            acm.setRenderState(child.getRenderState(StateType.Texture));
            acm.setRenderState(child.getRenderState(StateType.Light));
            acm.setRenderState(child.getRenderState(StateType.Material));

            acm.setTargetRecord(1);

            clodNode.attachChild(acm);
         } else {
         }
      }
      clodNode.setModelBound(new BoundingBox());
      clodNode.updateModelBound();

      clodNode.setNormalsMode(meshParent.getNormalsMode());
      clodNode.setLocalTranslation(meshParent.getLocalTranslation());
      clodNode.setLocalRotation(meshParent.getLocalRotation());
      clodNode.setLocalScale(meshParent.getLocalScale());

      return clodNode;
   }


(the code has been found on this forum and modified to save scales, rotations/transformations and textures)

After all of this I can't see any difference in model while zooming/unzooming. I believe the detalization of this model should significantly fall down while unzooming, but it isn't so. Why?
Should the model be somehow prepared or something?

I've tried the model from the tests - statue.ace and it works exactly as I expect. What is the difference between them?

Thanks!

I'm not an expert (rather noob) but i'd would guess it has something to do how AreaClodMesh decides to reduce. If your model only has a few vertices then AreaClodMesh will nearly never remove one because the necessary vertices per pixel rate is never reached.



Maybe try to set different levels of reduction:



// Allow 1/2 of a triangle in every pixel on the screen in

// the bounds.

acm.setTrisPerPixel(.5f); <— much smaller value like 0.001 or something.