Skip to content

Commit 300f729

Browse files
committed
Added some comments for readability and keyword checks for micro-optimizations.
1 parent a623b3e commit 300f729

11 files changed

+58
-4
lines changed

CGIncludes/UnityGlobalIllumination Plus.cginc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ inline void ResetUnityGI(out UnityGI outGI)
8787
ResetUnityLight(outGI.light);
8888
outGI.indirect.diffuse = 0;
8989
outGI.indirect.specular = 0;
90+
91+
#if _LIGHTVOLUMES_ON || _SPECULARS_ON
92+
// Plus - Data required for VRC Light Volumes
9093
outGI.L0 = float3(0, 0, 0);
9194
outGI.L1r = float3(0, 0, 0);
9295
outGI.L1g = float3(0, 0, 0);
9396
outGI.L1b = float3(0, 0, 0);
97+
#endif
9498
}
9599

96100
inline UnityGI UnityGI_Base(UnityGIInput data, half occlusion, half3 normalWorld)

CGIncludes/UnityLightingCommon Plus.cginc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ struct UnityGI
2626
UnityLight light;
2727
UnityIndirect indirect;
2828

29-
// Data required for VRC Light Volumes
29+
#if _LIGHTVOLUMES_ON || _SPECULARS_ON
30+
// Plus - Fields required for VRC Light Volumes
3031
float3 L0;
3132
float3 L1r;
3233
float3 L1g;
3334
float3 L1b;
35+
#endif
3436
};
3537

3638
struct UnityGIInput

CGIncludes/UnityStandardCore Plus.cginc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,11 @@ struct FragmentCommonData
192192
half3 tangentSpaceNormal;
193193
#endif
194194

195-
// Data required for VRC Light Volumes
195+
#ifdef _SPECULARS_ON
196+
// Plus - Fields required for VRC Light Volumes
196197
float3 albedo;
197198
half metallic;
199+
#endif
198200
};
199201

200202
#ifndef UNITY_SETUP_BRDF_INPUT
@@ -216,7 +218,10 @@ inline FragmentCommonData SpecularSetup (float4 i_tex)
216218
o.specColor = specColor;
217219
o.oneMinusReflectivity = oneMinusReflectivity;
218220
o.smoothness = smoothness;
221+
#ifdef _SPECULARS_ON
222+
// Plus - Data required for VRC Light Volumes
219223
o.albedo = albedo;
224+
#endif
220225
return o;
221226
}
222227

@@ -254,8 +259,11 @@ inline FragmentCommonData MetallicSetup (float4 i_tex)
254259
o.specColor = specColor;
255260
o.oneMinusReflectivity = oneMinusReflectivity;
256261
o.smoothness = smoothness;
262+
#ifdef _SPECULARS_ON
263+
// Plus - Data required for VRC Light Volumes
257264
o.albedo = albedo;
258265
o.metallic = metallic;
266+
#endif
259267
return o;
260268
}
261269

DefaultResourcesExtra/Particle Standard Surface Plus.shader

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Shader "ShingenPizza/Particle Standard Surface Plus"
2929
_CameraNearFadeDistance("Camera Near Fade", Float) = 1.0
3030
_CameraFarFadeDistance("Camera Far Fade", Float) = 2.0
3131

32+
// Plus - Limited Visibility
3233
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
3334
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
3435
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0

DefaultResourcesExtra/Particle Standard Unlit Plus.shader

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Shader "ShingenPizza/Particle Standard Unlit Plus"
2525
_CameraNearFadeDistance("Camera Near Fade", Float) = 1.0
2626
_CameraFarFadeDistance("Camera Far Fade", Float) = 2.0
2727

28+
// Plus - Limited Visibility
2829
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
2930
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
3031
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0

DefaultResourcesExtra/Standard Plus.shader

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Shader "ShingenPizza/Standard Plus"
4141

