Skip to content
eisclimber edited this page Nov 3, 2024 · 2 revisions

Mirror

class in ExPresSXR.Interaction / Extends MonoBehaviour
GameObject instantiable via ExPresSXRMirror

Description

Represents a mirror for a given camera using a RenderTexture. Allows auto generation of RenderTextures with given aspect ratio and resolution but also providing your own RenderTexture for using it further.
Supports tinting or brghtening the mirror and overlaying a (dirty) texture to make it seem more real.

For the mirror to work with AOI Raycasts a AreaOfInteresBouncer-Component must be added to the MirrorPlane and it's Layer must be set to AreaOfInteresBouncer. This is already the case for the instantiable Mirror.

Make sure that the mirror's scale is set to 1 as this might cause weird behavior.

Limitations

Be aware that this mirror does add distortion which does not really matter if not used together with AreaOfInterestRay-Bounces. For such cases (or just accurate mirrors) the payed plugin Mirrors and Reflections for VR is the way to go.

Members

Editor Properties

  • Transform _trackedTarget: Target for which the mirror effect is simulated. It should be best set to the Camera of an XR Rig.
  • Camera _mirrorCamera: Reference to the Mirror's Camera.

Public Properties

  • Vector2 pixelRatio: Aspect ratio of the mirror plane in px. Default Value: (1080, 1080).
  • float resolutionPct: Resolution of the mirror in percentage. Scales the amount of pixels of the aspect ratio, higher values might impact performance. Must be in range [0, 1]. Default value: 1.0f.
  • bool provideCustomRenderTexture: If enabled require providing a custom RenderTexture. Else it will be generated automatically.
  • RenderTexture customRenderTexture: The RenderTexture that is used when 'provideCustomRenderTexture' is enabled.
  • Texture overlayTexture: Texture that is laid over the mirror to make it look more realistic (e.g. dirt, fingerprints, ...). Some example textures can be found at 'ExPresS XR/Sprites/Mirror/'.
  • float overlayStrength: Strength of the effect applied by the overlayTexture. Must be in range [0, 1]. Default Value: 0.5f.
  • Color tintColor: Color that is mixed with the displayed image to change it's color. Use white for no tinting. Default Value: Color.white.
  • float brighteningFactor: Factor that shifts the bightness the displayed image. Must be in range [0, 1]. Default Value: 0.0f.
  • Transform _trackedTarget: Target for which the mirror effect is simulated. It should be best set to the Camera of an XR Rig.
  • Transform mirrorPlane: Reference to the Mirror's Plane.
  • readonly Transform mirrorPlane: The RenderTexture currently used for the mirror.
  • readonly Vector2 actualPixelResultion: The pixel size of the currently used RenderTexture. Returns (0,0) if no texture is set.
  • readonly Material mirrorMaterial: The material used to display the RenderTexture.

Public Properties

  • int RENDER_TEXTURE_DEPTH = 16: Render Texture Depth of the generated RenderTexture.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally