Implementing a Zoom-In Animation Effect for AR Camera in Unity

Hello Unity community,

I’m working on an AR application where I’m trying to achieve a specific animation effect. Here’s the desired effect:

  • An animation transition from a character where you can see it whole zoomed out
  • The animation then zooms into the characters’s head, essentially transitioning into the brain.
  • As the transition progresses, the human model fades out, while the brain model with the spinal cord fades in.

While I have experience creating animations in Unity, I’m facing challenges with the AR camera. Specifically, I’m struggling to set up the animation in such a way that it truly appears as if the camera is zooming into the object in a world space. I want the AR camera to focus closely on the object without showing the surrounding real-time world, making it seem like a magnified view of the object.

Could anyone provide guidance or steps on how to achieve this effect using Unity’s AR camera functionalities? I’d appreciate any insights, tutorials, or resources that could point me in the right direction.

Thank you in advance for your help!

The most efficient way to do this would be to make a copy of the background shader, then modify it to be able to “zoom in” on a given pixel value. Then set your AR Camera Background’s Use Custom Material property to true, and supply your new material: Camera components | AR Foundation | 5.1.5. You would have to be pretty crafty with shaders to achieve this.

A less efficient but easier implementation would be to blit the camera background to a render texture (Image capture | AR Foundation | 5.1.5), then achieve your desired effect using that render texture.