e8jms
e8jms

Reputation: 11

Post Processing effects with tango camera

I would like to blur the camera image or add other effects to it while keeping my scene unaffected. I tried attaching a blur component to the tango camera but it ends up blurring everything including my 3d scene. Is there a way to stylize the video image without impacting my scene? I am using Unity. thanks.

Upvotes: 1

Views: 467

Answers (2)

xuguo
xuguo

Reputation: 1826

There are two ways to do this:

  1. Render color camera's image to a RenderTexture, and perform post processing at the this pass, then render the scene in the different pass with normal camera. This is relatively straightforward. But you need to make sure the color camera's image plane ratio is same as the physical color camera. The physical color camera's intrinsics can be queried from GetIntrinsics calls.

  2. Use the color camera texture directly. This is kind of hacky, but you can reference the code from here. Even thought it's called UpdateEnvironmentMap, it's just writing color camera image to the texture id passed in. Under the hood, TangoSDK injecting a call to Unity's command buffer for render color camera to a texture. See the code here.

Upvotes: 1

Aidan Wolf
Aidan Wolf

Reputation: 131

I first looked into TangoARScreen.cs and found this:

 /// <summary>
/// Script that manages the postprocess distortion of the camera image.
/// </summary>
private ARCameraPostProcess m_arCameraPostProcess;

It points to a shader named ARCameraPostProcess.shader in TangoPrefabs/Shaders

You will want to duplicate this shader for backup, and integrate your blur filter into the original shader. If done correctly, it should blur the background video only.

Hope you found this answer helpful!

Upvotes: 0

Related Questions