Disappearing Quads OBB

Hi ,

I have a problems with dissapearing Quads , hope that someone can help me with this coz I don't know whats wrong.

I have some Quads in my scene and I use to bound them with BoundingBox and it was working great until I needed to put one in Diagonal . when I do that the bounding box don't get rotate with the object but get wider to keep it all in one box ,since I test the bounding box of the object with the Camera box in order to stop the camera from moving though objects I can get close to the Quad since its in the BOX, so after searching the Forum I've got the OBB solution.

I've change the Quad boundingBoxes into OBB and it did solved the problem but started a differant problems.

now when I in a certain angle to the Quads it's get disappear from the view (and I can go right through it).

I've searched the forum for similar problems and I got some posts that talks about dissapearing objects but non of the solutions worked for me (CULL_NEVER stops the dissapearing but I still can go right through it and I think using CULL_VEVER will reduse performance) .

Is anyone here has some Ideas about whats going on?

HELP please

thanks

Just a guess, but maybe a 0 width OBB is formed causing problems with picking calcs?

renanse said:

Just a guess, but maybe a 0 width OBB is formed causing problems with picking calcs?

First thanks for the fast reply :)
now I try to understand what you mean ,what can I do so  0 width obb won't be formed? I don't see a way to change the width of the obb.
is that mean that I cannot use the obb and a Quad ?
if that true then how can I workaround the Diagonal box boundaries in a quad ??
renanse said:

Just a guess, but maybe a 0 width OBB is formed causing problems with picking calcs?

Hi ,
I've wrapped the Quads with a box (tried a several widths ) but the results are the same , so I don't think it's a 0 width OBB.
any Ideas ?
Moshe

just a wild guess, did you call updateModelBound() after setting the BoundingBox ?

Core-Dump said:

just a wild guess, did you call updateModelBound() after setting the BoundingBox ?

sure thing :)  I may be lame ;) but not THAT lame LOL.
but thanks anyhow , any Idea no matter hoe lame can help me.
I'm thinking now it's pure OBB related issue since the Box also disappeared .
I've read in some posts here that it has some issues , I'm trying to write a test scenario in order to see what exactly is going on
Moshe
Core-Dump said:

just a wild guess, did you call updateModelBound() after setting the BoundingBox ?

Hi , I rechecked just to be sure and I did use updateModelBound.
However  I do see a connection to the modelBound .
all my quads are inside a node (with some other objects)  , and it seems that this node's bounderined are not quite at the right place they should be (seems a little shifted to the side) and whenever I cross this bounderies the quad is disappearing
Moshe

hmm maybe you can try to reproduce the problem with a small SimpleGame test case.

Core-Dump said:

hmm maybe you can try to reproduce the problem with a small SimpleGame test case.


Hi , thanks for the attention
o.k I managed to reproduce it in a simple game :)
and I have the same thing!! from some reason OBB that is being formed around all the node is not accurate at all.
you can see in the scene (if you press B to see the boundaries ) that the left Quad is half outside the boundaries, and when I turn the camera around, so it passes the boundaries , the quad is disappearing (as it should :) ).
so , what is going on here ? am I missing something ? Am I doing something wrong ?
I use the updateModelBound and I even tried to use it on the root but it made no difference , note that if I use BoundingBox the boundaries that is being formed are set correctly.
BTW how do I add screenShots here?

here is the Code :


import com.jme.app.SimpleGame;
import com.jme.bounding.OrientedBoundingBox;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.SharedMesh;
import com.jme.scene.shape.Quad;


public class Test extends SimpleGame{

   /**
    * @param args
    */

   public static void main(String[] args) {
      Test t = new Test();
      t.setDialogBehaviour(SimpleGame.NEVER_SHOW_PROPS_DIALOG);
      t.start();
      
   }

