How to create a Preview Camera on your avatar [Tutorial]


How to create a Preview Camera on your avatar and will always follow your head. A very useful feature to have for avatar makers or streamers.

Before I start, I want to give a shout to Smash-ter for showing me how to set this up and Lyuma for creating the unity package.

Smash-ter: https://twitter.com/Smash_ter
Lyuma: https://twitter.com/Lyuma2d


Download

First, you need to download the Lyuma Unity Package and set it up in a folder to keep things orangized.

LyumaAvatarCam_v7.unitypackage - Google Drive


Constructing Cam Container

Create four game objects and rename them all shown.

CamContainer
Shader
Preview
Main Camera

a8edafed69eae28350c71a73ab7d7e4b

Also make sure you set all the positions to 0.

c827f256165dbf07e7fc7979e29e8734


Constraints

Highlight the Shader and add a Parent Constraint. Check the boxes Is Active and Lock. Locate the Head armature of your avatar and drag it into the Sources. After you drag the head in the sources, Uncheck and check the Lock box to program the position Axis.

af327e3ef061d813a624c67625ef9a5c

The same thing with the Shader, highlight the Main Camera but add a Position Constraint.

d74505cc31d2d944ff4ca2a74f362328


Combining the Cam Container

Now you can drag the game objects together. Also to make it complete, you can right-click the Main Camera and add a Camera.

Shader > CamContainer
Preview > Shader
Main Camera > CamContainer
Camera > Main Camera


Layers

Go to Preview and click on Layers. There you need to set 4 layers and make sure you spell them correctly. Once you added all the layers, set the preview to UiMenu.


2dbf691439f64821ee123fff61609213


Create Materials

(Optional) Drag the QuadAssetLargeBounds in the Materials Folder.
Right-click and create a Render Texture and call it Camera Texture. Right-click again to create a material and call it Preview Material.


Camera Texture Settings

7eafb9d7cf6318928f890ce01ad77cd5


Camera Settings

NOTE: In Culling Mask. Turn off everything and only have it set to MirrorReflection.

In the Background, you need to set it to a specific color in the hexadecimal.
Background Color: 030303

For a quick test, in the Culling Mask turn the Default and move your camera until you find a good a spot. Make sure you give a good space for your avatar to move its arms up and down. Just in case to prevent clipping.

a128d29c3160f339389f3cb28a7e2671


Preview Settings

NOTE: In the Preview Material drag the Camera Texture into the empty slot. Just under the VR Multiply Color.


Testing

You can now drag the CamContainer onto your avatar and give it a build test. Which of course it might not work in the first try. This is where you need to set some of the preview settings on your own depending on what you’re using in Additional Show Condition. Moving the X and Y Offset it is optional to size the preview up or down.

0c243b69a5062006d60520a60e53c7ce

For more information on how I did it. I made a video on how to set up the Preview Camera.

3 Likes