I’ve decided to start learning WebGL for an app I have in mind and I’m kinda torn between threejs and babylonjs. I’ll need to be able to have fine orbiting camera controls with dynamic reference/center points, since the app will be used to inspect architecture scans taken via 3d photogrammetry, and it’s not alway viable to rotate the entire scene around the model’s center point.
Since I want to start with one framework and not dabble with both simultaneously, I went over all the demos and examples to see which would be a better fit. A heads up: I’ve got zero 3D experience except for a few hours in Blender.
The thing I noticed that I liked far more in threejs projects and examples is the camera control for fine navigation. It feels snappy and proportional, much like Blender. On the other hand, bablyon’s feels off, no matter which demo I’ve tried. I’ve tried playing with the camera code in the playground but I’m missing a lot of basics to understand what I’m doing. So, sorry if all of this sounds a bit misguided and that I’m missing basics, because I actually am
Some of the things I’ve noticed about babylonjs’ camera:
There is a lot of interpolation going on when orbiting and when zooming, with a weird acceleration curve. I couldn’t find any option to tweak the tween duration or the curve.
Disabling the acceleration makes the camera become either too responsive, or unresponsive when panning and orbiting.
Zooming in seems to accelerate the closer you are to the center of the scene in some examples, making it impossible to make fine adjustments, or in some examples it deccelerates getting you “stuck” in the max zoom level. In threejs and in Blender the zoom feels proportional to the current zoom level.
Panning the camera feels unresponsive in most examples
I haven’t seen an option where it’s possible to zoom in on the cursor’s position, or orbit around the current selection, but I guess this is possible to do programatically.
So the question here is — am I likely to hit a wall with babylonjs (or threejs for that matter) when it comes to implementing camera controls?
Hi @baxuz and welcome to the forum. Though they might not fully solve your issue here are some of my thoughts from similar problems that have been discussed before.
I’ll try to be more precise. In the playground you sent me it is possible to zoom in until nothing is visible. I’m not sure what’s going on at that point, since I can’t see the camera behaviour from another angle, but you can get it “stuck” in that point. I guess that I was dollying the camera by increasingly smaller fractional amounts. For instance if I were to scroll 1000 mousewheel ticks into the geometry, and not seeing any changes for 800+ of them, it would take me 800 mousewheel ticks to “get out” of it.
I’ve also tried playing with the camera properties in the inspector:
Only the delta percentage seems to do anything. Setting it to 0 makes me enter hyperspace and see a mirror dimension
In Blender, once you hit a certain treshold to the center point of rotation, it’s done, you can’t zoom in further (not talking about colliding with another mesh, you can still clip through). This is a behaviour I’d like to implement.
Another behaviour I like is what SketchFab does.
It seems that when dollying the camera through the rotation center, you can keep going and actually turn around. Not sure what’s happening there.
PS:
I tried the examples in the sandbox (which are really hard to find. There’s just an incospicuous document stack icon in the top right) The camera example doesn’t seem to be working properly. Changing scene.activeCamera to the other cams just breaks it.