Skip to content

Commit 1caccb1

Browse files
committed
added support for VRSL GI
1 parent 2361ece commit 1caccb1

File tree

10 files changed

+193
-13
lines changed

10 files changed

+193
-13
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,6 @@ Assets/AmplifyShaderEditor.meta
124124
Assets/XSToon3
125125
Assets/XSToon3.meta
126126
Assets/AreaLit
127-
Assets/AreaLit.meta
127+
Assets/AreaLit.meta
128+
Assets/VRSL Addons
129+
Assets/VRSL Addons.meta

Packages/packages-lock.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
"depth": 1,
4242
"source": "registry",
4343
"dependencies": {
44+
"com.unity.burst": "1.7.3",
4445
"com.unity.2d.sprite": "1.0.0",
4546
"com.unity.mathematics": "1.1.0",
46-
"com.unity.modules.uielements": "1.0.0",
4747
"com.unity.modules.animation": "1.0.0",
48-
"com.unity.burst": "1.7.3"
48+
"com.unity.modules.uielements": "1.0.0"
4949
},
5050
"url": "https://packages.unity.com"
5151
},
@@ -54,9 +54,9 @@
5454
"depth": 0,
5555
"source": "registry",
5656
"dependencies": {
57-
"com.unity.2d.animation": "9.1.1",
5857
"com.unity.2d.common": "8.0.2",
59-
"com.unity.2d.sprite": "1.0.0"
58+
"com.unity.2d.sprite": "1.0.0",
59+
"com.unity.2d.animation": "9.1.1"
6060
},
6161
"url": "https://packages.unity.com"
6262
},
@@ -212,9 +212,9 @@
212212
"depth": 0,
213213
"source": "registry",
214214
"dependencies": {
215+
"com.unity.modules.audio": "1.0.0",
215216
"com.unity.modules.director": "1.0.0",
216217
"com.unity.modules.animation": "1.0.0",
217-
"com.unity.modules.audio": "1.0.0",
218218
"com.unity.modules.particlesystem": "1.0.0"
219219
},
220220
"url": "https://packages.unity.com"
@@ -243,9 +243,9 @@
243243
"depth": 0,
244244
"source": "registry",
245245
"dependencies": {
246-
"com.unity.modules.subsystems": "1.0.0",
247246
"com.unity.modules.vr": "1.0.0",
248247
"com.unity.modules.xr": "1.0.0",
248+
"com.unity.modules.subsystems": "1.0.0",
249249
"com.unity.xr.legacyinputhelpers": "2.1.7"
250250
},
251251
"url": "https://packages.unity.com"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
%Properties()
2+
{
3+
[ToggleUI]UI_VRSLGIHeader("# VRSL GI", Int) = 1
4+
UI_VRSLGIDocs("[This module has documentation](https://shaders.orels.sh/docs/orl-standard/vrslgi)", Int) = 0
5+
[Toggle(_VRSL_GI)]useVRSLGI("Integrate VRSL GI", Float) = 0.0
6+
UI_VRSLGIDownload("[Make sure to download VRSLGI Shader Pack before enabling this option](https://github.com/AcChosen/VR-Stage-Lighting-GI-ShaderPack/releases)", Int) = 0
7+
_VRSLGIStrength("VRSL GI Strength %ShowIf(_VRSL_GI)", Float) = 2
8+
_VRSLDiffuseMix("VRSL Diffuse Mix %ShowIf(_VRSL_GI)", Range(0, 1)) = 0.25
9+
[Toggle(_VRSL_GI_SPECULARHIGHLIGHTS)]useVRSLGISpecular("Use VRSL GI Specular %ShowIf(_VRSL_GI)", Float) = 1.0
10+
[KeywordEnum(GGX, Beckman, Phong)]_VRSL_SPECFUNC("VRSL Specular Function %ShowIf(_VRSL_GI && _VRSL_GI_SPECULARHIGHLIGHTS)", Int) = 0 // Selecting the specular function.
11+
_VRSLGISpecularClamp("Max Specular Brightness %ShowIf(_VRSL_GI && _VRSL_GI_SPECULARHIGHLIGHTS)", Range(1.0, 50000.0)) = 10000
12+
[Toggle(_VRSL_SHADOWMASK1)]_UseVRSLShadowMask1("Use VRSL Shadow Mask 1 %ShowIf(_VRSL_GI)", Int) = 0 // The first shadow mask toggle
13+
_VRSLShadowMask1("VRSL GI ShadowMask 1 > %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", 2D) = "white" {} // The first shadow mask texture
14+
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, UV1_LightmapST, 9)]_VRSLShadowmaskUVSet("VRSL Shadow Mask UV Set %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Int) = 1
15+
[KeywordEnum(R, RG, RGB, RGBA)]_VRSL_SHADOWMASK("Active Channels %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Int) = 3
16+
_UseVRSLShadowMask1RStrength("VRSL SM 1 R Strength %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Range(0.0, 1.0)) = 1.0 // the R strength of the first shadow mask
17+
_UseVRSLShadowMask1GStrength("VRSL SM 1 G Strength %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Range(0.0, 1.0)) = 1.0 // the G strength of the first shadow mask
18+
_UseVRSLShadowMask1BStrength("VRSL SM 1 B Strength %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Range(0.0, 1.0)) = 1.0 // the B strength of the first shadow mask
19+
_UseVRSLShadowMask1AStrength("VRSL SM 1 A Strength %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Range(0.0, 1.0)) = 1.0 // the A strength of the first shadow mask
20+
}
21+
22+
%ShaderFeatures()
23+
{
24+
#pragma shader_feature_local_fragment _VRSL_GI
25+
#pragma shader_feature_local_fragment _VRSL_SPECFUNC_GGX _VRSL_SPECFUNC_BECKMAN _VRSL_SPECFUNC_PHONG
26+
#pragma shader_feature_local_fragment _VRSL_GI_SPECULARHIGHLIGHTS
27+
#pragma shader_feature_local_fragment _VRSL_SHADOWMASK1
28+
#pragma shader_feature_local_fragment _VRSL_GLOBALLIGHTTEXTURE
29+
#pragma shader_feature_local_fragment _ _VRSL_SHADOWMASK_RG _VRSL_SHADOWMASK_RGB _VRSL_SHADOWMASK_RGBA
30+
}
31+
32+
%CheckedInclude("Assets/VRSL Addons/VRSL-GI Shader Package/VRSLGI-Functions.cginc")
33+
34+
%Variables()
35+
{
36+
int _VRSLShadowmaskUVSet;
37+
}
38+
39+
%ShaderDefines()
40+
{
41+
#if !defined(_VRSL_GI)
42+
#define SKIP_VRSLGI
43+
#endif
44+
}
45+
46+
%Color("VRSLGIColor")
47+
{
48+
49+
void VRSLGIColor(MeshData d, SurfaceData o, inout half4 FinalColor)
50+
{
51+
#if defined(PLAT_QUEST)
52+
{
53+
return;
54+
}
55+
#else
56+
{
57+
#if defined(_VRSL_GI) && !defined(SKIP_VRSLGI)
58+
{
59+
float2 uv = d.uv0.xy;
60+
#if defined(LIGHTMAP_ON)
61+
{
62+
if (_VRSLShadowmaskUVSet == 9)
63+
{
64+
uv = d.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
65+
}
66+
}
67+
#else
68+
{
69+
switch (_VRSLShadowmaskUVSet)
70+
{
71+
case 1: uv = d.uv1.xy; break;
72+
case 2: uv = d.uv2.xy; break;
73+
case 3: uv = d.uv3.xy; break;
74+
}
75+
}
76+
#endif
77+
78+
float oneMinusReflectivity = 1.0 - 0.04 - o.Metallic * (1.0 - 0.04);
79+
80+
_VRSLMetallicMapStrength = 1;
81+
_VRSLSpecularShine = 1;
82+
_VRSLSpecularMultiplier = 1;
83+
84+
float3 giOutput = VRSLGI(
85+
d.worldSpacePosition,
86+
Unity_SafeNormalize(mul(o.Normal, d.TBNMatrix)),
87+
1 - o.Smoothness,
88+
d.worldSpaceViewDir,
89+
o.Albedo * oneMinusReflectivity,
90+
float2(o.Metallic, o.Smoothness),
91+
uv,
92+
o.Occlusion
93+
);
94+
95+
FinalColor.rgb += giOutput;
96+
}
97+
#endif
98+
}
99+
#endif
100+
}
101+
}

Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource.meta

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/sh.orels.shaders.generator/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sh.orels.shaders.generator",
33
"displayName": "ORL Shader Generator",
44
"description": "A template-based shader generator utilizing scripted importers",
5-
"version": "7.0.0-dev.1",
5+
"version": "7.0.0-dev.2",
66
"unity": "2019.4",
77
"author": {
88
"name": "orels1",

Packages/sh.orels.shaders.inspector/ORL.ShaderInspector.asmdef

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"rootNamespace": "",
44
"references": [
55
"GUID:a1653399f63795746b1857281d1e400d",
6-
"GUID:7f2b18295eece7a49ab038d58f0c3037"
6+
"GUID:7f2b18295eece7a49ab038d58f0c3037",
7+
"GUID:45fa8258f46d2b3948d08a08fb82e8e8",
8+
"GUID:a5857e7d50658ab468a75fe6fb42fda9"
79
],
810
"includePlatforms": [
911
"Editor"

Packages/sh.orels.shaders.inspector/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sh.orels.shaders.inspector",
33
"displayName": "ORL Shader Inspector",
44
"description": "A simple property-based shader inspector with extension support",
5-
"version": "7.0.0-dev.1",
5+
"version": "7.0.0-dev.2",
66
"unity": "2019.4",
77
"author": {
88
"name": "orels1",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
%ShaderName("orels1/Standard VRSL GI")
2+
%CustomEditor("ORL.ShaderInspector.InspectorGUI")
3+
4+
%Includes()
5+
{
6+
"@/Shaders/ORL Standard",
7+
"@/Modules/VRSLGI",
8+
"self"
9+
}

Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader.meta

+56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/sh.orels.shaders/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sh.orels.shaders",
33
"displayName": "ORL Shaders",
44
"description": "PBR Unity shaders for the Built-In pipeline built with ORL Shader Generator",
5-
"version": "7.0.0-dev.1",
5+
"version": "7.0.0-dev.2",
66
"unity": "2019.4",
77
"author": {
88
"name": "orels1",
@@ -17,7 +17,7 @@
1717
"license": "MIT",
1818
"type": "assets",
1919
"vpmDependencies": {
20-
"sh.orels.shaders.generator": "^7.0.0-dev.1",
21-
"sh.orels.shaders.inspector": "^7.0.0-dev.1"
20+
"sh.orels.shaders.generator": "^7.0.0-dev.2",
21+
"sh.orels.shaders.inspector": "^7.0.0-dev.2"
2222
}
2323
}

0 commit comments

Comments
 (0)