Skip to content

Vivecraft

Vivecraft is a mod which allows Minecraft to be played in VR. Vivecraft provides a few macros and uniforms to inform shaders about the current render state.
Data mentioned here is managed by Vivecraft itself, so if any issues are encountered with it please report them on their issue tracker

Definitions/Properties

Checking for Vivecraft

All programs and properties have the VIVECRAFT define set if the Vivecraft mod is loaded. This also applies when VR is not used.

Renderpasses

The uniform vivecraftRenderpass stores the renderpass of the currently rendered view. This can be used to apply special effects per renderpass. The following renderpasses are defined by Vivecraft as preprocessor macros:

defineDescription
VIVECRAFT_PASS_LEFTrenders the left eye perspective
VIVECRAFT_PASS_RIGHTrenders the right eye perspective
VIVECRAFT_PASS_CENTERrenders the first person slow mirror
VIVECRAFT_PASS_THIRDrenders the third person slow mirror
VIVECRAFT_PASS_GUIdraws the Minecraft gui/hud (not actually usable by shaders)
VIVECRAFT_PASS_SCOPERrenders the main hand spyglass perspective
VIVECRAFT_PASS_SCOPELrenders the offhand spyglass perspective
VIVECRAFT_PASS_CAMERArenders the screenshot camera perspective
VIVECRAFT_PASS_MIRRORshows the mirror on the desktop (not actually usable by shaders)
VIVECRAFT_PASS_VANILLArenders the vanilla perspective, set when VR is not used

Uniforms

vivecraftIsVR

Declaration

uniform bool vivecraftIsVR;

This uniform specifies if the player is currently in VR.

vivecraftRenderpass

Declaration

uniform int vivecraftRenderpass;

This uniform specifies the current renderpass that Vivecraft is rendering. The uniform value is intended to be compared to one of the renderpass preprocessor macros which are defined by Vivecraft.

Hand Positions

Declaration

uniform vec3 vivecraftRelativeMainHandPos;
uniform vec3 vivecraftRelativeOffHandPos;

These store the world space offsets from the player’s hand position to the camera’s position. (ie cameraPosition - handPosition)

Hand Orientations

Declaration

uniform mat4 vivecraftRelativeMainHandRot;
uniform mat4 vivecraftRelativeOffHandRot;

These matrices contain the player hand orientations in world space. This is a 3x3 rotation matrix in a mat4, it can be safely cast to a mat3.