VR Tunnelling Pro
Plug-and-Play VR Comfort
Sigtrap.VrTunnellingPro.TunnellingImageBase Class Reference

Description

Base class for non-mobile effects (Tunnelling and TunnellingOpaque).
These effects use full screen post-processing.
This class implements all core functionality. The only difference between Tunnelling and TunnellingOpaque is drawing after everything or after opaque geometry.

Inheritance diagram for Sigtrap.VrTunnellingPro.TunnellingImageBase:
Sigtrap.VrTunnellingPro.TunnellingBase Sigtrap.VrTunnellingPro.Tunnelling Sigtrap.VrTunnellingPro.TunnellingOpaque

Public Member Functions

void AddObjectToMask (Renderer r, bool includeChildren=false)
 Start using object to mask tunnelling effect. More...
 
void RemoveObjectFromMask (Renderer r, bool includeChildren=false)
 Stop using object to mask tunnelling effect. More...
 
void UpdateCage ()
 Updates cached objects to render in cage mode. Use if adding/removing children from Cage Parent. No need to call if moving/modifying/toggling existing children. More...
 
override void ResetCounterMotion ()
 Reset cage and skybox orientation/offset when using counter motion. More...
 
void ApplyPreset (TunnellingPreset p)
 Override some or all settings using a TunnellingPreset asset. More...
 

Public Attributes

const string GLOBAL_PROP_WORLD2CAGE = "_VRTP_WorldToCage"
 Global shader parameter for world-to-cage vertex matrix.
Used in counter-motion triplanar shaders. More...
 
const string GLOBAL_PROP_WORLD2CAGE_NORMAL = "_VRTP_WorldToCageNormal"
 Global shader parameter for world-to-cage normals matrix.
Used in counter-motion triplanar shaders. More...
 
const string GLOBAL_PROP_CAGEPOS = "_VRTP_CagePos"
 Global shader parameter for relative position offset between cage and world. In other words, how far has player artificially locomoted from reference point? Used in counter-motion triplanar shaders. More...
 
BackgroundMode backgroundMode = BackgroundMode.COLOR
 Determines what is rendered in the vignette effect. More...
 
float effectOverlay = 0
 Allows a persistent overlay of the effect across the entire view.
Applies to SKYBOX, CAGE_COLOUR, CAGE_SKYBOX modes. More...
 
int cageDownsample = 0
 Render cage at half or quarter resolution.
1: Half res. 2: Quarter res. More...
 
MSAA cageAntiAliasing = MSAA.AUTO
 Manually set cage MSAA, or AUTO to follow quality settings. More...
 
bool cageUpdateEveryFrame =false
 FALSE: Cache cage objects in OnEnable.
CAN move/modify objects
CANNOT add/destroy objects
TRUE: Refresh objects each frame.
There will be some GC alloc each Update.
Consider calling UpdateCage() manually.
More...
 
float cageFogDensity = 0.01f
 Density of fog for materials using Cage Fogged shaders More...
 
float cageFogPower = 2
 Fog falloff for materials using Cage Fogged shaders More...
 
float cageFogBlend = 1
 Fog blending for materials using Cage Fogged shaders. 0: No fog. 1: 100% fog. More...
 
MaskMode maskMode = MaskMode.OFF
 
int blurDownsample = 3
 Downsample before blurring. Higher is faster and blurrier. More...
 
float blurDistance = 3
 Blur radius. More...
 
int blurPasses = 3
 Blur passes. Higher is slower but blurrier. More...
 
BlurKernel blurSamples
 How many samples to use per pixel per pass? More...
 
bool irisZRejection = true
 At start of rendering, fill Z buffer where effect will be to save fillrate on drawing world.
Disabled with blur or masking. More...
 
CounterVelocityMode counterVelocityMode = CounterVelocityMode.OFF
 Choose counter-velocity effect implementation, or disable.
SHADER mode requires cage objects to use Cage Counter Motion shaders. More...
 
float counterVelocityResetDistance = 0
 If counterVelocityMode is REAL, reset cage position and rotation when it has travelled this far.
If <= 0, no distance-based reset. More...
 
float counterVelocityResetTime = 0
 If counterVelocityMode is REAL, reset cage position and rotation after this time.
If <= 0, no time-based reset. More...
 
float counterVelocityStrength = 1f
 Scale counter-velocity relative to motionTarget motion. More...
 
Vector3 counterVelocityPerAxis = Vector3.one
 Scale counter-velocity on individual axes.
Multiplied by counterVelocityStrength. More...
 
- Public Attributes inherited from Sigtrap.VrTunnellingPro.TunnellingBase
const string GLOBAL_PROP_FOGCOLOR = "_VRTP_Cage_FogColor"
 Global shader parameter controlling fog color in shaders using CageFog.cginc. More...
 
const string GLOBAL_PROP_FOGDENSITY = "_VRTP_Cage_FogDensity"
 Global shader parameter controlling fog density in shaders using CageFog.cginc. More...
 
const string GLOBAL_PROP_FOGPOWER = "_VRTP_Cage_FogPower"
 Global shader parameter controlling fog falloff in shaders using CageFog.cginc. More...
 
const string GLOBAL_PROP_FOGBLEND = "_VRTP_Cage_FogBlend"
 Global shader parameter controlling fog strength in shaders using CageFog.cginc. More...
 
const float FEATHER_MAX = 0.5f
 
const float MOTION_STRENGTH_MAX = 2f
 
const float COUNTER_STRENGTH_MAX = 2f
 
const int FPSDIV_MAX = 60
 
Transform motionTarget
 Motion calculated using this Transform. Generally shouldn't use HMD. More...
 
Color effectColor = Color.black
 Colour of vignette. Alpha is blend factor.
If applyColorToBackground true, will affect background of advanced modes. More...
 
float effectCoverage = 0.75f
 Maximum screen coverage. More...
 
float effectFeather = 0.1f
 Feather around cut-off as fraction of screen. More...
 
Cubemap effectSkybox
 Skybox to apply to vignette.
Requires skybox mode to be enabled (varies depending upon effect). More...
 
bool applyColorToBackground = false
 Depending upon effect mode, causes effectColor to affect background.
Basic vignette mode always uses effectColor. More...
 
bool useAngularVelocity = true
 Add angular velocity to effect strength? Helps players with regular sim-sickness. More...
 
float angularVelocityStrength = 1
 Strength contributed to effect by angular velocity. More...
 
float angularVelocityMin = 0
 No effect contribution below this angular velocity. Degrees per second More...
 
float angularVelocityMax = 180
 Clamp effect contribution above this angular velocity. Degrees per second More...
 
float angularVelocitySmoothing = 0.15f
 Smoothing time for angular velocity calculation. 0 for no smoothing More...
 
bool useAcceleration = false
 Add linear acceleration to effect strength? Helps players with moderate sim-sickness. More...
 
float accelerationStrength = 1
 Strength contributed to effect by linear acceleration. More...
 
float accelerationMin
 No effect contribution below this acceleration. Metres per second squared More...
 
float accelerationMax
 Clamp effect contribution above this acceleration. Metres per second squared More...
 
float accelerationSmoothing = 0.15f
 Smoothing time for acceleration calculation. 0 for no smoothing More...
 
bool useVelocity = false
 Add translation velocity to effect strength? Helps players with strong sim-sickness. More...
 
float velocityStrength = 1
 Strength contributed to effect by linear velocity. More...
 
float velocityMin
 No effect contribution below this velocity. Metres per second More...
 
float velocityMax
 Clamp effect contribution above this velocity. Metres per second More...
 
float velocitySmoothing = 0.15f
 Smoothing time for velocity calculation. 0 for no smoothing More...
 
ForceVignetteMode forceVignetteMode
 How to combine forceVignetteValue with motion value to calculate effect radius. More...
 
float forceVignetteValue
 Force effect to be this value.
Combined with motion value according to forceVignetteMode. More...
 
Transform motionEffectTarget = null
 Transform used for artificial tilt and framerate division.
Should be a child of Motion Target and a parent of the HMD.
Target's transform should not be modified by anything else. More...
 
bool useCounterMotion = false
 Counter-motion moves/rotates cage/skybox opposite to motionTarget motion. More...
 
float counterRotationStrength = 1f
 Scale counter-rotation relative to motionTarget motion. More...
 
Vector3 counterRotationPerAxis = Vector3.up
 Scale counter-rotation on individual axes.
Multiplied by counterVelocityStrength.
X: Pitch, Y: Yaw, Z: Roll. More...
 
bool useArtificialTilt = false
 Artifically tilt the camera when moving to simulate acceleration forces. More...
 
float tiltStrength = 0f
 Strength of artificial tilt relative to linear acceleration.
Degrees per (metres per second squared). More...
 
Vector2 tiltMaxAngles = 5*Vector2.one
 Maximum artificial tilt in degrees. Zero for no clamp.
X: Pitch, Y: Roll. More...
 
float tiltSmoothTime = 0f
 Smooth out tilt over this time. More...
 
int framerateDivision = 1
 Divide VR framerate by this number while keeping HMD and cage at device framerate.
Forces stepped motion of motionEffectTarget rather than changing rendering.
More...
 
bool divideTranslation = true
 Apply framerateDivision division to linear motion. More...
 
bool divideRotation = true
 Apply framerateDivision division to rotation. More...
 

Properties

static TunnellingImageBase instance [get]
 Singleton instance.
Will refer to either a Tunnelling or TunnellingOpaque effect.
Will not refer to a TunnellingMobile effect. More...
 
bool usingMask [get]
 Is effect currently using/rendering a mask? More...
 
bool usingCage [get]
 Is effect currently using/rendering the cage? More...
 
- Properties inherited from Sigtrap.VrTunnellingPro.TunnellingBase
bool usingMotionEffectTarget [get]
 Indicates whether the motionEffectTarget is currently being used for motion effects. More...
 

Public Types

enum  BlurKernel { BlurKernel.FIVE = 0, BlurKernel.NINE = 1, BlurKernel.THIRTEEN = 2 }
 
enum  CounterVelocityMode { CounterVelocityMode.OFF, CounterVelocityMode.SHADER, CounterVelocityMode.REAL }
 
- Public Types inherited from Sigtrap.VrTunnellingPro.TunnellingBase
enum  BackgroundMode {
  BackgroundMode.COLOR, BackgroundMode.SKYBOX, BackgroundMode.CAGE_COLOR, BackgroundMode.CAGE_SKYBOX,
  BackgroundMode.CAGE_ONLY, BackgroundMode.BLUR
}
 Determines what is drawn over the periphery in the vignetted region. More...
 
enum  MaskMode { MaskMode.OFF, MaskMode.MASK, MaskMode.WINDOW, MaskMode.PORTAL }
 Determines whether and how objects can mask the vignette. More...
 
enum  MSAA {
  MSAA.AUTO, MSAA.OFF, MSAA.X2, MSAA.X4,
  X8
}
 Antialiasing modes for cage RenderTexture. More...
 
enum  ForceVignetteMode {
  ForceVignetteMode.NONE = 0, ForceVignetteMode.CONSTANT = 10, ForceVignetteMode.MAX = 20, ForceVignetteMode.MIN = 30,
  ADD = 40
}
 How to calculate effect radius according to motion and force effect value. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Sigtrap.VrTunnellingPro.TunnellingBase
static Vector3 SmoothDampAngle (Vector3 current, Vector3 target, ref Vector3 vel, float smoothTime, float maxSpeed, float dT)
 

Member Enumeration Documentation

◆ BlurKernel

Enumerator
FIVE 

Blur uses a 5x5 sample kernel

NINE 

Blur uses a 9x9 sample kernel

THIRTEEN 

Blur uses a 13x13 sample kernel

◆ CounterVelocityMode

Enumerator
OFF 

No counter-velocity effect </summmary>

SHADER 

Counter-velocity effect uses Cage Counter Motion triplanar shaders

REAL 

Counter-vloecity effect moves cage

Member Function Documentation

◆ AddObjectToMask()

void Sigtrap.VrTunnellingPro.TunnellingImageBase.AddObjectToMask ( Renderer  r,
bool  includeChildren = false 
)
inline

Start using object to mask tunnelling effect.

Parameters
rRenderer to add to mask.
includeChildrenIf set to true include children.

◆ ApplyPreset()

void Sigtrap.VrTunnellingPro.TunnellingImageBase.ApplyPreset ( TunnellingPreset  p)
inline

Override some or all settings using a TunnellingPreset asset.

◆ RemoveObjectFromMask()

void Sigtrap.VrTunnellingPro.TunnellingImageBase.RemoveObjectFromMask ( Renderer  r,
bool  includeChildren = false 
)
inline

Stop using object to mask tunnelling effect.

Parameters
rRenderer to remove from mask.
includeChildrenIf set to true include children.

◆ ResetCounterMotion()

override void Sigtrap.VrTunnellingPro.TunnellingImageBase.ResetCounterMotion ( )
inlinevirtual

Reset cage and skybox orientation/offset when using counter motion.

Reimplemented from Sigtrap.VrTunnellingPro.TunnellingBase.

◆ UpdateCage()

void Sigtrap.VrTunnellingPro.TunnellingImageBase.UpdateCage ( )
inline

Updates cached objects to render in cage mode. Use if adding/removing children from Cage Parent. No need to call if moving/modifying/toggling existing children.

Member Data Documentation

◆ backgroundMode

BackgroundMode Sigtrap.VrTunnellingPro.TunnellingImageBase.backgroundMode = BackgroundMode.COLOR

Determines what is rendered in the vignette effect.

◆ blurDistance

float Sigtrap.VrTunnellingPro.TunnellingImageBase.blurDistance = 3

Blur radius.

◆ blurDownsample

int Sigtrap.VrTunnellingPro.TunnellingImageBase.blurDownsample = 3

Downsample before blurring. Higher is faster and blurrier.

◆ blurPasses

int Sigtrap.VrTunnellingPro.TunnellingImageBase.blurPasses = 3

Blur passes. Higher is slower but blurrier.

◆ blurSamples

BlurKernel Sigtrap.VrTunnellingPro.TunnellingImageBase.blurSamples