4242
[Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
4343

44+
// Plus - Limited Visibility
4445
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
4546
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
4647
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0
@@ -50,9 +51,11 @@ Shader "ShingenPizza/Standard Plus"
5051
[ToggleOff] _VRC_Visible_Mirror_Camera("Visible In Mirrors To Cameras", Float) = 1.0
5152
[ToggleOff] _VRC_Visible_Mirror_VRCLens("Visible In Mirrors To VRCLens", Float) = 1.0
5253
[ToggleOff] _VRC_Visible_Mirror_Screenshot("Visible In Mirrors On Screenshots", Float) = 1.0
54+
55+
// Plus - Culling
5356
[HideInInspector] _Cull("__cull", Float) = 2.0
5457

55-
// Light Volumes
58+
// Plus - VRC Light Volumes
5659
[Toggle(_LIGHTVOLUMES_ON)] _LightVolumes("Enable Light Volumes", Float) = 1
5760
[Toggle(_SPECULARS_ON)] _Speculars("Speculars", Float) = 1
5861
[Toggle(_DOMINANTDIRSPECULARS_ON)] _DominantDirSpeculars("Dominant Dir Speculars", Float) = 0
@@ -72,6 +75,8 @@ Shader "ShingenPizza/Standard Plus"
7275
{
7376
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" "VRCFallback"="Standard" }
7477
LOD 300
78+
79+
// Plus - Culling
7580
Cull[_Cull]
7681

7782

@@ -100,6 +105,7 @@ Shader "ShingenPizza/Standard Plus"
100105
#pragma shader_feature_local_fragment _GLOSSYREFLECTIONS_OFF
101106
#pragma shader_feature_local _PARALLAXMAP
102107

108+
// Plus - VRC Light Volumes
103109
#pragma shader_feature_local _SPECULARS_ON
104110
#pragma shader_feature_local _LIGHTVOLUMES_ON
105111
#pragma shader_feature_local _DOMINANTDIRSPECULARS_ON
@@ -247,6 +253,8 @@ Shader "ShingenPizza/Standard Plus"
247253
{
248254
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" "VRCFallback"="Standard" }
249255
LOD 150
256+
257+
// Plus - Culling
250258
Cull[_Cull]
251259

252260
// ------------------------------------------------------------------
@@ -274,6 +282,7 @@ Shader "ShingenPizza/Standard Plus"
274282

275283
#pragma skip_variants SHADOWS_SOFT DIRLIGHTMAP_COMBINED
276284

285+
// Plus - VRC Light Volumes
277286
#pragma shader_feature_local _SPECULARS_ON
278287
#pragma shader_feature_local _LIGHTVOLUMES_ON
279288
#pragma shader_feature_local _DOMINANTDIRSPECULARS_ON

DefaultResourcesExtra/StandardSpecular Plus.shader

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Shader "ShingenPizza/Standard (Specular setup) Plus"
4141

4242
[Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
4343

44+
// Plus - Limited Visibility
4445
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
4546
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
4647
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0
@@ -50,9 +51,11 @@ Shader "ShingenPizza/Standard (Specular setup) Plus"
5051
[ToggleOff] _VRC_Visible_Mirror_Camera("Visible In Mirrors To Cameras", Float) = 1.0
5152
[ToggleOff] _VRC_Visible_Mirror_VRCLens("Visible In Mirrors To VRCLens", Float) = 1.0
5253
[ToggleOff] _VRC_Visible_Mirror_Screenshot("Visible In Mirrors On Screenshots", Float) = 1.0
54+
55+
// Plus - Culling
5356
[HideInInspector] _Cull("__cull", Float) = 2.0
5457

55-
// Light Volumes
58+
// Plus - VRC Light Volumes
5659
[Toggle(_LIGHTVOLUMES_ON)] _LightVolumes("Enable Light Volumes", Float) = 1
5760
[Toggle(_SPECULARS_ON)] _Speculars("Speculars", Float) = 1
5861
[Toggle(_DOMINANTDIRSPECULARS_ON)] _DominantDirSpeculars("Dominant Dir Speculars", Float) = 0
@@ -72,6 +75,8 @@ Shader "ShingenPizza/Standard (Specular setup) Plus"
7275
{
7376
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" "VRCFallback"="Standard (Specular setup)" }
7477
LOD 300
78+
79+
// Plus - Culling
7580
Cull[_Cull]
7681

7782

@@ -100,6 +105,7 @@ Shader "ShingenPizza/Standard (Specular setup) Plus"
100105
#pragma shader_feature_local_fragment _GLOSSYREFLECTIONS_OFF
101106
#pragma shader_feature_local _PARALLAXMAP
102107

108+
// Plus - VRC Light Volumes
103109
#pragma shader_feature_local _SPECULARS_ON
104110
#pragma shader_feature_local _LIGHTVOLUMES_ON
105111
#pragma shader_feature_local _DOMINANTDIRSPECULARS_ON
@@ -246,6 +252,8 @@ Shader "ShingenPizza/Standard (Specular setup) Plus"
246252
{
247253
Tags { "RenderType"="Opaque" "PerformanceChecks"="False" "VRCFallback"="Standard (Specular setup)" }
248254
LOD 150
255+
256+
// Plus - Culling
249257
Cull[_Cull]
250258

251259
// ------------------------------------------------------------------
@@ -273,6 +281,7 @@ Shader "ShingenPizza/Standard (Specular setup) Plus"
273281

274282
#pragma skip_variants SHADOWS_SOFT DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED
275283

284+
// Plus - VRC Light Volumes
276285
#pragma shader_feature_local _SPECULARS_ON
277286
#pragma shader_feature_local _LIGHTVOLUMES_ON
278287
#pragma shader_feature_local _DOMINANTDIRSPECULARS_ON

DefaultResourcesExtra/Unlit/Unlit-Alpha Plus.shader

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Shader "ShingenPizza/Unlit Transparent Plus" {
1111
Properties {
1212
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
1313

14+
// Plus - Limited Visibility
1415
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
1516
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
1617
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0
@@ -20,12 +21,16 @@ Properties {
2021
[ToggleOff] _VRC_Visible_Mirror_Camera("Visible In Mirrors To Cameras", Float) = 1.0
2122
[ToggleOff] _VRC_Visible_Mirror_VRCLens("Visible In Mirrors To VRCLens", Float) = 1.0
2223
[ToggleOff] _VRC_Visible_Mirror_Screenshot("Visible In Mirrors On Screenshots", Float) = 1.0
24+
25+
// Plus - Culling
2326
[HideInInspector] _Cull("__cull", Float) = 2.0
2427
}
2528

2629
SubShader {
2730
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "VRCFallback"="Unlit/Transparent"}
2831
LOD 100
32+
33+
// Plus - Culling
2934
Cull [_Cull]
3035

3136
ZWrite Off

DefaultResourcesExtra/Unlit/Unlit-AlphaTest Plus.shader

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Properties {
1212
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
1313
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
1414

15+
// Plus - Limited Visibility
1516
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
1617
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
1718
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0
@@ -21,11 +22,15 @@ Properties {
2122
[ToggleOff] _VRC_Visible_Mirror_Camera("Visible In Mirrors To Cameras", Float) = 1.0
2223
[ToggleOff] _VRC_Visible_Mirror_VRCLens("Visible In Mirrors To VRCLens", Float) = 1.0
2324
[ToggleOff] _VRC_Visible_Mirror_Screenshot("Visible In Mirrors On Screenshots", Float) = 1.0
25+
26+
// Plus - Culling
2427
[HideInInspector] _Cull("__cull", Float) = 2.0
2528
}
2629
SubShader {
2730
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout" "VRCFallback"="Unlit/Transparent Cutout"}
2831
LOD 100
32+
33+
// Plus - Culling
2934
Cull [_Cull]
3035

3136
Lighting Off

DefaultResourcesExtra/Unlit/Unlit-Color Plus.shader

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Shader "ShingenPizza/Unlit Color Plus" {
1111
Properties {
1212
_Color ("Main Color", Color) = (1,1,1,1)
1313

14+
// Plus - Limited Visibility
1415
[Toggle] _VRC_Limited_Visibility("Limited Visibility", Float) = 0.0
1516
[ToggleOff] _VRC_Visible_Normal("Visible Normally", Float) = 1.0
1617
[ToggleOff] _VRC_Visible_Camera("Visible To Cameras", Float) = 1.0
@@ -20,12 +21,16 @@ Properties {
2021
[ToggleOff] _VRC_Visible_Mirror_Camera("Visible In Mirrors To Cameras", Float) = 1.0
2122
[ToggleOff] _VRC_Visible_Mirror_VRCLens("Visible In Mirrors To VRCLens", Float) = 1.0
2223
[ToggleOff] _VRC_Visible_Mirror_Screenshot("Visible In Mirrors On Screenshots", Float) = 1.0
24+
25+
// Plus - Culling
2326
[HideInInspector] _Cull("__cull", Float) = 2.0
2427
}
2528

2629
SubShader {
2730
Tags { "RenderType"="Opaque" "VRCFallback"="Unlit/Color" }
2831
LOD 100
32+
33+
// Plus - Culling
2934
Cull [_Cull]
3035

3136
Pass {

0 commit comments

Comments
 (0)