As you can see, the second screenshot show a clearly missing part of the model, after a very small rotation of the camera:
http://www.htp.it/modules/htp.tsite/publications/274023
http://www.htp.it/modules/htp.tsite/publications/274031
All item in scene are loaded from one .jme file, with bound specified:
reader.setProperty(“bound”,“box”);
This is the state-related code:
m_stateCull = m_display.getRenderer().createCullState();
m_stateCull.setCullMode(CullState.CS_BACK);
m_stateCull.setEnabled(true);
setRenderState(m_stateCull);
m_stateWireframe = m_display.getRenderer().createWireframeState();
m_stateWireframe.setEnabled(false);
setRenderState(m_stateWireframe);
/** This allows correct blending of text and what is already rendered below it*/
m_stateAlpha = m_display.getRenderer().createAlphaState();
m_stateAlpha.setBlendEnabled(true);
m_stateAlpha.setSrcFunction(AlphaState.SB_SRC_ALPHA);
m_stateAlpha.setDstFunction(AlphaState.DB_ONE);
m_stateAlpha.setTestEnabled(true);
m_stateAlpha.setTestFunction(AlphaState.TF_GREATER);
m_stateAlpha.setEnabled(true);
//setRenderState(m_stateAlpha);
/** Create a ZBuffer to display pixels closest to the camera above farther ones. /
m_stateZBuffer = m_display.getRenderer().createZBufferState();
m_stateZBuffer.setEnabled(true);
m_stateZBuffer.setFunction(ZBufferState.CF_LEQUAL);
setRenderState(m_stateZBuffer);
/* Attach the light to a lightState and the lightState to rootNode. /
AmbientLight defLight = new AmbientLight();
defLight.setAmbient(ColorRGBA.white);
defLight.setEnabled(true);
m_stateLight= m_display.getRenderer().createLightState();
m_stateLight.setEnabled(true);
m_stateLight.attach(defLight);
setRenderState(m_stateLight);
/* Update geometric and rendering information for both the rootNode and fpsNode. */
updateGeometricState(0.0f, true);
updateRenderState();
Camera ‘frame’:
com.jme.math.Vector3f v3fdirCamera = new com.jme.math.Vector3f(0.0f,0.0f,-1.0f);
com.jme.math.Vector3f v3fupCamera = new com.jme.math.Vector3f(0.0f,1.0f,0.0f);
com.jme.math.Vector3f v3fleftCamera = new com.jme.math.Vector3f(-1.0f,0.0f,0.0f);
I need help, I can’t see where the error is…
What kind of bounding is being used in the scene? Also, have you tried turning on bounds viewing? Finally, do the stairs come back if you rotate back… in other words, is the disappear/reappear predictable?
To me it sounds/looks like a bounds culling issue.
Be sure to check the camera settings to insure you are in a right handed coordinate system.
Sorry, was me…
to Mojomonk: camera is setted that way:
v3fdirCamera = new com.jme.math.Vector3f(0.0f,0.0f,-1.0f);
v3fupCamera = new com.jme.math.Vector3f(0.0f,1.0f,0.0f);
v3fleftCamera = new com.jme.math.Vector3f(-1.0f,0.0f,0.0f);
It's the same setup as the test, if i'm not wrong..
edit: forgot, yes appearing/disapperaign are absolutely predictable (not random in any way, geometry reappears and disappears always at the same position/angle)
Yeah, it definitely looks like an issue with bounds… like there is a disconnect between world and local coordinate systems or something. Maybe it’s an issue with the model conversion to jME… If the conversion process was loading bounds info or setting it wrong or something of that ilk. Can you give us a demo to try?
Preparing the demo, i discovered that the model bounds are ok, so it’s a problem of my code… ://
And i think i found it:
in my scene, i’have a root node, an intermediate node, and the model,
with the model child of intermediate node, and this one child of the root;
On the intermediate node i was calling:
Scene_Node.setLocalRotation( new com.jme.math.Quaternion(0.0f,0.0f,0.0f,0.0f));
if i change to:
float[] fRotAxis = new float[] {0.0f,00f,0.0f};
Scene_Node.setLocalRotation( new com.jme.math.Quaternion(fRotAxis));
it works… in my very poor understanding of quaternions, i was thinking that 0,0,0,0 was a no-rotation, while it seems that 0,0,0,1 is the right one.
Thanks for the help
Ah yep… the identity Quat is 0,0,0,1. So your original app works now?
Yes, now it works… Just a question, why the ‘0,0,0,0,’ quat has that ‘distorting’ effect only on the bounding box ? the model is in it’s right place…
Just an artifact of bounds generation I’m sure.