1
0
mirror of https://github.com/AcChosen/VR-Stage-Lighting.git synced 2025-02-25 21:58:09 +01:00

Updated VRSL DMX: Creating Custom DMX Shaders (markdown)

AcChosen 2023-01-27 10:07:37 -05:00
parent f62e768a2a
commit 805a4f95ac

@ -28,24 +28,76 @@ Here are some extra properties that are not required but are still highly recomm
- `[Toggle] _EnableDMX ("Enable Stream DMX/DMX Control", Int) = 0`
- A simple instanced int toggle property that can be used to enable/disable DMX functionality at runtime. This toggle can be controlled by the VRSL DMX Udon Script.
- `[NoScaleOffset] _DMXGridStrobeTimer("DMX Grid Strobe Texture (To Control Strobing)", 2D) = "white" {}`
- The render texture property that enables the strobing functionality of VRSL DMX. If you want to enable the strobing function, this texture is required. You can find them in the same render texture folder as the standard DMX render textures and they have the prefix `DMXRTViewer-StrobeTimings-`.
- `[Toggle] _NineUniverseMode ("Extended Universe Mode", Int) = 0`
- An instanced toggle for nine/extended universe mode. This toggle is required for your shader to be used in extended universe mode. This toggle can be controlled by the VRSL Control Panel.
- `[Toggle] _EnableVerticalMode ("Enable Vertical Mode", Int) = 0`
- An instanced toggle for vertical mode. This toggle is required for your shader to be used in vertical mode. This toggle can be controlled by the VRSL Control Panel.
- `[Toggle] _EnableCompatibilityMode ("Enable Compatibility Mode", Int) = 0`
- An instanced toggle for legacy mode. This toggle is required for your shader to be used in legacy mode. This toggle can be controlled by the VRSL Control Panel.
- `[Toggle] _EnableStrobe ("Enable Strobe", Int) = 0`
- An instanced toggle for strobe functionality. Use this property if you want to have an instanced toggle for the strobing feature. This toggle can be controlled by the VRSL DMX Udon Script.
- `[HDR] _Emission ("Base DMX Emission Color", Color) = (1,1,1,1)`
- An instanced base emission color. Multiple your DMX color output by this to change the shader's base starting color. This color can be controlled by the VRSL DMX Udon Script.
- `_GlobalIntensity ("Global Intensity", Range(0,1)) = 1`
- An instanced 0-1 float value intended to control the base intensity of your DMX color output. This value can be controlled by the VRSL DMX Udon Script.
- `_FinalIntensity ("Final Intensity", Range(0,1)) = 1`
- An instanced 0-1 float value intended to control the base intensity of your DMX color output. This value can be controlled by the VRSL DMX Udon Script.
- An instanced 0-1 float value intended to control the base intensity of your DMX color output. Functionally, this is no different than Global Intensity, however, it is included in case you needed the base intensity to be controlled by more than one external script or animation. This value can be controlled by the VRSL DMX Udon Script.
# The DMX Functions
There are a few functions inside of the `VRSLDMX.cginc` script that you will need to use to enable DMX compatibility.
The general use case, however, will be to use the `ReadDMX()` function with `GetDMXChannel()` and `_DMXGridRenderTexture` as your input. This will read DMX data from the `_DMXGridRenderTexture` at the specified DMX channel. The general workflow is to increment the DMX channel value to traverse the grid and sample from nearby channels to create a "fixture profile" for your shader that you can then mimic inside of the DMX software of your choosing.
## The Main Functions
- `ReadDMX(uint DMXChannel, sampler2D _Tex)`
- Returns a 0-1 value from a specified DMX channel from the provided texture. Use this with `GetDMXChannel()` as input. You can increment `GetDMXChannel()` to get nearby channels to sample from for different properties. It is recommended to use the standard `_DMXGridRenderTexture` as the texture input.
- `GetDMXChannel()`
- Returns the instanced DMX channel property of your shader as a uint.
## The Standard Functions
- `GetStrobeOutput(uint DMXChannel)`
- Returns an alternating 0-1 value with the rate controlled by the specified DMX Channel value. Multiply the output of this function by any other value to make it strobe from its current value to 0 and back.
- `GetDMXColor(uint DMXChannel)`
- This function calls`ReadDMX()` 3 times, at 3 consecutive DMX increments (DMXChannel, DMXChannel + 1, DMXChannel + 2) to get 3 DMX channels for red, green, and blue. It then combines those values into a color (float4) that it returns.
## The Property Functions
- `isDMX()`
- Returns the instanced toggle property, `_EnableDMX`.
- `getBaseEmission()`
- Returns the instanced color property, `_Emission`.
- `getGlobalIntensity()`
- Returns the instanced float property, `_GlobalIntensity `.
- `getFinalIntensity()`
- Returns the instanced float property, `_FinalIntensity`.
- `isStrobe()`
- Returns the instanced toggle property, `_EnableStrobe`.
- `getNineUniverseMode()`
- Returns the instanced toggle property, `_NineUniverseMode`.