Skip to content

Commit 0786d3c

Browse files
authored
Merge pull request #55 from orels1/dev
Release 6.3.0 [ORL-60]
2 parents 908badb + e0124fa commit 0786d3c

26 files changed

+229
-46
lines changed

Packages/manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"dependencies": {
33
"at.pimaker.ltcgi": "https://github.com/PiMaker/ltcgi.git",
4+
"com.singularitygroup.hotreload": "git+https://gitlab.hotreload.net/root/hot-reload-releases.git#1.12.8",
45
"com.unity.ide.rider": "3.0.24",
56
"com.unity.ide.visualstudio": "2.0.20",
67
"com.unity.ide.vscode": "1.2.4",

Packages/packages-lock.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@
55
"depth": 0,
66
"source": "git",
77
"dependencies": {},
8-
"hash": "1bd7212219f54443a418128b78dbdd033d783b49"
8+
"hash": "01079b99d35c08ee91dfe778016d607f5bf657eb"
99
},
1010
"com.llealloo.audiolink": {
1111
"version": "file:com.llealloo.audiolink",
1212
"depth": 0,
1313
"source": "embedded",
1414
"dependencies": {}
1515
},
16+
"com.singularitygroup.hotreload": {
17+
"version": "git+https://gitlab.hotreload.net/root/hot-reload-releases.git#1.12.8",
18+
"depth": 0,
19+
"source": "git",
20+
"dependencies": {
21+
"com.unity.ugui": "1.0.0",
22+
"com.unity.modules.unitywebrequest": "1.0.0"
23+
},
24+
"hash": "ff60e352632357969bf3ff54ce63c8c4ba171566"
25+
},
1626
"com.unity.ext.nunit": {
1727
"version": "1.0.6",
1828
"depth": 1,
@@ -148,7 +158,9 @@
148158
"version": "file:sh.orels.shaders.inspector",
149159
"depth": 0,
150160
"source": "embedded",
151-
"dependencies": {}
161+
"dependencies": {
162+
"com.unity.nuget.newtonsoft-json": "2.0.2"
163+
}
152164
},
153165
"com.unity.modules.ai": {
154166
"version": "1.0.0",

Packages/sh.orels.shaders.generator/Editor/BaseTextImporter.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
using System.IO;
2+
#if UNITY_2022_3_OR_NEWER
3+
using UnityEditor.AssetImporters;
4+
#else
25
using UnityEditor.Experimental.AssetImporters;
6+
#endif
37
using UnityEngine;
48

59
namespace ORL.ShaderGenerator

Packages/sh.orels.shaders.generator/Editor/ConfiguredShaderDefinitionImporter.cs

+4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Text;
5+
#if UNITY_2022_3_OR_NEWER
6+
using UnityEditor.AssetImporters;
7+
#else
58
using UnityEditor.Experimental.AssetImporters;
9+
#endif
610

711
namespace ORL.ShaderGenerator
812
{

Packages/sh.orels.shaders.generator/Editor/ShaderDefinitionImporter.cs

+4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
using System.Text;
66
using System.Text.RegularExpressions;
77
using UnityEditor;
8+
#if UNITY_2022_3_OR_NEWER
9+
using UnityEditor.AssetImporters;
10+
#else
811
using UnityEditor.Experimental.AssetImporters;
12+
#endif
913
using UnityEngine;
1014

1115
namespace ORL.ShaderGenerator

Packages/sh.orels.shaders.generator/Editor/ShaderDefinitionImporterEditor.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using System.Text;
22
using UnityEditor;
3+
#if UNITY_2022_3_OR_NEWER
4+
using UnityEditor.AssetImporters;
5+
#else
36
using UnityEditor.Experimental.AssetImporters;
7+
#endif
48
using UnityEngine;
59

610
namespace ORL.ShaderGenerator

Packages/sh.orels.shaders.generator/Editor/SourceImporter.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
using UnityEditor.Experimental.AssetImporters;
1+
#if UNITY_2022_3_OR_NEWER
2+
using UnityEditor.AssetImporters;
3+
#else
4+
using UnityEditor.Experimental.AssetImporters;
5+
#endif
26

37
namespace ORL.ShaderGenerator
48
{

Packages/sh.orels.shaders.generator/Editor/TemplateImporter.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
using UnityEditor.Experimental.AssetImporters;
1+
#if UNITY_2022_3_OR_NEWER
2+
using UnityEditor.AssetImporters;
3+
#else
4+
using UnityEditor.Experimental.AssetImporters;
5+
#endif
26

37
namespace ORL.ShaderGenerator
48
{

Packages/sh.orels.shaders.generator/Runtime/Sources/Functions/PBR/FragmentBase.orlsource

+11-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
[Toggle(BAKERY_SHNONLINEAR)]_BakerySHNonLinear("Bakery Non-Linear SH %ShowIf(BAKERY_ENABLED)", Int) = 1
2424
UI_InternalHeader("# Internal", Int) = 0
2525
[NonModifiableTextureData]_DFG("DFG > %RequiredTexture(@/dfg-multiscatter.exr)", 2D) = "white" {}
26-
_RNM0("RNM0 >", 2D) = "black" {}
27-
_RNM1("RNM1 >", 2D) = "black" {}
28-
_RNM2("RNM2 >", 2D) = "black" {}
26+
_RNM0("RNM0 >", 2D) = "white" {}
27+
_RNM1("RNM1 >", 2D) = "white" {}
28+
_RNM2("RNM2 >", 2D) = "white" {}
2929
}
3030

3131
%ShaderFeatures()
@@ -161,10 +161,17 @@
161161
#if defined(DIRLIGHTMAP_COMBINED)
162162
half4 lightMapDirection = tex2DFastBicubicSample(unity_LightmapInd, samplerunity_Lightmap, lightmapUV);
163163
#if !defined(BAKERY_MONOSH)
164-
lightMap = DecodeDirectionalLightmap(lightMap, lightMapDirection, o.Normal);
164+
lightMap = DecodeDirectionalLightmap(lightMap, lightMapDirection, o.Normal);
165165
#endif
166166
#endif
167167

168+
// Unity+Bakery often results in a full clear of DIRLIGHTMAP_COMBINED keyword
169+
// which in turn results in no lightmap being applied when MONOSH is enabled
170+
// this is an escape hatch for such a case to improve dev experience
171+
#if defined(BAKERY_MONOSH) && defined(BAKERY_ENABLED) && !defined(DIRLIGHTMAP_COMBINED)
172+
lightMap = tex2DFastBicubicLightmap(lightmapUV, bakedColorTex);
173+
#endif
174+
168175
#if defined(BAKERY_MONOSH) && defined(BAKERY_ENABLED) && defined(DIRLIGHTMAP_COMBINED)
169176
half3 L0 = tex2DFastBicubicLightmap(lightmapUV, bakedColorTex);
170177
half3 nL1 = lightMapDirection.xyz * 2.0 - 1.0;

Packages/sh.orels.shaders.generator/Runtime/Sources/Libraries/Utilities.orlsource

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
return (v - a) / (b - a);
3030
}
3131

32+
half3 invLerp(half3 a, half3 b, half3 v)
33+
{
34+
return (v - a) / (b - a);
35+
}
36+
37+
3238
// w0, w1, w2, and w3 are the four cubic B-spline basis functions
3339
half w0(half a)
3440
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
%ShaderFeatures()
2+
{
3+
#pragma multi_compile _ LOD_FADE_CROSSFADE
4+
}
5+
6+
%ShaderDefines()
7+
{
8+
#ifndef NEED_SCREEN_POS
9+
#define NEED_SCREEN_POS
10+
#endif
11+
}
12+
13+
%ShaderTags()
14+
{
15+
"Queue" = "AlphaTest" "RenderType" = "TransparentCutout"
16+
}
17+
18+
%Fragment("CrossfadeFragment", -100)
19+
{
20+
void CrossfadeFragment(inout SurfaceData o, MeshData d) {
21+
#if defined(LOD_FADE_CROSSFADE)
22+
23+
float2 vpos = d.screenPos.xy / d.screenPos.w * _ScreenParams.xy;
24+
UnityApplyDitherCrossFade(vpos);
25+
26+
#endif
27+
}
28+
}
29+
30+
%Shadow("CrossfadeShadow")
31+
{
32+
void CrossfadeShadow(FragmentData i) {
33+
#if defined(LOD_FADE_CROSSFADE)
34+
35+
float2 vpos = i.screenPos.xy / i.screenPos.w * _ScreenParams.xy;
36+
UnityApplyDitherCrossFade(vpos);
37+
38+
#endif
39+
}
40+
}

Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/LODCrossfade.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/Runtime/Sources/Modules/Toon/Main.orlsource

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
%Fragment("ToonMainFragment")
6060
{
61-
void ToonMainFragment(MeshData d, inout SurfaceData o, int facing)
61+
void ToonMainFragment(MeshData d, inout SurfaceData o, bool facing)
6262
{
6363
half2 uv = 0;
6464
switch (_MainTexUVSet) {
@@ -70,7 +70,7 @@
7070
uv = uv * _MainTex_ST.xy + _MainTex_ST.zw;
7171
GLOBAL_uv = uv;
7272
half4 albedo = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, GLOBAL_uv);
73-
if (facing > 0) {
73+
if (facing) {
7474
albedo *= _Color;
7575
} else {
7676
albedo = lerp(_BackfaceColor, albedo * _BackfaceColor, _BackfaceAlbedoTint);

Packages/sh.orels.shaders.generator/Runtime/Sources/Modules/VRCFeatures.orlsource

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
UI_VRCFeaturesHeader("# VRChat Features", Int) = 0
44
UI_VRCDocs("[This module has documentation](https://shaders.orels.sh/docs/orl-standard/base-shader#vr-chat-features)", Int) = 0
5+
[Enum(Standard, 0, Toon, 1, Hidden, 2, Transparent, 3, Cutout, 4, ToonCutout, 5)]_VRCFallbackTag("VRC Fallback %OverrideTag(VRCFallback)", Int) = 0
56
[Toggle(VRC_FEATURES)]_VRCFeaturesEnabled("VRChat Features Enabled", Int) = 0
67
UI_VRCHideMainViewHeader("## Hide from Main View %ShowIf(VRC_FEATURES)", Int) = 0
78
[ToggleUI]_VRCHideInVR("In VR %ShowIf(VRC_FEATURES)", Int) = 0

Packages/sh.orels.shaders.generator/Runtime/Sources/Templates/PBR.orltemplate

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
SubShader
88
{
9-
Tags { %ShaderTags }
9+
Tags { "VRCFallback"="Standard" %ShaderTags }
1010
ZTest[_ZTest]
1111
ZWrite[_ZWrite]
1212
Cull[_CullMode]
@@ -91,7 +91,7 @@
9191
}
9292

9393
// ForwardBase Fragment
94-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
94+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
9595
{
9696
UNITY_SETUP_INSTANCE_ID(i);
9797
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -189,7 +189,7 @@
189189
}
190190

191191
// ForwardAdd Fragment
192-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
192+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
193193
{
194194
UNITY_SETUP_INSTANCE_ID(i);
195195
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -290,7 +290,7 @@
290290
}
291291

292292
// Meta Fragment
293-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
293+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
294294
{
295295
UNITY_SETUP_INSTANCE_ID(i);
296296
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -392,7 +392,7 @@
392392
}
393393

394394
// ShadowCaster Fragment
395-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
395+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
396396
{
397397
UNITY_SETUP_INSTANCE_ID(i);
398398
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);

Packages/sh.orels.shaders.generator/Runtime/Sources/Templates/Toon.orltemplate

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Shader %ShaderName
66

77
SubShader
88
{
9-
Tags { %ShaderTags }
9+
Tags { "VRCFallback"="Standard" %ShaderTags }
1010
ZTest[_ZTest]
1111
ZWrite[_ZWrite]
1212
Cull[_CullMode]
@@ -98,7 +98,7 @@ Shader %ShaderName
9898
}
9999

100100
// ForwardBase Depth Prepass Fragment
101-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
101+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
102102
{
103103
UNITY_SETUP_INSTANCE_ID(i);
104104
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -205,7 +205,7 @@ Shader %ShaderName
205205
}
206206

207207
// ForwardBase Fragment
208-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
208+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
209209
{
210210
UNITY_SETUP_INSTANCE_ID(i);
211211
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -303,7 +303,7 @@ Shader %ShaderName
303303
}
304304

305305
// ForwardAdd Fragment
306-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
306+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
307307
{
308308
UNITY_SETUP_INSTANCE_ID(i);
309309
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -404,7 +404,7 @@ Shader %ShaderName
404404
}
405405

406406
// Meta Fragment
407-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
407+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
408408
{
409409
UNITY_SETUP_INSTANCE_ID(i);
410410
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -506,7 +506,7 @@ Shader %ShaderName
506506
}
507507

508508
// ShadowCaster Fragment
509-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
509+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
510510
{
511511
UNITY_SETUP_INSTANCE_ID(i);
512512
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
@@ -613,7 +613,7 @@ Shader %ShaderName
613613
}
614614

615615
// Outline Fragment
616-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
616+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
617617
{
618618
#if defined(OUTLINE_ENABLED)
619619

Packages/sh.orels.shaders.generator/Runtime/Sources/Templates/VFX.orltemplate

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
SubShader
88
{
9-
Tags { %ShaderTags }
9+
Tags { "VRCFallback"="Hidden" %ShaderTags }
1010
%ShaderModifiers
1111

1212
// Global Include Start
@@ -88,7 +88,7 @@
8888
}
8989

9090
// ForwardBase Fragment
91-
half4 Fragment(FragmentData i, int facing: VFACE) : SV_TARGET
91+
half4 Fragment(FragmentData i, bool facing: SV_IsFrontFace) : SV_TARGET
9292
{
9393
UNITY_SETUP_INSTANCE_ID(i);
9494
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);

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": "6.2.1",
5+
"version": "6.3.0",
66
"unity": "2019.4",
77
"author": {
88
"name": "orels1",

Packages/sh.orels.shaders.inspector/Editor/Drawers/HeaderDrawer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace ORL.Drawers
99
{
1010
public class HeaderDrawer : IDrawer
1111
{
12-
// Matches %ShowIf(Condition);
12+
// Matches # or ## headers;
1313
private readonly Regex _matcher = new Regex(@"^(#+)");
1414

1515
public bool MatchDrawer(MaterialProperty property)

0 commit comments

Comments
 (0)