Nonlinear zoom

Any ideas for a nonlinear zoom using the mouse?

So, zoom out is slow when zoom factor is very small and zoom out
is fast when zoom factor is very large.

Linear zoom makes zoom in very slow, and zoom out very fast.

if (zoom_in) zoom_factor*=1.1f;
else
if (zoom_out) zoom_factor*=(1.0f/1.1f);
//clamp zoom_factor to min/max values here

As most non-linear animation stuff, this is hard to get right if you want to make it fps-independant.

It’s better to use the fov angle of the projection matrix setup for zooming. This will also work nicely with linear adjustments.

Sorry, I forgot to mention that it’s a windowed, 2D ortho projection
for a basic 3D modeller I’m writing, if that helps any.

I’m basically doing what you described, is that I have a zoom_factor,
and based on the mouse movement delta, I multiply it with mouse_dy.

However this zoom_factor is still linear.

How would I get a nonlinear zoom_factor that slows down when the
zoom_factor is less than 1?

Suggestion:
float fudge_factor; //<- adjust this one with mouse movement
float zoom_factor=some_mapping_function(fudge_factor);

This way you can apply any arbitrary mapping between the mouse position and the actual zoom factor.

You can do some stuff with an interpolated table lookup or a function with exp, log, square roots, whatever works for your application.