Distortion occurs when the mesh is moved from the world coordinate system to another non-uniformly scaled mesh

page: A Basic Scene | Babylon.js Playground (babylonjs.com)
Is there a way to fix this situation? blender doesn’t have the same problem.

cc @Cedric our maths wizard, but I think we would need to support shear in our transformations to make it work…

@xiehangyun
First, Blender has the same ‘problem’. It’s not really a problem whe you now it happens.
Here is the result with 2 parent boxes:

Then, it’s the 3rd open thread today related to the same issue. Please keep the 1st one open so we can discuss progress on it and close the other. Thanks in advance.


blender also distorts scaling after dragging a node into the parent node, but does not distort without dragging. The distortion is reasonable, I just want to be able to drag in without distortion.

I am not sure to understand, if your model is under a node with scaling it is expected to be scaled as well I am trying to understand the issue ?

My understanding is that the parent and child nodes with different rotational attitudes scale in different directions, which is why the distortion occurs. This is normal. But moving from world coordinates to local coordinates creates distortions that visually give the wrong impression.

It do not think to do wihout adding extra nodes to counteract the effect of the main ones.

@Cedric what do you think ?

This has been discussed in other threads with you I think @xiehangyun .
In case of non uniform scaling:
As a workaround, add a transient nodetransform that will be modified by the gizmo and applied the rotation on the mesh.
Improvement will be done after 6.0 release because it has potential implications on Node, TransformNode and matrix hierarchy.
Anyways, you’ll the same deformation as with Blender. The only change that will be fixed is the ability to use rotation gizmo with non uniform scaling and updateGizmoRotationToMatchAttachedMesh set to true.

1 Like

I see. I’d like to have a sample page. Thank you very much.

1 Like

Hi. I think i have found some sort of “workaround” for this. I have attached a playground with the example and what i did in my forum post:

There might be other cases i am ignoring but this seems to work so far.

2 Likes

Thanks for the reply, the case you provided really works. The distortion of child nodes appears to be affected only by the scaling and rotation of the direct parent node. This is good news.
A Basic Scene | Babylon.js Playground (babylonjs.com)
I previously mistakenly thought that node.parent = parentNode is equivalent to node.setParent(parnetNode) and failed to find this problem.

Glad i could be of help. Be careful though. Rotating the top-level parent can also cause distortion for certain orientations if you rotate it before adding the children nodes. That is why i also had to add some lines to set the top level parent rotation to zero, add the children and then change back the rotation to its original value.

Thanks for the tip. Now this hidden danger has also been eliminated.
A Basic Scene | Babylon.js Playground (babylonjs.com)