donmccurdy / three-gltf-viewer

Drag-and-drop preview for glTF 2.0 models in WebGL using three.js.
https://gltf-viewer.donmccurdy.com/
MIT License
2.06k stars 530 forks source link

Initialization angle problem #340

Closed hcxmj closed 1 year ago

hcxmj commented 1 year ago

Hello author, when I load and render a gltf/glb model, I find that the initial angle problem is not the front one. It seems that the effect is more like the perspective viewed from the upper right corner. If you want to initialize it, you will see the front view. How to adjust the angle of view? The following are comparison screenshots of the same model opened on the gltf-viewr website and other websites:

image image
donmccurdy commented 1 year ago

Hi @hcxmj! The initial viewing angle is a subjective choice. In some cases, viewing from an angle can be preferable for aesthetic or UX reasons. In particular, a flat model like a map tile might be completely invisible from the front, and it'd be very difficult for my viewer to detect whether that's a concern.

If you're looking for more features here, I'd suggest trying my more advanced viewer at https://gltf.report/, which gives you buttons to jump to the front/back/... views:

Screenshot 2023-06-07 at 11 22 11 PM

This viewer (https://gltf-viewer.donmccurdy.com/) is more of an example than a fully-featured tool, so I'm intentionally keeping it pretty simple.

hcxmj commented 1 year ago

Hi @hcxmj! The initial viewing angle is a subjective choice. In some cases, viewing from an angle can be preferable for aesthetic or UX reasons. In particular, a flat model like a map tile might be completely invisible from the front, and it'd be very difficult for my viewer to detect whether that's a concern.

If you're looking for more features here, I'd suggest trying my more advanced viewer at https://gltf.report/, which gives you buttons to jump to the front/back/... views:

Screenshot 2023-06-07 at 11 22 11 PM

This viewer (https://gltf-viewer.donmccurdy.com/) is more of an example than a fully-featured tool, so I'm intentionally keeping it pretty simple.

Ok, thank you very much, I moved this set of code to the mobile terminal for use, and it needs to be set up according to the product requirements. When I change the position of the camera, I find that the effect is strange, so I ask here and hope to get a solution

donmccurdy commented 1 year ago

@hcxmj in case I misunderstood, are you asking about the position of the camera relative to the model? Or the camera's field of view, regardless of the viewing angle? Field of view affects the perspective and appearance of depth. If that's what you're looking for, neither of these viewers provide options to modify the field of view currently. If you have specific requirements you may need to set up a viewer for that.

hcxmj commented 1 year ago

@hcxmj in case I misunderstood, are you asking about the position of the camera relative to the model? Or the camera's field of view, regardless of the viewing angle? Field of view affects the perspective and appearance of depth. If that's what you're looking for, neither of these viewers provide options to modify the field of view currently. If you have specific requirements you may need to set up a viewer for that.

Thank you very much for the ideas you provided earlier. I changed the camera’s fov=75 and position=(0,0,5) in the code to meet my needs.