   protected void simpleInitGame() {

      //


Creating the nodes
      Node hall = new Node("Hall");
      Node store = new Node("store");
      Node rightWindow = new Node("rightWindow");
      Node leftWindow = new Node("leftWindow");
      Node wall = new Node("Wall");
       
      //
Creating objects
      // Init Base Mesh for quad
      Quad quadBaseMesh ;
      quadBaseMesh = new Quad("quadBaseMesh");
      quadBaseMesh.initialize(1, 1);
      quadBaseMesh.setLocalTranslation(.5f, .5f, 0.5f);      
      quadBaseMesh.setModelBound(new OrientedBoundingBox());
      quadBaseMesh.updateModelBound();
      
      hall.attachChild(store);
      store.attachChild(wall);
      store.attachChild(leftWindow);
      store.attachChild(rightWindow);
            
      //
  right window
      SharedMesh qRightWindow = new SharedMesh("qRightWindow",quadBaseMesh);
      qRightWindow.setModelBound(new OrientedBoundingBox());
      qRightWindow.updateModelBound();
      rightWindow.attachChild(qRightWindow);      
      // Transformations
      rightWindow.setLocalTranslation(new Vector3f(183,0,156));
      rightWindow.setLocalScale(new Vector3f(75,45,1));      
      float angle =45;   
      Vector3f rotateVector = new Vector3f(0,1,0);      
      Quaternion quaternion = new Quaternion();         
      quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
      rightWindow.setLocalRotation(quaternion);                  
      
      //
left window
      SharedMesh qleftWindow = new SharedMesh("qLeftWindow",quadBaseMesh);
      qleftWindow.setModelBound(new OrientedBoundingBox());
      qleftWindow.updateModelBound();
      leftWindow.attachChild(qleftWindow);
      // Transformations
      leftWindow.setLocalTranslation(new Vector3f(103,0,236));
      leftWindow.setLocalScale(new Vector3f(75,45,1));      
      angle =45;   
      rotateVector = new Vector3f(0,1,0);      
      quaternion = new Quaternion();         
      quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
      leftWindow.setLocalRotation(quaternion);            
      
      //
wall
      SharedMesh qwall = new SharedMesh("qwall",quadBaseMesh);
      qwall.setModelBound(new OrientedBoundingBox());
      qwall.updateModelBound();
      wall.attachChild(qwall);
      // Transformations
      wall.setLocalTranslation(new Vector3f(240,0,0));
      wall.setLocalScale(new Vector3f(95,100,1));      
      angle =-90;   
      rotateVector = new Vector3f(0,1,0);      
      quaternion = new Quaternion();         
      quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
      wall.setLocalRotation(quaternion);            
      
      
      cam.setLocation(new Vector3f(200,5,350));
        rootNode.attachChild(hall);                
   }         
}



hmm strange i don't know why it works with BoundingBox but not with a OrientedBoundingBox.

Core-Dump said:

hmm strange i don't know why it works with BoundingBox but not with a OrientedBoundingBox.


IC , well that makes 2 of us.
anyhow , thanks for the help :)
maybe someone else will figure it out.
Moshe
moshad said:

Core-Dump said:

hmm maybe you can try to reproduce the problem with a small SimpleGame test case.


Hi , thanks for the attention
o.k I managed to reproduce it in a simple game :)
and I have the same thing!! from some reason OBB that is being formed around all the node is not accurate at all.
you can see in the scene (if you press B to see the boundaries ) that the left Quad is half outside the boundaries, and when I turn the camera around, so it passes the boundaries , the quad is disappearing (as it should :) ).
so , what is going on here ? am I missing something ? Am I doing something wrong ?
I use the updateModelBound and I even tried to use it on the root but it made no difference , note that if I use BoundingBox the boundaries that is being formed are set correctly.
BTW how do I add screenShots here?

here is the Code :


import com.jme.app.SimpleGame;
import com.jme.bounding.OrientedBoundingBox;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.SharedMesh;
import com.jme.scene.shape.Quad;


public class Test extends SimpleGame{

   /**
    * @param args
    */

   public static void main(String[] args) {
      Test t = new Test();
      t.setDialogBehaviour(SimpleGame.NEVER_SHOW_PROPS_DIALOG);
      t.start();
      
   }

