apple / ml-hypersim

Hypersim: A Photorealistic Synthetic Dataset for Holistic Indoor Scene Understanding
Other
1.71k stars 131 forks source link

Camera positions in world-space confusion #29

Closed dgriffiths3 closed 3 years ago

dgriffiths3 commented 3 years ago

Hi,

I am trying to render my own scenes in blender using the camera positions stored in camera_keyframe_orientations.hdf5. From my understanding these are in asset coordinates. So, for scene ai_002_002 the first camera position is [221.9, 75.0, 190.4].

How I would convert this into the world coordinates blender is using? Is this even a known transform, or does blender make its own arbitrary coordinate system for its world space?

mikeroberts3000 commented 3 years ago

Hi!

I have a few questions. Is there a typo in your message? Do you mean that you are using the positions stored in camera_keyframe_positions.hdf5? Where are you obtaining triangle meshes to render in Blender?

I'm not an expert with Blender. But our asset coordinates are simply the world coordinates defined by the artist when they originally created the scenes in 3ds Max. So, assuming that your Blender coordinate system is the same as the artist's original 3ds Max coordinate system, you should be able to set the camera position in Blender to be identical to the camera position defined in camera_keyframe_positions.hdf5.

To help debug things, here are several places to look in our code.

I hope that helps. If you're still stuck, create a follow-up post in this thread with a bit more detail about what you want to do, why you think it should work, the investigation and debugging you've done so far, "everything is working until step X, but things are clearly not working at step Y", etc.

dgriffiths3 commented 3 years ago

Hi, thanks for the quick reply!

Yes that was a typo indeed, I mean the positions file. Okay that clears things about a lot. I should be able to set the camera positions. I have access to the original assets, although they have been pre-prepared into .blend files by a 3rd party. I wasn't sure if there was a world space and asset space and some transformation between them. But from what I gather now, the world space and asset space are the same thing.

My guess is that either blender has created its own fantasy units, or the 3rd party did some scaling / shifting.

Thanks!

mikeroberts3000 commented 3 years ago

I think your hypothesis is correct. Blender or this third party must be performing some kind of coordinate transformation (e.g., swapping the y and z coordinates or something).

Indeed, the kind of mystery conversion you're grappling with is exactly why we introduced the concept of asset coordinates in our documentation. Unfortunately, mystery conversions are so common when converting assets between 3D content creation tools, that we felt like the term world coordinates was too ambiguous. Do we mean world coordinates in 3ds Max? Or world coordinates in Blender? Do we mean world coordinates after scaling to meters? Or before scaling to meters? We wanted a name that means whatever the artist originally defined prior to any conversions, and we settled on asset coordinates. Maybe canonical artist-defined world coordinates would have been a better name 😅