找回密码
 立即注册
查看: 314|回复: 1

unity如何使用Video Capture录制VR视频

[复制链接]
发表于 2023-2-18 14:28 | 显示全部楼层 |阅读模式
VR Capture和Video capture是unity中用于录制视频的插件,但是17年之后便不再更新,所以对于VR视频的录制便存在与SteamVR Plugin | Integration | Unity Asset Store插件的版本冲突,不能直接使用VR Capture提供的示例一般录制视频。
但是也没多大妨碍,加个脚本在camera所在的物体上使其追踪VR的camera(记为HeadsetCamera)移动即可:
1.导入video capture插件:Window -> Package Manager -> Video Capture -> import
2.在Hierarchy下加上两个父子关系的预制体VideoCaptureCtrl 和 DedicatedCapture
Assets -> RockVR -> Video -> Resources -> Prefabs -> VideoCaptureCtrl & DedicatedCapture


其中,DedicatedCapture中包含两个组件:
1) Camera:用于视频录制,显示为Display 2(HeadsetCamera显示为Display 1)


2) Video Capture:用于捕捉Camera录制视频。


在此基础上,挂上第三个脚本FollowHeadsetCamera.cs,用于追踪HeadsetCamera。
//FollowHeadsetCamera.cs
using UnityEngine;

public class FollowHeadsetCamera : MonoBehaviour
{

    public Transform HeadsetTransform;
    public float DepthOffset;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = HeadsetTransform.position - HeadsetTransform.forward * DepthOffset;
        transform.rotation = HeadsetTransform.rotation;
        
    }
}
在Inspector中,HeadsetTransform 引用MainCamera。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2023-2-18 14:38 | 显示全部楼层
这个软件为什么一运行就卡退[发呆]
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-27 23:46 , Processed in 0.089882 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表