Converted GLB Model Rotation

Hello,

I am currently working on a project that involves converting many parts within a single JT file to individual GLB files. I have written code to create all the GLBs, and I have code to put the GLBs together to view the rebuilt JT model.

The issue I am facing now is that the GLB files I create have a different rotation. So the ‘front’ of any original JT model becomes the ‘bottom’ of the rebuilt GLB model. Any idea why that would be?

I have tried setting a new rotation in several ways, mostly trying to apply a -90 degrees to the z-index. I’ve tried setting the rotation of the rootnode in a few different places like this:

scene.RootNode.Transform.EulerAngles = new Vector3(0, 0, 90);

But that doesn’t do anything. Are there other ways I can try to set the rotation of the GLBs I make?

@ajharf

Would you kindly share your sample source and output file(s) with us so that we can test the scenario in our environment and address it accordingly.

@ajharf
Can you share what’s the version of Aspose.3D are you using?

I am using Aspose.3d 24.6.0 for .net . I’m not able to share the JT files I’m working with, but they are JT 9.5.

I can’t show the models, but I view the JTs / GLBs with CAD Assistant:
image.png (14.7 KB)
The first image is the orientation of my original JT facing front
image.png (11.0 KB)
The second image is Where I have to move the orientation so the model is facing its front

I want to write code to rotate the root of the GLB to fit that orientation. I have tried some things with Transform like my original post, but nothing changed.

This can be replicated with code like this:

public static void SaveAsGLB(string inputJTFile, string outputPath)
  {
    var scene = Scene.FromFile(inputJTFile);
    scene.Save(outputPath + "converted.glb");
  }

The converted GLB will have a different rotation from its original JT, the ‘front’ of the JT becomes the ‘bottom’ of the GLB

@ajharf

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): THREEDNET-1575

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@ajharf
Have you tried the old version?
We have changed internal implementation of calculating rotation in 24.6 due to some reasons.

Our JT files only work with aspose.3d 24.5.0 and later versions, i could try 24.5 instead

I’m not sure if I’m even setting the rotation correctly, but what I’ve tried so far hasn’t rotated the model at all

@ajharf

Your feedback has been recorded under the logged ticket. We will reach out you once we have some updates.

@ajharf
Make changes on root node’s transform won’t work at all.

How is it behave in 24.5 ? The 24.5 still uses the old implementation of rotation calculation.

24.5 does not work also.

I wonder if I’m doing something wrong, but these are the main ways I’ve tried to set rotation:

scene.RootNode.Transform.EulerAngles = new Vector3(0, 0, -90);
scene.RootNode.Transform.Rotation = new Quaternion(0, 0, -0.8509035, 0.525322);

nothing seems to happen

@ajharf
It won’t work, root node usually don’t get exported.

A temporary work around should be apply transformation to each node under root node.

We have an internal utility to convert axis system, we can expose it in the next version (24.8).

This worked for me! Transforming the children of the rootnode allowed my rotations to apply correctly.

n.Transform.EulerAngles = new Vector3(-90, 0, 0);

For tracking purposes, this is the transformation required to set our GLBs back to their normal orientation.

You may have to double check with other JT files, but my experience has been that saving JT to GLB conversions causes the GLB models to have a 90 degree X axis rotation applied to them (Based on EulerAngles).

I appreciate all the help with this!

@ajharf
You’re welcome, we’ve already provided axis system option in some file format’s save option classes, which is used to do manually axis system conversion during the saving.

We can also provide this in GLTF/GLB in the future if needed, especially used in the JT to GLB conversion, because the JT’s specification did not mention a valid axis/coordinate system for JT file.