The Standard Shader - AcChosen/VR-Stage-Lighting-GI-ShaderPack GitHub Wiki
Intro
The VRSL GI Standard Shader is a modification of the unity standard shader that was created to support 4 separate systems: VRSL GI, VRSL DMX, AreaLit, and LTCGI. They are designed to be used in combination to help with enhancing the real-time lighting in your VR clubs. Each system can be toggled on/off with appropriate keywords so you can use the ones you need as you see fit. The base features are exactly like a standard shader, with a base GGX lighting model, lightmap support, detail maps, and emission support. The new features are below the base features.
VRSL GI
This is the meat and potatoes of the shader. This is where you will set support for how the shader will react to the VRSL GI system. By default, this system is enabled. It can, however, be toggled off with Enable VRSL GI
check mark at the top of the module.
This module is separated into 3 regions. The regions listed from bottom to top are the Base Diffsue
, Shadow Masking
, and Specular
.
Base Diffuse
This region contains the base lighting settings for VRSL GI. There are 4 options you can set here:
Use Global Light Texture
- This is a toggle for a keyword that switches between trying to use the shader global variable version of the light texture or manually assigning one. For world shaders, it is recommended to assign the light texture directly (This texture is namedVRSL_GI_LightTextureWithCount
) as it provides an ever-so-slight performance boost. For avatars, you must use the global variable version as it is the only way to gain access to the texture in a world.Strength
- The base strength of the GI lighting. Increase or decrease to control how much the GI system affects the lighting of this material.Diffuse Mix
- Control how much the albedo texture blends with the lighting. This should be set to 1 by default. Decreasing it can create some interesting effects, however.Diffuse Mode
- This sets the base shading calculations for this shader, for which there are 3:Diffuse Shading
- Regular diffuse shading. Good for realistic avatars and world lighting.Simple Tint
- No Shading at all. This simply tints material based on the average of all incoming GI sources. This can look good for avatars with shading already pre-baked into their textures.Toon
- Cel-Shaded style. This clamps the lighting between lit or unlit, creating a toon-like shading effect. This can look good for avatars that have a cartoony look but flat textures.
Shadow Masking
This region contains the occlusion settings for VRSL GI. By default, VRSL GI will not render in the black areas of the Occlusion
texture in default standard shader settings. This is nice to support slight ambient occlusion but is not particularly useful for creating the illusion of shadows. This section allows users to set more complex shadow maps to block out specific groups of lights based on which mask they use and what channel they read from. These shadow maps also only remove incoming VRSL GI light. They do not add any extra black color to your materials, so materials will stay the same brightness as if there was no VRSL GI lighting at all.
An overview of the settings:
-
UV Set
- The set of UVs that your masks will work on. It is recommended to useUV2
,UV3
, orUV4
for your shadow masks. This is becauseUV0
is your default UV where you will generally set things like the albedo texture and can be affected by the tiling.UV1
is used for your lightmaps, and while you can use the same UVs as your lightmaps, Unity has a tendency to move your lightmap UVs as you add/remove/make changes to your scene and rebake your lightmaps. This will in turn break your shadow masks as well as they will no longer fit your UVs. As a result, you'll need to bake your shadowmasks in Unity along with your lightmaps in order to keep up with Unity's changes to the lightmap UVs.UV2-4
are not touched by Unity and generally aren't used so they are much safer for shadow masks. It is recommended to try to bake your shadow masks in an external program like Blender so that they do not interfere with your lightmap bakes and you can have more control over how they will actually come out when baked. -
Active Channels
- Shadow masks represent values of 0 to 1. With 0 being no lighting, and 1 being 100% lighting. The color of the lighting is not affected by the shadow masks, only its intensity. As a result, it is possible to split the shadow masks by theRGBA
channels, allowing each channel to represent 1 shadow mask. This setting controls how many channels are supported for the 3 shadow masks. By default, only theR
channel is supported, but it can also supportRG
,RGB
, andRGBA
. In the world, each GI point can be assigned both a specific mask, as well as a specific channel. This allows for the possibility of up to 12 unique shadow masks for one material. -
Use Shadow Mask 1-3
- Keyword toggles that enable or disable a shadow mask texture slot for the material. By default, none of the shadow masks slots are enabled, so you will need to enable one to get it working first. It is recommended to try to split your shadow masks by channel first before enabling more than 1 texture slot to improve performance. -
Shadow Mask 1-3
- The texture slots where the shadow mask textures will go. They expect an standard sRGB texture, but an HDR texture like a lightmap will also work fine. -
R/G/B/A Strength
- The strength of each channel for each texture slot. As more channels in theActive Channels
drop-down become enabled, more of these sliders will become available for each texture slot. These sliders simply allow you to blend each channel individually, with 0 being not active at all, and 1 being fully active.
Specular
This is where you set the settings for the specular highlights from VRSL GI points. The specular highlights are what give off a bit of a shine or reflection from the incoming VRSL GI light sources. This is the most expensive portion of the calculation as it gets heavier with more lights added. If your material is completely rough (As in there is little to no smoothness to it and light doesn't really "bounce" off of it, similar to something like a dry rock or rubber), it is recommended to disable this module entirely with the Specular
checkbox. If your material is smooth and requires highlights (like plastics, metals, and wet surfaces), it is recommended to play with the Specular Function
drop-down to choose an appropriate specular function to minimize performance impact.
Here is an overview of the settings:
-
Specular Function
- These are the algorithms to choose from when calculating specularity. They ordered by performance impact from top to bottom, withGGX
being the heaviest andBlinn Phong
. These algorithms also affect the quality of the specularity, so depending on your target metrics and the complexity of your scene, it may be worth just keeping everything on GGX.GGX
- The most expensive but also most realistic-looking specular model. This algorithm is the same one that is used for the base unity standard shader lighting model and is the industry standard for most games that try to go for a somewhat realistic lighting model. It is also the most visually pleasing of the three. It's recommended to use this on any world objects that are close in view.Beckmann
- A slightly cheaper specular model. This model tends to look good on materials that try to look more metallic. It is also more visually pleasing than Blinn Phong. With some tweaking to the settings, you can make this look very similar to GGX. It is recommended to use this on models that are somewhat further away from view.Blinn Phong
- The cheapest model and arguably the worst-looking one. It is based on attempts at specular highlights from the early days of computer graphics. (Think of the original Toy Story, where everything kind of looks strangely plasticy, even metals.) This is not to say this can't ever look visually pleasing, but it will take some work to get it looking good. It is recommended to use this model on objects that are very far away or are very small but still need to show some form of reflection from the GI points.
-
Use Separate Metallic Smoothness Map
- By default, the specular functions sample from the metallic/smoothness map found in the base Unity standard shader settings to control metallic and smoothness/roughness. Toggling this on will enable a separate texture slot for a seperate metallic/smoothness map specifically for the VRSL GI specular functions. -
Smoothness Channel
- Choose whichRGBA
channel to sample smoothness/roughness from on the metallic/smoothness map. -
Invert Smoothness (To Roughness)
- Invert the chosen smoothness channel to act like a roughness channel, where 0 is 100% smooth, and 1 is 100% rough. -
Smoothness Map Mix
- This controls how much the metallic/smoothness map actually affects the smoothness value. By default it is 0, meaning it doesn't affect it at all. Turn this to 1 to use the selected smoothness channel from your selected metallic/smoothness map. -
Metallic Channel
- Choose whichRGBA
channel to sample metallic levels from on the metallic/smoothness map. -
Invert Metallics
- Inver the chosen metallics channel, where 0 is 100% metallic, and 1 is 0% metallic. -
Metallic Map Mix
- This controls how much the metallic/smoothness map actually affects the metallic value. By default it is 0, meaning it doesn't affect it at all. Turn this to 1 to use the selected metallics channel from your selected metallic/smoothness map. -
VRSL Specular Base Smoothness
- This slider controls the smoothness of the material for VRSL GI when theSmoothness Map Mix
is closer to 0. -
VRSL Metallic/Specular Mixture
- This slider controls the metallic levels of the material for VRSL GI when theMetallic Map Mix
is closer to 0. -
VRSL Specular Multiplier
- This value multiplies with the final specular output, making the specular effect appear brighter. The default is 1. -
Specular Shine Power
- This value multiplies the final specular output with itself (x * x), making the specular effect appear more emphasized. It is recommended to turn this value to 1, especially for metallics.
VRSL DMX
This is a recreation of the standard VRSL DMX panel for fixtures. This panel allows you to turn your material into 1CH, 5CH, or 13CH DMX fixtures, with support for pan and tilt for 13CH fixtures. This will allow you to replace the default VRSL fixture materials (or make your own) and have them able to react with the VRSL GI system as well as AreaLit and LTCGI. When using this, please ensure to toggle on Enable GPU Instancing
at the bottom. A lot of these parameters would be controlled by the standard VR STage Lighting_DMX_Static
script through instanced properties.
This panel only becomes available if you have the base version of VRSL imported into your project.
Here's a list of all the properties and what they do:
Base DMX Properties
These are the basic DMX properties.
-
DMX Channel (Instanced)
- The raw DMX Channel that this fixture reads from. It is in RAW format, meaning channels > 512 represent other universes. -
DMX Mappings
- This is the channel mode this light is in. It can be in13-Channel
,5-Channel
, or1-Chanenl
modes. -
Use Legacy VRSL Textures
- This is a toggle that enables texture slots so you can directly insert the VRSL render textures instead of reading from the global ones. It's not recommended to use this feature except for supporting legacy content. -
Grid Mode
- Set the grid mode to read from:Horizontal
,Vertical
, orLegacy
. -
9-Universe Mode
- Enable this to read from the RGB grid that supports 9 universes instead of the stand black and white grid that supports 3.
Emission Properties
These properties control the emission value that is generated from the DMX data.
-
DMX Emission Map/Mask
- This is a standard emission mask texture that is applied onUV0
. This controls where the DMX emission will appear on the model. Without one, the emission will illuminate the entire model. -
Emission Color (Instanced)
- The base color that will be mixed with the final DMX Emission output. It is recommended to keep this white. -
Emission Map Blending
- Chooses how to blend the Emission Map Texture. Choose betweenMultiply
,Add
, orMix
. It is recommended to keep it on multiply. -
Universal Intesnity
- An un-instanced property that controls the intensity of the DMX emission output. -
Final Intensity (Instanced)
- An instanced property that controls the intensity of the DMX Emission output. -
Global Intensity (Instanced)
- Another instanced property that controls the intensity of the DMX Emission output. There are multiples of these to make multiple origins of control when controlling the max intensity of the fixtures. -
Fixture Max Intensity
- A multiplier for the final strength of the DMX emission output. -
Enable Strobe (Instanced)
- An instanced toggle to enable/disable the strobe channel on a DMX fixture material.
Movement Properties
These properties control the movement (Pan/Tilt) abilities of the fixture. You can enable Pan and Tilt separately. by default they are both disabled. This panel only works with fixtures in 13-Channel
mode.
-
Fixture Pivot/Rotation Origin
- This is the rotation origin in space for the tilt property of the fixture. This vector is in local space, meaning (0,0,0) is the origin of the object. The W component does not do anything. -
Pan
- Enable/Disable the ability for this fixture to pan. (Affects vertices that have green vertex colors.)Max/Min Pan Angle(-x,x) (Instanced)
- This controls how many degrees this fixture can rotate on the pan axis.Pan Offset (Instanced)
- This controls what angle is 0 for the pan channel.Invert Pan (Instanced)
- This makes the pan channel rotate the fixture in the opposite direction.
-
Tilt
- Enable/Disable the ability for this fixture to tilt. (Affects vertices that have blue vertex colors.)Max/Min TiltAngle(-x,x) (Instanced)
- This controls how many degrees this fixture can rotate on the tilt axis.Tilt Offset (Instanced)
- This controls what angle is 0 for the tilt channel.Invert Tilt (Instanced)
- This makes the tilt channel rotate the fixture in the opposite direction.
AreaLit & LTCGI
These contain the standard AreaLit and LTCGI controls. Both features are toggleable through keyword toggles and are for world materials only. They are only available if you have AreaLit or LTCGI imported into your project. Please refer to their respective documentation on how to use their features.