Camera Texture

Contents

Introduction

WaveVRCameraTexture returns a texture2D to update preview image from an Android camera or an external camera (if available). You need to add a permission as shown below to access the camera in AndroidManifest.xml.

<uses-permission android:name=”android.permission.CAMERA” />

The WaveVRCameraTexture provides several functions to have properties of camera included

  • EPixelFormat getCameraImageFormat()

Return format of UTexture2D object, current value is PF_R8G8B8A8.

  • EWVR_CameraImageType getCameraImageType()

Return image type WVR_CameraImageType_Invalid, WVR_CameraImageType_SingleEye or WVR_CameraImageType_DualEye. Suggest to check this before you decide how to display your image.

  • int getCameraImageWidth()

Return width of the camera image. 0 means camera has not started.

  • int getCameraImageHeight()

Return height of the camera image. 0 means camera has not started.

The WaveVR Camera Texture also provides APIs to control the camera

  • UTexture2D* getCameraTexture()

This API will start the camera and create an UTexture2D object to update later.

  • void shutdownCamera()

Call this API to stop the camera.

  • void updateCamera(float delta)

Call this API to update the camera image and draw on texture2D.

Camera

Camera is in WaveVR

../_images/Scenes_Camera.jpg

Resources

WaveVRCameraTexture is in WaveVR category as

../_images/category.jpg

Blueprint is located in Plugins/WaveVR/Content/Blueprints/CameraTexture_Blueprint.uasset

How to use

Please refer to CameraTexture_Blueprint.

  1. Add WaveVRCameraTexture component to actor as
../_images/addcomponent.jpg
  1. Get camera texture from WaveVR Camera Texture as
../_images/getCamera.jpg
  1. Use camera texture to update dynamic material
../_images/updateMat.jpg
  1. Update the camera texture every frame
../_images/updateCAm.jpg
  1. Shutdown the camera when the game is going to end.
../_images/stopCam.jpg