From ffbe33ea14c69ffe5d374019d7453bed208c80e6 Mon Sep 17 00:00:00 2001 From: AcChosen <49845629+AcChosen@users.noreply.github.com> Date: Fri, 17 Feb 2023 06:47:18 -0500 Subject: [PATCH] Updated VRSL DMX: Creating Custom DMX Shaders (markdown) --- VRSL-DMX:-Creating-Custom-DMX-Shaders.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/VRSL-DMX:-Creating-Custom-DMX-Shaders.md b/VRSL-DMX:-Creating-Custom-DMX-Shaders.md index fb20088..4253249 100644 --- a/VRSL-DMX:-Creating-Custom-DMX-Shaders.md +++ b/VRSL-DMX:-Creating-Custom-DMX-Shaders.md @@ -97,11 +97,21 @@ Shader "Unlit/VRSL-TutorialV2" int dmx = GetDMXChannel(); float intensity = ReadDMX(dmx, _Udon_DMXGridRenderTexture); // 0-1 output - float4 color = GetDMXColor(dmx+1); //this is the same as 3 ReadDMX() calls mapped to a float3 with 1 in the alpha channel - float strobe = GetStrobeOutput(dmx + 4); // a special function for getting strobe output, which is a square wave from 0-1 + + //this is the same as 3 ReadDMX() calls mapped to a float3 with 1 in the alpha channel + float4 color = GetDMXColor(dmx+1); + + // a special function for getting strobe output, which is a square wave from 0-1 + float strobe = GetStrobeOutput(dmx + 4); + + //combine them together o.finalColor = (intensity * color) * strobe; + //check to see if dmx capabilities are enabled, if not, output this base emission color. o.finalColor = isDMX() ? o.finalColor : getBaseEmission(); + + //Use the global intensity and final intensity properties to control the outputted intensity of the color + //good for world shaders that want to be controlled by udon-based sliders. o.finalColor *= getGlobalIntensity() * getFinalIntensity(); return o; } @@ -129,7 +139,7 @@ You do not need to only send color data, you can also send the dmx data values t ## The Main Properties -These two are the two properties most important: +These are the 3 most important properties - `_DMXChannel ("Starting DMX Channel", Int) = 1` - The `_DMXChannel` instanced property is where you'll set the starting DMX Channel for your DMX shader. DMX Channels start reading from 1, so 1 is the default. This is more of a "raw" channel number and should be used only for world shaders when its controlled by the `VRStageLighting_DMX_Static` script. @@ -138,12 +148,9 @@ These two are the two properties most important: - An alternative to "_DMXCHannel" for avatar shaders. Use this to manually set the proper dmx512 channel. - `_Universe("Starting DMX Universe", Int) = 1` - - An alternative to "_DMXCHannel" for avatar shaders. Use this in conjunction with `_Channel` to manually set the universe for the dmx512 channel. + - An alternative to "_DMXCHannel" for avatar shaders. Use this in conjunction with `_Channel` to manually set the universe for the dmx512 channel -- `[NoScaleOffset] _DMXGridRenderTexture("DMX Grid Render Texture (To Control Lights)", 2D) = "white" {}` - - The `_DMXGridRenderTexture` is where the DMX Grid render texture will actually go. You can find the render textures in: `Packages/com.acchosen.vr-stage-lighting/Runtime/Textures/RTs`. There you can find the horizontal, vertical, and legacy versions of the textures. I recommend using the `DMXRTViewer-Interpolated-Color+Intensity` prefixed render textures as those are the slighting smoothed versions of the RAW render texture counterparts. - -These two properties are required for all world-based DMX shaders (for now). +The first property is required for world shaders. The last 2 are required for avatar shaders. ## The Extra Properties