01-23-2020, 11:16 AM
Related to my question in https://forum.ab4d.com/showthread.php?tid=4169
How can I dynamically change the model transform for a CustomRenderableNode. For example I have numerous point clouds displayed using CustomRenderableNode, each having an initial transform.
So far I have looked at the ShadedPointCloudSample, where a Transform3D is assigned to the SceneNodeVisual3D, e.g... in AddPointCloudNode()
So for each point cloud, I assign the initial 'transform' and this works great.
But later when I want to change the Model transform, I have tried setting 'transform' to be a MatrixTransform3D and changing the Matrix property, and also reassigning the SceneNodVisual3D Transform.
These changes do not seem to propagate through to the RenderAction.
Could you please advise what is the most suitable procedure to control the Model transform used for rendering of the CustomRenderableNode? Should I be doing this around the example code in RenderAction...
I have had a play around trying to set the customRenderableNode.Transform but the display was completely mangled. I didn't look into that too deeply in case I was completely going off track.
Also for my understanding, how is the SceneNodeVisual3D Transform applied, is this only used for an initialisation of another Transformation used by the Custom renderer?
Many thanks in advance.
How can I dynamically change the model transform for a CustomRenderableNode. For example I have numerous point clouds displayed using CustomRenderableNode, each having an initial transform.
So far I have looked at the ShadedPointCloudSample, where a Transform3D is assigned to the SceneNodeVisual3D, e.g... in AddPointCloudNode()
Code:
var sceneNodeVisual3D = new SceneNodeVisual3D(customRenderableNode);
sceneNodeVisual3D.Transform = transform;
So for each point cloud, I assign the initial 'transform' and this works great.
But later when I want to change the Model transform, I have tried setting 'transform' to be a MatrixTransform3D and changing the Matrix property, and also reassigning the SceneNodVisual3D Transform.
These changes do not seem to propagate through to the RenderAction.
Could you please advise what is the most suitable procedure to control the Model transform used for rendering of the CustomRenderableNode? Should I be doing this around the example code in RenderAction...
Code:
SharpDX.Matrix worldViewProjectionMatrix = renderingContext.UsedCamera.GetViewProjection();
if (customRenderableNode.Transform != null && !customRenderableNode.Transform.IsIdentity)
worldViewProjectionMatrix = customRenderableNode.Transform.Value * worldViewProjectionMatrix;
I have had a play around trying to set the customRenderableNode.Transform but the display was completely mangled. I didn't look into that too deeply in case I was completely going off track.
Also for my understanding, how is the SceneNodeVisual3D Transform applied, is this only used for an initialisation of another Transformation used by the Custom renderer?
Many thanks in advance.