Coder Social home page Coder Social logo

Comments (6)

MrDChristop avatar MrDChristop commented on September 17, 2024

there is a predefined scaling. But depending on the units your models were modeled this might have to change this. There is a -s flag for this. For example my models are done in inches i use a "-s 2.54" ion the converter commandline to convert from inches to cm. USDZ is always specified in cm especially for AR.
So if you models are in cm then you will have as you say put in a 1 as scale.

I dont think this a converter issue unless you do can do proper verification analysing the format files. I propose the following.

  1. Open the GLTF and note the hierarchy and what scales are in there for each node.
  2. Convert to usda using "-s 1" and open it in a text editor. note the hierarchy and see if the scales are different.
  3. Convert to usdz using '-s 1" then extract the usdz. Convert the usdc to usda using "usdcat" form pixars USDTools and verify again as described above.

if the scales dont match then the gltf2usdz converter has a problem, report the gltf file and the procedure to recreate this. If they match then there is no problem but its your viewers problem.

from gltf2usd.

wave-electron avatar wave-electron commented on September 17, 2024

Thankyou for those suggestion.

I’ll reproduce some test files, and post them for further analysis. :)

from gltf2usd.

wave-electron avatar wave-electron commented on September 17, 2024

@MrDChristop @kcoley It took me sometime trying to reproduce these gltf/usd test files. It's also a tricky issue to fix, which is why I thought it was important to flag it in the first place.

This is how the input GLTF file (previews in https://sandbox.babylonjs.com) which matches the original scene in Blender.

gltf

You get this usdz result when the mesh positions were not set to (0,0,0) & scale (1,1,1) under the root hierarchy. I haven't had time to cross reference the usda and GLTF file for why the conversion doesn't match the original. I just know how to fix it at the moment so it doesn't occur.

usdz

test_files_scale_issue.zip

In order to fix the issue the root hierarchy is set to (0,0,0) & scale(1,1,1) for the root in the original before I convert to gltf2.

fixed_scale

from gltf2usd.

kcoley avatar kcoley commented on September 17, 2024

@wave-electron thanks for flagging this. At first I thought it was related to a transform as well as animated transforms appending to each other, so I tried removing all transform operations which worked for the cubes.

But that led to the plane being problematic. I’m not sure if it is an issue with the USD decompose transform code that I am using to decompose a transform matrix into individual translation, rotation and scale components, but the transform operation ends up being different than the original composed transform matrix (the plane end scene up vertical when decomposed but horizontal when using the original transform matrix). I didn’t have too much time to play with this last night, but I will try something out tonight to see if it will be more consistent.

from gltf2usd.

kcoley avatar kcoley commented on September 17, 2024

@wave-electron I think I understand what is happening here. The transform node is getting applied to the keyframed positions, which is causing the cubes to get an additional transform operation. Also, quaternion rotations are being ignored, so is causing some confusion in the final positions.

A potential solution I will test is to have all animation keyframes represented as transformation matrices instead of scale, rotate and translate attributes.

from gltf2usd.

kcoley avatar kcoley commented on September 17, 2024

@wave-electron I just merged a fix for this. It had to do with applying both the animation positions and the node positions from glTF to the same xform, which causes transform issues in usd.

from gltf2usd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.