diff --git a/.gitignore b/.gitignore index 183813a..8a22c0f 100755 --- a/.gitignore +++ b/.gitignore @@ -124,4 +124,6 @@ Assets/AmplifyShaderEditor.meta Assets/XSToon3 Assets/XSToon3.meta Assets/AreaLit -Assets/AreaLit.meta \ No newline at end of file +Assets/AreaLit.meta +Assets/VRSL Addons +Assets/VRSL Addons.meta \ No newline at end of file diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 0986a0a..206e1ab 100755 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -41,11 +41,11 @@ "depth": 1, "source": "registry", "dependencies": { + "com.unity.burst": "1.7.3", "com.unity.2d.sprite": "1.0.0", "com.unity.mathematics": "1.1.0", - "com.unity.modules.uielements": "1.0.0", "com.unity.modules.animation": "1.0.0", - "com.unity.burst": "1.7.3" + "com.unity.modules.uielements": "1.0.0" }, "url": "https://packages.unity.com" }, @@ -54,9 +54,9 @@ "depth": 0, "source": "registry", "dependencies": { - "com.unity.2d.animation": "9.1.1", "com.unity.2d.common": "8.0.2", - "com.unity.2d.sprite": "1.0.0" + "com.unity.2d.sprite": "1.0.0", + "com.unity.2d.animation": "9.1.1" }, "url": "https://packages.unity.com" }, @@ -212,9 +212,9 @@ "depth": 0, "source": "registry", "dependencies": { + "com.unity.modules.audio": "1.0.0", "com.unity.modules.director": "1.0.0", "com.unity.modules.animation": "1.0.0", - "com.unity.modules.audio": "1.0.0", "com.unity.modules.particlesystem": "1.0.0" }, "url": "https://packages.unity.com" @@ -243,9 +243,9 @@ "depth": 0, "source": "registry", "dependencies": { - "com.unity.modules.subsystems": "1.0.0", "com.unity.modules.vr": "1.0.0", "com.unity.modules.xr": "1.0.0", + "com.unity.modules.subsystems": "1.0.0", "com.unity.xr.legacyinputhelpers": "2.1.7" }, "url": "https://packages.unity.com" diff --git a/Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource b/Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource new file mode 100644 index 0000000..942226c --- /dev/null +++ b/Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource @@ -0,0 +1,101 @@ +%Properties() +{ + [ToggleUI]UI_VRSLGIHeader("# VRSL GI", Int) = 1 + UI_VRSLGIDocs("[This module has documentation](https://shaders.orels.sh/docs/orl-standard/vrslgi)", Int) = 0 + [Toggle(_VRSL_GI)]useVRSLGI("Integrate VRSL GI", Float) = 0.0 + 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 + _VRSLGIStrength("VRSL GI Strength %ShowIf(_VRSL_GI)", Float) = 2 + _VRSLDiffuseMix("VRSL Diffuse Mix %ShowIf(_VRSL_GI)", Range(0, 1)) = 0.25 + [Toggle(_VRSL_GI_SPECULARHIGHLIGHTS)]useVRSLGISpecular("Use VRSL GI Specular %ShowIf(_VRSL_GI)", Float) = 1.0 + [KeywordEnum(GGX, Beckman, Phong)]_VRSL_SPECFUNC("VRSL Specular Function %ShowIf(_VRSL_GI && _VRSL_GI_SPECULARHIGHLIGHTS)", Int) = 0 // Selecting the specular function. + _VRSLGISpecularClamp("Max Specular Brightness %ShowIf(_VRSL_GI && _VRSL_GI_SPECULARHIGHLIGHTS)", Range(1.0, 50000.0)) = 10000 + [Toggle(_VRSL_SHADOWMASK1)]_UseVRSLShadowMask1("Use VRSL Shadow Mask 1 %ShowIf(_VRSL_GI)", Int) = 0 // The first shadow mask toggle + _VRSLShadowMask1("VRSL GI ShadowMask 1 > %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", 2D) = "white" {} // The first shadow mask texture + [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 + [KeywordEnum(R, RG, RGB, RGBA)]_VRSL_SHADOWMASK("Active Channels %ShowIf(_VRSL_GI && _VRSL_SHADOWMASK1)", Int) = 3 + _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 + _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 + _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 + _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 +} + +%ShaderFeatures() +{ + #pragma shader_feature_local_fragment _VRSL_GI + #pragma shader_feature_local_fragment _VRSL_SPECFUNC_GGX _VRSL_SPECFUNC_BECKMAN _VRSL_SPECFUNC_PHONG + #pragma shader_feature_local_fragment _VRSL_GI_SPECULARHIGHLIGHTS + #pragma shader_feature_local_fragment _VRSL_SHADOWMASK1 + #pragma shader_feature_local_fragment _VRSL_GLOBALLIGHTTEXTURE + #pragma shader_feature_local_fragment _ _VRSL_SHADOWMASK_RG _VRSL_SHADOWMASK_RGB _VRSL_SHADOWMASK_RGBA +} + +%CheckedInclude("Assets/VRSL Addons/VRSL-GI Shader Package/VRSLGI-Functions.cginc") + +%Variables() +{ + int _VRSLShadowmaskUVSet; +} + +%ShaderDefines() +{ + #if !defined(_VRSL_GI) + #define SKIP_VRSLGI + #endif +} + +%Color("VRSLGIColor") +{ + + void VRSLGIColor(MeshData d, SurfaceData o, inout half4 FinalColor) + { + #if defined(PLAT_QUEST) + { + return; + } + #else + { + #if defined(_VRSL_GI) && !defined(SKIP_VRSLGI) + { + float2 uv = d.uv0.xy; + #if defined(LIGHTMAP_ON) + { + if (_VRSLShadowmaskUVSet == 9) + { + uv = d.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; + } + } + #else + { + switch (_VRSLShadowmaskUVSet) + { + case 1: uv = d.uv1.xy; break; + case 2: uv = d.uv2.xy; break; + case 3: uv = d.uv3.xy; break; + } + } + #endif + + float oneMinusReflectivity = 1.0 - 0.04 - o.Metallic * (1.0 - 0.04); + + _VRSLMetallicMapStrength = 1; + _VRSLSpecularShine = 1; + _VRSLSpecularMultiplier = 1; + + float3 giOutput = VRSLGI( + d.worldSpacePosition, + Unity_SafeNormalize(mul(o.Normal, d.TBNMatrix)), + 1 - o.Smoothness, + d.worldSpaceViewDir, + o.Albedo * oneMinusReflectivity, + float2(o.Metallic, o.Smoothness), + uv, + o.Occlusion + ); + + FinalColor.rgb += giOutput; + } + #endif + } + #endif + } +} \ No newline at end of file diff --git a/Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource.meta b/Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource.meta new file mode 100644 index 0000000..a587b1f --- /dev/null +++ b/Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRSLGI.orlsource.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: c5c97a2ca0d906246be27384757a140e +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: f43ee36a0ee244f697129b1aba052424, type: 3} diff --git a/Packages/sh.orels.shaders.generator/package.json b/Packages/sh.orels.shaders.generator/package.json index 7cc634b..e88e7bd 100755 --- a/Packages/sh.orels.shaders.generator/package.json +++ b/Packages/sh.orels.shaders.generator/package.json @@ -2,7 +2,7 @@ "name": "sh.orels.shaders.generator", "displayName": "ORL Shader Generator", "description": "A template-based shader generator utilizing scripted importers", - "version": "7.0.0-dev.1", + "version": "7.0.0-dev.2", "unity": "2019.4", "author": { "name": "orels1", diff --git a/Packages/sh.orels.shaders.inspector/ORL.ShaderInspector.asmdef b/Packages/sh.orels.shaders.inspector/ORL.ShaderInspector.asmdef index c0c1d19..c3a731a 100644 --- a/Packages/sh.orels.shaders.inspector/ORL.ShaderInspector.asmdef +++ b/Packages/sh.orels.shaders.inspector/ORL.ShaderInspector.asmdef @@ -3,7 +3,9 @@ "rootNamespace": "", "references": [ "GUID:a1653399f63795746b1857281d1e400d", - "GUID:7f2b18295eece7a49ab038d58f0c3037" + "GUID:7f2b18295eece7a49ab038d58f0c3037", + "GUID:45fa8258f46d2b3948d08a08fb82e8e8", + "GUID:a5857e7d50658ab468a75fe6fb42fda9" ], "includePlatforms": [ "Editor" diff --git a/Packages/sh.orels.shaders.inspector/package.json b/Packages/sh.orels.shaders.inspector/package.json index f80176b..a3c5564 100755 --- a/Packages/sh.orels.shaders.inspector/package.json +++ b/Packages/sh.orels.shaders.inspector/package.json @@ -2,7 +2,7 @@ "name": "sh.orels.shaders.inspector", "displayName": "ORL Shader Inspector", "description": "A simple property-based shader inspector with extension support", - "version": "7.0.0-dev.1", + "version": "7.0.0-dev.2", "unity": "2019.4", "author": { "name": "orels1", diff --git a/Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader b/Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader new file mode 100644 index 0000000..5d55c5c --- /dev/null +++ b/Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader @@ -0,0 +1,9 @@ +%ShaderName("orels1/Standard VRSL GI") +%CustomEditor("ORL.ShaderInspector.InspectorGUI") + +%Includes() +{ + "@/Shaders/ORL Standard", + "@/Modules/VRSLGI", + "self" +} diff --git a/Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader.meta b/Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader.meta new file mode 100644 index 0000000..e2311a7 --- /dev/null +++ b/Packages/sh.orels.shaders/Runtime/Shaders/ORL Standard VRSLGI.orlshader.meta @@ -0,0 +1,56 @@ +fileFormatVersion: 2 +guid: dfff91bf0b4fd5240b0482e2908e0ca7 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 14030a0b230d45068f811d1ad116f246, type: 3} + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {instanceID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: FunctionErrors + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[UnityShaderParser.HLSL.FunctionDefinitionNode, + UnityShaderParser],[System.String, mscorlib]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.ObjectEqualityComparer`1[[UnityShaderParser.HLSL.FunctionDefinitionNode, + UnityShaderParser]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: Errors + Entry: 7 + Data: 2|System.Collections.Generic.List`1[[ORL.ShaderGenerator.ShaderDefinitionImporter+ShaderError, + ORL.ShaderGenerator]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + debugBuild: 0 + samplerCount: 0 + textureCount: 0 + featureCount: 0 diff --git a/Packages/sh.orels.shaders/package.json b/Packages/sh.orels.shaders/package.json index 06d8b46..7bba624 100755 --- a/Packages/sh.orels.shaders/package.json +++ b/Packages/sh.orels.shaders/package.json @@ -2,7 +2,7 @@ "name": "sh.orels.shaders", "displayName": "ORL Shaders", "description": "PBR Unity shaders for the Built-In pipeline built with ORL Shader Generator", - "version": "7.0.0-dev.1", + "version": "7.0.0-dev.2", "unity": "2019.4", "author": { "name": "orels1", @@ -17,7 +17,7 @@ "license": "MIT", "type": "assets", "vpmDependencies": { - "sh.orels.shaders.generator": "^7.0.0-dev.1", - "sh.orels.shaders.inspector": "^7.0.0-dev.1" + "sh.orels.shaders.generator": "^7.0.0-dev.2", + "sh.orels.shaders.inspector": "^7.0.0-dev.2" } } \ No newline at end of file