Closed trevorld closed 2 years ago
That's an issue in rgl
: when you rotate the object with the mouse or view3d()
, you are actually rotating the object, not your view of it. Normally the viewer stays in a fixed location, and the lights are in a fixed direction.
You can change the observer location using observer3d
. Changing the lights would require they be deleted and recreated.
Calling view3d(0,0)
before writing to a file would be a good idea if this matters to you. I don't think it should happen automatically in rgl2gltf
, because I think most users would want the orientation of the object to be the same as what they saw in R. I don't know if this happens with external viewers, but I try to make it happen if you export and import the scene back into R.
Thanks for the explanation!
I don't know if this happens with external viewers, but I try to make it happen if you export and import the scene back into R.
I have observed that this does indeed happen with many external glTF viewers
Calling
view3d(0,0)
before writing to a file would be a good idea if this matters to you. I don't think it should happen automatically inrgl2gltf
, because I think most users would want the orientation of the object to be the same as what they saw in R.
Okay, this matters for my intended use cases (creating visual assets for import into Godot and Unity that may be mixed with other external assets) but manually adding in a view3d(0,0)
is a pretty easy thing to do.
I could be completely misunderstanding what is happening or "should" be happening...
When I call
writeGLB()
after variousview3d()
calls and look at the exported mesh in a glTF viewer which shows some "physical" grid lines indicating where the meshes are "physically" I'm noting that the meshes seem to be "physically" rotated based on a precedingview3d()
call with non-zero anglesview3d()
call (but instead perhaps some kind of "camera view" might be rotated)babylon
Javascript viewer is an example which can add visual "physical" grid lines on a single plane (click on "Debug" and then "Render grid" and manually rotate mesh with mouse): https://sandbox.babylonjs.com/godot
"editor" 3D asset importer is another example that adds vector arrows along positive x, y, and z axes: https://godotengine.org/Current workaround to avoid such rotations would be to simply to explicitly do a
view3d(0, 0)
before export...Screenshot from Babylon viewer of
scene_t0_p45.glb
with grid enabled showing that the mesh exported after callingview3d(theta = 0, phi = 45)
is "physically" rotated 45 degrees from the plane