/EnterTheMatrix

Source code for the Enter The Matrix and Begind the Matrix Videos

Primary LanguageShaderLab

Behind The Matrix Shader Source Code

Shader code used in boths matrix video

Shader Library

XPARCommon.ginc

Useful functions to be to be reused in shader

  • Depth to Distance
  • Depth to World Position
  • UNITY_EDITOR emulation : when the #define is used, a rendertexture can be used to simulate a depth camera. In that case, the texture contains the depth (and not the distance as it is for a physical camera) but the library does the conversion between the two modes
PortalCommon.ginc

Specific functions to display a portal in the scene

  • PORTALDOOR : outside view
  • PORTALWALL : inside view
  • _Portal : rendered texture of the portal frame

Shaders

Depth Buffer Shader Worlspace Shader Triplanar Shader
Display the depth buffer Display a grid on top of the mesh in the worldspace coordinate Display a triplanar texture on top of the mesh, with portal support

Sample Unity Project

Sample Unity project using the Universal Render Pipeline and ARFoundation. (Using a light version of the Triplanar shader)

TriPlanar Shader

Next:

More shaders & samples to come

References: