FirstPerson¶
FirstPerson and Renderer visibility control
It is a function for VR
When using a VRM model as a VR avatar, the view is obstructed if the model’s head mesh is visible in the first person view.To solve this, it becomes a function to change the visibility attribute of the mesh in the VRHMD Camera’s first person perspective (FirstPerson) and other perspectives (ThirdPerson).
Project Settings¶
UniVRMの推奨する VR 向けのカメラ構成です。
Consider two types of cameras: cameras representing head-mounted displays and other cameras.UniVRM defaults to Layer 9 VRMFirstPersonOnly
and Layer 10 VRMThirdPersonOnly
.The two layers can also be specified with an argument when loading the runtime.
VRMFirstPersonOnly
FIRSTPERSON_ONLY_LAYER(The gameObject that specifies this layer disappears from other cameras)
Example: Special use such as a competition?
VRMThirdPersonOnly
THIRDPERSON_ONLY_LAYER(The gameObject that specifies this layer disappears from the head-mounted display)
Example: Suppress the drawing of the avatar’s head, hair, glasses, etc. so that the front can be seen
Please set VRMFirstPersonOnly
and VRMThirdPersonOnly
to Project Settings
-Tags and Layers
.

Tags & Layers¶
Default layer number
The default is FirstPerson = 9
, ThirdPerson = 10
.
Can be specified as an argument to FirstPerson.SetupAsync
.
var created = await controller.Vrm.FirstPerson.SetupAsync(
controller.gameObject, firstPersonOnlyLayer: 9, thirdPersonOnlyLayer: 10);
Camera configuration¶
FirstPerson: MainCamera の CullingMask¶
Place a VR camera (HMD) in the scene and check FirstPerson of CullingMask
.
Camera for VR
A first-person rendering camera for VR. This is usually the main
camera.. This is usually the main
camera.

FirstPerson¶
ThirdPerson: OtherCamera の CullingMask¶
Place an additional camera in the scene other than the HMD and check ThirdPerson for CullingMask
.
Third person camera
RenderTexture cameras for mirrors and streams.

FirstPerson¶
Enable FirstPerson function at runtime.¶
The VR First Person settings.
Load
Get Vrm10Instance
Call
Vrm10Instance.Vrm.FirstPerson.SetupAsync
ShowMeshes
async Task<RuntimeGltfInstance> LoadAsync(string path)
{
var data = new GlbFileParser(path).Parse();
if (!Vrm10Data.TryParseOrMigrate(data, true, out Vrm10Data vrm))
{
throw new System.Exception("vrm parse error !");
}
using (var loader = new Vrm10Importer(vrm))
{
// 1.
var instance = await loader.LoadAsync();
// 2.
var controller = instance.GetComponent<Vrm10Instance>();
// 3. The headless model that created is added to instance
await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
// 4.
instance.ShowMeshes();
return instance;
}
}
Sample¶
複数のカメラを配置したサンプルシーンがあります。
Assets/VRM10_Samples/VRM10FirstPersonSample