   protected void simpleInitGame() {

      //


Creating the nodes
      Node hall = new Node("Hall");
      Node store = new Node("store");
      Node rightWindow = new Node("rightWindow");
      Node leftWindow = new Node("leftWindow");
      Node wall = new Node("Wall");
       
      //
Creating objects
      // Init Base Mesh for quad
      Quad quadBaseMesh ;
      quadBaseMesh = new Quad("quadBaseMesh");
      quadBaseMesh.initialize(1, 1);
      quadBaseMesh.setLocalTranslation(.5f, .5f, 0.5f);      
      quadBaseMesh.setModelBound(new OrientedBoundingBox());
      quadBaseMesh.updateModelBound();
      
      hall.attachChild(store);
      store.attachChild(wall);
      store.attachChild(leftWindow);
      store.attachChild(rightWindow);
            
      //
  right window
      SharedMesh qRightWindow = new SharedMesh("qRightWindow",quadBaseMesh);
      qRightWindow.setModelBound(new OrientedBoundingBox());
      qRightWindow.updateModelBound();
      rightWindow.attachChild(qRightWindow);      
      // Transformations
      rightWindow.setLocalTranslation(new Vector3f(183,0,156));
      rightWindow.setLocalScale(new Vector3f(75,45,1));      
      float angle =45;   
      Vector3f rotateVector = new Vector3f(0,1,0);      
      Quaternion quaternion = new Quaternion();         
      quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
      rightWindow.setLocalRotation(quaternion);                  
      
      //
left window
      SharedMesh qleftWindow = new SharedMesh("qLeftWindow",quadBaseMesh);
      qleftWindow.setModelBound(new OrientedBoundingBox());
      qleftWindow.updateModelBound();
      leftWindow.attachChild(qleftWindow);
      // Transformations
      leftWindow.setLocalTranslation(new Vector3f(103,0,236));
      leftWindow.setLocalScale(new Vector3f(75,45,1));      
      angle =45;   
      rotateVector = new Vector3f(0,1,0);      
      quaternion = new Quaternion();         
      quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
      leftWindow.setLocalRotation(quaternion);            
      
      //
wall
      SharedMesh qwall = new SharedMesh("qwall",quadBaseMesh);
      qwall.setModelBound(new OrientedBoundingBox());
      qwall.updateModelBound();
      wall.attachChild(qwall);
      // Transformations
      wall.setLocalTranslation(new Vector3f(240,0,0));
      wall.setLocalScale(new Vector3f(95,100,1));      
      angle =-90;   
      rotateVector = new Vector3f(0,1,0);      
      quaternion = new Quaternion();         
      quaternion.fromAngleAxis(angle*FastMath.DEG_TO_RAD , rotateVector );
      wall.setLocalRotation(quaternion);            
      
      
      cam.setLocation(new Vector3f(200,5,350));
        rootNode.attachChild(hall);                 
   }         
}






anyone ?

Sorry i also have no idea,  i tried several things like use normal quads instead of sharedmeshes and putting everything under 1 node.



Hellmaster

Hellmaster said:

Sorry i also have no idea,  i tried several things like use normal quads instead of sharedmeshes and putting everything under 1 node.

Hellmaster

First thanks for the Help.
now it seems to me that this is a bug right? the OBB definitely should not act this way.
I think it has something to do with the rotation (Quaternion )  since when I don't use it , the OBB is formed correctly.
so if this is really a Bug then I intend to drill down to the OBB code to figure this out , If anyone from the developers knows whats going on please let me know.
Thanks
Moshe
moshad said:

Hellmaster said:

Sorry i also have no idea,  i tried several things like use normal quads instead of sharedmeshes and putting everything under 1 node.

Hellmaster

First thanks for the Help.
now it seems to me that this is a bug right? the OBB definitely should not act this way.
I think it has something to do with the rotation (Quaternion )  since when I don't use it , the OBB is formed correctly.
so if this is really a Bug then I intend to drill down to the OBB code to figure this out , If anyone from the developers knows whats going on please let me know.
Thanks
Moshe

Hi , I was trying to get into the code , but i'm loosing my way inside .
Is there a place that I could read about the OrientedBoundingBox notion , the Math behind it ? an article something that could help me understand ?

ppl any help here ?!?!  :frowning:

Hi everyone , please isn't anyone here knows what seems to be the problem with the OBB ???

is there a workaround ?

how come no one had this issua before?

thanks

moshe

hi moshad. I am sorry that noone has replied yet… I am unable to help you with this problem… but I am sure someone can… I think you need the help of some dev, but well… they are few and far in between :slight_smile:



I suggest rename your thread… add [Dev help required] or similar… perhaps that would get some attention…



But in the end… it is possible you will have to dig through this alone… with LOTs of reading… good luck dude…

Or you could also enter an issue on the google code issue tracker, so that the problem isn't getting lost in the forum.

I guess there is some debugging to be done to resolve this problem.

IC . well thanks anyhow :slight_smile: , this are a good ideas so you've help me