oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.77k stars 213 forks source link

Add FOV zoom mode to Orbit class #107

Closed ouzhou closed 3 years ago

ouzhou commented 3 years ago

I want to make a 360 panoramic scene, but in this case, when zooming in to the maximum, the zooming effect is unnatural

// your case https://oframe.github.io/ogl/examples/?src=cube-map.html // other case https://krpano.com/releases/1.20.9/viewer/krpano.html?xml=examples/control-mode/example.xml

gordonnl commented 3 years ago

Currently in the Orbit controls, 'zooming' is performed by changing the distance the camera is from the target. In the other case shared above, zooming changes the camera FOV, hence changing the visible range and widening/narrowing the view frustum. This isn't something that I'd want to apply globally, as the current mechanics work well in most cases, however you're correct that for a 360 scene, this functionality would be really useful!

I'd suggest that adding an option to Orbit to choose which zoom style would be a solve for this!

I don't have any time at the moment, but more than happy for someone to have a look into this and submit a PR.

ouzhou commented 3 years ago

image

https://yomotsu.github.io/camera-movement-comparison/dolly-zoom.html

FarazzShaikh commented 3 years ago

Hey! I could take a look at this this weekend!