Horde3D http://horde3d.org/forums/ |
|
Frustum Culling in Horde http://horde3d.org/forums/viewtopic.php?f=2&t=723 |
Page 1 of 2 |
Author: | tmart [ 01.05.2009, 11:16 ] |
Post subject: | Frustum Culling in Horde |
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. |
Author: | Volker [ 01.05.2009, 13:09 ] |
Post subject: | Re: Frustum Culling in Horde |
The AABBs should be updated automatically. Can you provide a sample to allow us reproducing the faulty behavior? |
Author: | tmart [ 03.05.2009, 09:30 ] |
Post subject: | Re: Frustum Culling in Horde |
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 ); 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? |
Author: | Volker [ 03.05.2009, 09:47 ] |
Post subject: | Re: Frustum Culling in Horde |
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. |
Author: | tmart [ 03.05.2009, 11:39 ] |
Post subject: | Re: Frustum Culling in Horde |
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 Missing claw |
Author: | Volker [ 03.05.2009, 11:48 ] |
Post subject: | Re: Frustum Culling in Horde |
Can you provide the geometry file? |
Author: | tmart [ 03.05.2009, 21:51 ] |
Post subject: | Re: Frustum Culling in Horde |
Here's the .geo for my arm http://wwwcsif.cs.ucdavis.edu/~martint/clawarmleft.geo |
Author: | marciano [ 06.05.2009, 06:48 ] |
Post subject: | Re: Frustum Culling in Horde |
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). |
Author: | tmart [ 07.05.2009, 09:18 ] |
Post subject: | Re: Frustum Culling in Horde |
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. |
Author: | marciano [ 07.05.2009, 18:52 ] |
Post subject: | Re: Frustum Culling in Horde |
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"/> |
Author: | tmart [ 07.05.2009, 20:36 ] |
Post subject: | Re: Frustum Culling in Horde |
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... |
Author: | Volker [ 07.05.2009, 20:50 ] |
Post subject: | Re: Frustum Culling in Horde |
So you are not using Beta3? In this case replace the skinning shader with the standard shader. |
Author: | tmart [ 07.05.2009, 21:19 ] |
Post subject: | Re: Frustum Culling in Horde |
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? |
Author: | Volker [ 07.05.2009, 21:27 ] |
Post subject: | Re: Frustum Culling in Horde |
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 |
Author: | tmart [ 07.05.2009, 21:37 ] |
Post subject: | Re: Frustum Culling in Horde |
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); |
Page 1 of 2 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |