This was last updated for ChilloutVR 2023r173. On future versions, these values might be out of date!
This mostly covers global values or values that are relevant to you as a player.
(Nothing here yet, sorry!)
SOME OF THESE ARE PARAMETERS, OTHERS ARE GLOBAL.
- For clarity, I will explicitly write the
uniformkeyword to refer to globals. You can access these in any shader simply by declaring the variable.- You don't need to actually use the keyword in your shader. It's something I do from habit.
- Fields that do not have
uniformon them are parameters that you must add to your ShaderLabProperties { }block- Note that it may be a good idea to make these fields instanced (via
UNITY_DEFINE_INSTANCED_PROP)
- Note that it may be a good idea to make these fields instanced (via
uniform float CVRRenderingCam- The type of camera that is being rendered.0= Normal Camera (you are you)1= Portable Camera (you are going to be in a picture)2= CVRMirror Camera (your mirror copy is rendering)
uniform float4 CVRTime- The time on the system.xis time, in seconds. It represents the local time. This includes decimal increments of millisecond accuracy.yis time, in seconds. It represents GMT+0 or UTC. This includes decimal increments of millisecond accuracy.zis the day of the year, a value between 1 and 366.wis 1 if it is a leap year, 0 if not.
uniform float CVRIsUsingVr- 1 if VR, 0 if not.uniform float CVRGlobalParams1- Misc. goodies, 1xis the current ping.yis the amount of players in the instance.zis the left hand controller's battery %.wis the right hand controller's battery %.
uniform float CVRGlobalParams2- Misc. goodies 2xis 1 when using FBT, 0 if not.yis the left foot's battery %.zis the right foot's battery %.wis the hip's battery %.
- This has no explicitly declared name, instead it is a field that is read in
Awake().
This exists on an object as a script, and expects a Renderer component to be present. The renderer's material is cloned (via the use of the material property rather than sharedMaterial) and then this unique clone is driven.
float3 _CVR_Velocity- The velocity of the object the updater is attached to.float3 _CVR_Angular_Velocity- The angular velocity of the object the updater is attached to.
Exists for the game's built in combat system.
uniform float4 _CVRCombatSystemHealth- Your health in the current instance of a combat system, where applicable.xis the current valueyis the max valuezis regeneration delay (how long it takes to start regenerating)wis the time remaining until regeneration will begin
uniform float4 _CVRCombatSystemArmor- Your armor in the current instance of a combat system, where applicable.- Same as health for XYZW's purpose (current, max, delay, time).
uniform float4 _CVRCombatSystemShield- Your shield in the current instance of a combat system, where applicable.- Same as health for XYZW's purpose (current, max, delay, time).
This is the game's version of audiolink.
There are four sample arrays for left and right audio data. Each of these arrays is 1024 units long, for a total of 4096 samples for left, and 4096 for right.
This reads data from a specific, single AudioSource instance.
uniform float[] _leftSamples1- This, as well as the next left arrays, combine to form a continuous space of 4096 floats. These represent audio samples for the left channel.uniform float[] _leftSamples2uniform float[] _leftSamples3uniform float[] _leftSamples4uniform float[] _rightSamples1- This, as well as the next right arrays, combine to form a continuous space of 4096 floats. These represent audio samples for the right channel.uniform float[] _rightSamples2uniform float[] _rightSamples3uniform float[] _rightSamples4uniform float _volume- The volume of theAudioSourcethat this is reading.uniform float _distance- The distance from the movement system's rotation pivot (your position, basically) and the audio's location.uniform float _pitch- The pitch of theAudioSourcethat this is reading.uniform float _doppler- The intensity of the doppler effect for theAudioSourcethat this is reading. This is not the current doppler effect, just how much it affects the audio when you do end up moving.uniform float _spatial- The spatial blend of the audio, where 0 is 2D and 1 is 3D.
This is the system that allows player data to be accessed via shaders. For all arrays, [0] is the local player. Each array is 255 elements long.
ℹ While any skilled shader author should know this, this is a reminder to consider whether you should use [loop] or [unroll]! The amount of elements in the array will not sensibly change while a frame is rendering. As a result, warps do not become divergent when evaluating the branch, and thus the branch can evaluate the same result on all pixels and execute at its minimum cost. A standard loop will probably benefit when the loop contains highly complex code, but of course, the best choice is to actually pull open the GPU Profiler and test rather than relying on intuition, if it matters enough.
float4[] _PlayerRootPositions- The position of the root of each player, by index. XYZ is the position, and W is the height of the avatar.float3[] _PlayerHipPositions- The position of the hip of each player.float3[] _PlayerHeadPositions- The position of the head of each player.float3[] _PlayerLeftHandPositions- The position of the left hand of each player.float3[] _PlayerRightHandPositions- The position of the right hand of each player.float3[] _PlayerChestPositions- The position of the chest of each player.float3[] _PlayerLeftFootPositions- The position of the left foot of each player.float3[] _PlayerRightFootPositions- The position of the right foot of each player.