Decresase count increments depending on another number

Hi there. IM trying to zoom in on the mandelbrot set(glsl) and associate updown leftright movements to the keyboard, right now im using a count CHOP i got the zoom and zoom out handled. However it is boggling my mind how to slow down depending on how zoomed in i am the horizontal/vertical movement.

I would usually control the horizontal/vertical movement. By adding or subtracting from vUV.x then vUV.y, however if I try to include in this operation any reference to the zoom implicitly when i zoom in it will also do horizontal/vertical movement.

I have in mind reducing the increment associated to the count depending on the size of the zoom variable. However I can only multiply it by integers. (BTW i have while on increment over time on the count).

Am i aproaching this the wrong way, any ideas??

Hi there,

What you would need to do is multiply your step size with the current zoom as well. This way the step size stays the same at any zoom level. Zooming in this case can best be done on a logarithmic scale so when taking steps in your zoom level, they are also uniform no matter how far you’re zoomed in already.

Something like

vec2 z = (; // complex number with origin in center
z *= exp(-uZoom); // Zooming
z += uPosition; // Translating

Then you would need to update uPosition based on the keyboard controls. Something like:
uPosition.x += exp(-uZoom)*stepSize;

I’ve attached an example to show what I mean.
Hope it helps.


Mandelbrot.tox (2.1 KB)

1 Like

Thanks for taking the time Tim. That does make a lot of sense. But I’m very committed in achieving smooth movement, that’s why I used the count initially. Here is my work to make it clearer. As for now the controls are 1(for left) 2(for right) and - (zoom in) and =(zoom out).

Do you have any ideas? The easiest thing for me would be to multiply the count time increments by the zoom factor, but i have no idea how to do that unfortunately.

Mandelbrot.15.toe (5.6 KB)

I feel like I trapped myself a little bit with the count op, idk. What other way is it to make the steps smooth?

Hi there,

You can use a SpeedCHOP instead of a countCHOP. And multiplying the output of the functionCHOP with your input to the SpeedCHOP will fix the zoom translation.


mandelbrot2.tox (2.6 KB)

1 Like

Tim, you are the best! Thank you for the hand!