How many samples to use per pixel per pass?

◆ cageAntiAliasing

MSAA Sigtrap.VrTunnellingPro.TunnellingImageBase.cageAntiAliasing = MSAA.AUTO

Manually set cage MSAA, or AUTO to follow quality settings.

◆ cageDownsample

int Sigtrap.VrTunnellingPro.TunnellingImageBase.cageDownsample = 0

Render cage at half or quarter resolution.
1: Half res. 2: Quarter res.

◆ cageFogBlend

float Sigtrap.VrTunnellingPro.TunnellingImageBase.cageFogBlend = 1

Fog blending for materials using Cage Fogged shaders. 0: No fog. 1: 100% fog.

◆ cageFogDensity

float Sigtrap.VrTunnellingPro.TunnellingImageBase.cageFogDensity = 0.01f

Density of fog for materials using Cage Fogged shaders

◆ cageFogPower

float Sigtrap.VrTunnellingPro.TunnellingImageBase.cageFogPower = 2

Fog falloff for materials using Cage Fogged shaders

◆ cageUpdateEveryFrame

bool Sigtrap.VrTunnellingPro.TunnellingImageBase.cageUpdateEveryFrame =false

FALSE: Cache cage objects in OnEnable.
CAN move/modify objects
CANNOT add/destroy objects
TRUE: Refresh objects each frame.
There will be some GC alloc each Update.
Consider calling UpdateCage() manually.

◆ counterVelocityMode

CounterVelocityMode Sigtrap.VrTunnellingPro.TunnellingImageBase.counterVelocityMode = CounterVelocityMode.OFF

Choose counter-velocity effect implementation, or disable.
SHADER mode requires cage objects to use Cage Counter Motion shaders.

◆ counterVelocityPerAxis

Vector3 Sigtrap.VrTunnellingPro.TunnellingImageBase.counterVelocityPerAxis = Vector3.one

Scale counter-velocity on individual axes.
Multiplied by counterVelocityStrength.

◆ counterVelocityResetDistance

float Sigtrap.VrTunnellingPro.TunnellingImageBase.counterVelocityResetDistance = 0

If counterVelocityMode is REAL, reset cage position and rotation when it has travelled this far.
If <= 0, no distance-based reset.

◆ counterVelocityResetTime

float Sigtrap.VrTunnellingPro.TunnellingImageBase.counterVelocityResetTime = 0

If counterVelocityMode is REAL, reset cage position and rotation after this time.
If <= 0, no time-based reset.

◆ counterVelocityStrength

float Sigtrap.VrTunnellingPro.TunnellingImageBase.counterVelocityStrength = 1f

Scale counter-velocity relative to motionTarget motion.

◆ effectOverlay

float Sigtrap.VrTunnellingPro.TunnellingImageBase.effectOverlay = 0

Allows a persistent overlay of the effect across the entire view.
Applies to SKYBOX, CAGE_COLOUR, CAGE_SKYBOX modes.

◆ GLOBAL_PROP_CAGEPOS

const string Sigtrap.VrTunnellingPro.TunnellingImageBase.GLOBAL_PROP_CAGEPOS = "_VRTP_CagePos"

Global shader parameter for relative position offset between cage and world. In other words, how far has player artificially locomoted from reference point? Used in counter-motion triplanar shaders.

◆ GLOBAL_PROP_WORLD2CAGE

const string Sigtrap.VrTunnellingPro.TunnellingImageBase.GLOBAL_PROP_WORLD2CAGE = "_VRTP_WorldToCage"

Global shader parameter for world-to-cage vertex matrix.
Used in counter-motion triplanar shaders.

◆ GLOBAL_PROP_WORLD2CAGE_NORMAL

const string Sigtrap.VrTunnellingPro.TunnellingImageBase.GLOBAL_PROP_WORLD2CAGE_NORMAL = "_VRTP_WorldToCageNormal"

Global shader parameter for world-to-cage normals matrix.
Used in counter-motion triplanar shaders.

◆ irisZRejection

bool Sigtrap.VrTunnellingPro.TunnellingImageBase.irisZRejection = true

At start of rendering, fill Z buffer where effect will be to save fillrate on drawing world.
Disabled with blur or masking.

Property Documentation

◆ instance

TunnellingImageBase Sigtrap.VrTunnellingPro.TunnellingImageBase.instance
staticget

Singleton instance.
Will refer to either a Tunnelling or TunnellingOpaque effect.
Will not refer to a TunnellingMobile effect.

◆ usingCage

bool Sigtrap.VrTunnellingPro.TunnellingImageBase.usingCage
get

Is effect currently using/rendering the cage?

◆ usingMask

bool Sigtrap.VrTunnellingPro.TunnellingImageBase.usingMask
get

Is effect currently using/rendering a mask?


The documentation for this class was generated from the following file: