Horde3D

Next-Generation Graphics Engine
It is currently 28.09.2024, 22:29

All times are UTC + 1 hour




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Frustum Culling in Horde
PostPosted: 01.05.2009, 11:16 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
Hi there,

I am trying to write an Inverse Kinematics program and consequently I need to change the rotation of bones often. However, it seems after I call "Horde3D::setNodeTransformMatrix(boneNodeHandle, matrix)" frustum culling no longer works correctly on my scene. Parts of my arm model disappear when they should still be onscreen. All I have is one arm with 3 bones in scene. It only takes one call to this function to mess up the frustum culling. The original loading and rendering pre-call to setNodeTranformMatrix doesn't exhibt this issue. Also when I view the scene in debug view "Horde3D::setOption( EngineOptions::DebugViewMode, _debugViewMode ? 1.0f : 0.0f );" I don't have the problem of disappear bones. Do I need to recalculate the AABB or something? If so, how do I do that? Is there another way to accomplish my objective?

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: 01.05.2009, 13:09 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
The AABBs should be updated automatically. Can you provide a sample to allow us reproducing the faulty behavior?


Top
 Profile  
Reply with quote  
PostPosted: 03.05.2009, 09:30 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
Sure. Thanks for looking.

Code:
_arm = Horde3D::addNodes( RootNode, robotArmRes );  // initalize node for arm
NodeHandle _firstNode = Horde3D::getNodeChild(_arm,0);
Horde3D::setNodeTransformMatrix(_firstNode, transfromMatrix1);    // update first joint
_firstNode = Horde3D::getNodeChild(_firstNode,0);
Horde3D::setNodeTransformMatrix(_firstNode, transformMatrix2);    // update second joint

I'm updating transformation matrices whenever the arm moves naturally

Here's how I setup my camera:
Code:
_cam = Horde3D::addCameraNode( RootNode, "Camera", _forwardPipeRes );
  Horde3D::setupCameraView( _cam, 45.0f, 800.0/600.0, 0.1f, 1000.0f );


I've attached two pictures that show a discrepancy between normal and debug view after I've updated the joint transformation matrix. I use this to initiate debug view
Code:
Horde3D::setOption( EngineOptions::DebugViewMode, _debugViewMode ? 1.0f : 0.0f );


Image
Image

As you can see even though the arm has been updated the engine is not recognizing this. Any suggestions?
Here are the steps I used to make my arm model in Maya...in case I'm specifying joints incorrectly
1. Make primitives
2. Make joints along arm
3. Bind joints to primitives
4. Export

Here's the robotArm.scene.xml that is generated for this model upon export

Code:
<Model name="clawarmleft" geometry="clawarmleft.geo">
  <Joint name="joint1" rx="-0" ry="180" rz="0" jointIndex="1">
    <Joint name="joint2" tx="4" ty="0" tz="0" jointIndex="2">
       <Joint name="joint3" tx="4" ty="0" tz="0" jointIndex="3">
          <Joint name="joint4" tx="1.7" ty="0" tz="0" jointIndex="4" />
       </Joint>
     </Joint>
  </Joint>
  <Mesh name="polySurface8" material="clawarmleft/lambert3.material.xml" batchStart="0" batchCount="24" vertRStart="0" vertREnd="8">
      <Mesh name="polySurface8" material="clawarmleft/lambert2.material.xml" batchStart="24" batchCount="876" vertRStart="9" vertREnd="223" />
  </Mesh>
  <Mesh name="polySurface9" material="clawarmleft/lambert2.material.xml" batchStart="900" batchCount="2280" vertRStart="224" vertREnd="662" />
  <Mesh name="polySurface10" material="clawarmleft/lambert2.material.xml" batchStart="3180" batchCount="2520" vertRStart="663" vertREnd="1145" />
  <Mesh name="polySurface11" material="clawarmleft/lambert2.material.xml" batchStart="5700" batchCount="2280" vertRStart="1146" vertREnd="1584" />
  <Mesh name="polySurface12" material="clawarmleft/lambert2.material.xml" batchStart="7980" batchCount="2520" vertRStart="1585" vertREnd="2067" />
  <Mesh name="polySurface13" material="clawarmleft/lambert3.material.xml" batchStart="10500" batchCount="210" vertRStart="2068" vertREnd="2136">
     <Mesh name="polySurface13" material="clawarmleft/lambert2.material.xml" batchStart="10710" batchCount="2070" vertRStart="2137" vertREnd="2531" />
  </Mesh>
</Model>


Sorry thats a bit ugly....

It seems to me that the joints are not individual nodes in the normal sense. How can I make this model so that the joints are individual nodes while still binding the mesh of my model to the joints?


Top
 Profile  
Reply with quote  
PostPosted: 03.05.2009, 09:47 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
The different view in debug and normal mode is probably a result of hardware skinning. If the skinning is performed by the GPU, the debug view won't display the skinned version but the raw mesh data. You can disable hardware skinning and use software skinning instead. In this case the debug view should show the same transformed mesh as you can see it in the normal rendering view.

Another thing that might be a problem is the usage of getNodeChild. Unless you are sure that the first child node is the joint you want to transform, you might want to use findNodes to search for all nodes of type SceneNodeTypes::Joint

Quote:
It seems to me that the joints are not individual nodes in the normal sense. How can I make this model so that the joints are individual nodes while still binding the mesh of my model to the joints?

Not sure what you mean with that, but joints are normal scene graph nodes.


Top
 Profile  
Reply with quote  
PostPosted: 03.05.2009, 11:39 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
OK here are two pictures of the problem that is being exhibited. The first is the full arm as you can see the "claw", last joint of the arm, is being displayed. However when I rotate my camera about 10 degrees right, shown in the second picture, the "claw" disappears although it should still be in-frame. The complete model for this arm is composed of several primitive meshes in Maya (can be seen in scene.xml). The claw is one of these primitives. I did not join all these primitives into one mesh before adding joints and exporting. Still I think this shouldn't affect the frustum culling. As I continue to rotate the camera right these individual primitives continue to disappear one-after-another before they are completely off-screen. Oddly this problem of disappearing primitives does not occur if I start at the right most primitive, the "shoulder," and rotate the camera to the left.

Full arm
Image

Missing claw
Image


Top
 Profile  
Reply with quote  
PostPosted: 03.05.2009, 11:48 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Can you provide the geometry file?


Top
 Profile  
Reply with quote  
PostPosted: 03.05.2009, 21:51 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
Here's the .geo for my arm

http://wwwcsif.cs.ucdavis.edu/~martint/clawarmleft.geo


Top
 Profile  
Reply with quote  
PostPosted: 06.05.2009, 06:48 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Could you try to use software skinning? With hardware skinning (on the GPU) the model's bounding boxes are not updated appropriately (needs to be fixed in the fututre by finding a maximum bounding box). Software skinning is just a Model node parameter but make sure to have the GPU skinning flag disabled in your material, else the skinning is applied two times (once on the CPU and again on the GPU).


Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 09:18 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
OK I added this line

Code:
Horde3D::setNodeParami(_arm, ModelNodeParams::SoftwareSkinning, 1);


right after adding a node for the arm model. The bounding box of the arm is still not updated correctly. How do I set the GPU skinning flag to "disabled" in the material.xml? I've not familiarized myself with the pipeline yet. Thanks.


Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 18:52 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
tmart wrote:
How do I set the GPU skinning flag to "disabled" in the material.xml?

Open the material files that are used by your model (in the same directory as the model) and remove the line <ShaderFlag name="_F01_Skinning"/>


Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 20:36 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
That line isnt in my material.xml

Here's what is

- <Material>
<Shader source="skinning.shader.xml" />
<TexUnit unit="0" map="armpicture.jpg" />
</Material>


I used Maya 2008 for content creation. I've tried removing he <shader source> tag but that causes nothing to appear on screen...


Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 20:50 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
So you are not using Beta3? In this case replace the skinning shader with the standard shader.


Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 21:19 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
OK that worked. Unfortunately now my changes to the bones transformation matrices no longer have any effect....in normal or debug mode. I'm using the "forward.pipeline.xml". Does this matter?


Last edited by tmart on 07.05.2009, 21:28, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 21:27 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
In your call:
Code:
Horde3D::setNodeParami(_arm, ModelNodeParams::SoftwareSkinning, 1);

is _arm the handle of the model? Which version of Horde3D are you using. Software skinning was introduced in Beta1


Top
 Profile  
Reply with quote  
PostPosted: 07.05.2009, 21:37 
Offline

Joined: 17.02.2009, 21:21
Posts: 17
I'm using Beta2. I have another object in my scene which I can translate around. It's just a sphere with no joints. That object responds to my calls to setNodeTransform (im using the standard.shader.xml for software skinning), while my arm does not.

Yes "_arm" is the nodeHandle of the arm model.
_arm= Horde3D::addNodes( RootNode, robotArmRes );
Horde3D::setNodeParami(_arm, ModelNodeParams::SoftwareSkinning, 1);


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group