New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StaticGeometry gets double the Root SceneNode transform #2510
Comments
how about setting ogre/OgreMain/src/OgreStaticGeometry.cpp Line 1368 in bc3221a
|
I'm not sure if I understand. I'm not familiar with the getWorldTransforms() function but I'm only seeing it being called from BillboardSet and AutoParamDataSource. Would that get called while creating the StaticGeometry or while rendering it? If while rendering, then it would ignore the Root Node's current transform and only use what was baked in. If the transform on the Root node changes after the StaticGeometry is made, it would not track with the rest of the Scene. While creating the the StaticGeometry, StaticGeometry::addSceneNode() calls Node::_getDerivedPosition(), Node::_getDerivedOrientation(), and Node::_getDerivedScale()), all of which (may) call _updateFromParent() and it recurses up the tree. |
yes, this.
thats kind of the premise of StaticGeometry. If any intermediate node changes, StaticGeometry would not reflect that either |
Fair enough. Can we avoid applying any transforms at all while rendering or do we have to pass something to the GPU? Out of curiosity can you point me to the rendering code that calls getWorldTransforms()? I haven't been able to find it. |
what your write from that function gets almost directly passed to the GPU - e.g. here: ogre/OgreMain/src/OgreGpuProgramParams.cpp Line 1864 in 5f06d69
|
I see, thank you. Returning What about culling? Will it still use the Root node's transform while culling? |
Yes. I dont know all the paths that culling takes off the top of my head. Overriding _notifyCurrentCamera will disable culling by the far plane altogether. |
given that transforms on the root scene node have no observable effect, I am inclined to just warn about this now and ignore any root scene node transform in a future release. Did you have any particular reason to do that transform? |
My models use negative Y as up so I was using the same convention with the lights and cameras in the Scene. Then I integrated the recast/detour library and it assumes positive Y as up so as a quick and easy way to have the coordinates match, I just rotated the Root. But I can just flip things over when I set up the scene. I agree with you, I think it would make more sense if the Root node could NOT be transformed. |
System Information
Detailled description
When StaticGeometry is created using StaticGeometry::addSceneNode(), each Entity is queued along with its derived transform. That bakes the Root SceneNode's transform into the geometry. Then when StaticGeometry::build() calls Region::build(), it creates its Node as a child of the Root SceneNode. This results in the Root SceneNode's transform being applied twice.
Not sure best way to fix:
The text was updated successfully, but these errors were encountered: