Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Zoom parameters aren't applying the correct scaling #377

Closed
IgorTatarnikov opened this issue Aug 20, 2024 · 3 comments · Fixed by #386
Closed

[BUG] Zoom parameters aren't applying the correct scaling #377

IgorTatarnikov opened this issue Aug 20, 2024 · 3 comments · Fixed by #386
Assignees
Labels
bug Something isn't working

Comments

@IgorTatarnikov
Copy link
Member

IgorTatarnikov commented Aug 20, 2024

After #364 the zoom parameter doesn't provide the correct scaling when passed to the plotter.show function.

The following examples create an animation that first shows zoom=1 and then zoom=1.2 using the frontal camera.

If resetcam=False (the current behaviour):

brainrender_animation.mp4

If resetcam=True:

brainrender_animation.mp4

I believe the resetcam=True animation is the expected behaviour.

@IgorTatarnikov IgorTatarnikov added the bug Something isn't working label Aug 20, 2024
@GuillaumeLeGoc
Copy link
Contributor

Hi there,
I have a related bug.
Previously I managed to create nice videos with the following keyframes :

anim.add_keyframe(0, camera="top", zoom=1)
anim.add_keyframe(3, camera="sagittal", zoom=0.95)
anim.add_keyframe(6, camera="frontal", zoom=1)
anim.add_keyframe(9, camera="frontal", zoom=1.2)
anim.make_video(duration=12, fps=15)

This now results in the following video :

brainrender_animation.mp4

It seems the zoom factor is applied at each frame instead of each view. The animation example seems to work because it's rather short so the zoom does not have time to make the brain very small. In my example above, setting fps to a low value (eg. 2 or 3) mitigates the problem, confirming that the zoom (in or out) is applied at each frame.
As suggested I tried settings resetcam=True but I did not really know where exactly. I tried as an argument of each add_keyframe but that did not change anything, then I tried directly here :

resetcam=False,

This worked and I got the expected result.
Before this gets fixed, do you have an idea where I could specify this argument from a script rather than editing the source file ?
I can also make a PR (if it's only a matter of settings resetcam=True by default) if you don't have time.

Cheers !

@IgorTatarnikov
Copy link
Member Author

Thanks for the extra context @GuillaumeLeGoc! The frame rate observation is going to be very useful in deciphering exactly what's going on. Unfortunately we're stuck in a situation where we need to keep the resetcam parameter set to False for custom cameras, but for zoom to be functional it needs to be set to True.

For now I've done a quick patch exposing the resetcam parameter in the make_video function. I've also updated examples/animation.py with the new usage. This should be available in the newest version of brainrender.

@GuillaumeLeGoc
Copy link
Contributor

Hello ! Yes I saw the release and it indeed works with the exposed resetcam parameter. Cheers !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants