Skip to content

Commit c1903fe

Browse files
committed
Fixing issues with later unity version and deferred rendering
1 parent 4f912a5 commit c1903fe

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Plugins/UniversalShaderGraphExtensions/Editor/UniversalTargetExtensions/Includes/SimpleLitGBufferPass.hlsl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,14 @@ FragmentOutput frag(PackedVaryings packedInput)
127127
surface.clearCoatMask = 0;
128128
surface.clearCoatSmoothness = 1;
129129

130+
#if UNITY_VERSION >= 202210
131+
surface.albedo = AlphaModulate(surface.albedo, surface.alpha);
132+
#endif
133+
130134
Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
131135
MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask);
132136
//half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surfaceDescription.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
133-
half4 color = half4(inputData.bakedGI * surfaceDescription.BaseColor + surfaceDescription.Emission, surfaceDescription.Alpha);
137+
half4 color = half4(inputData.bakedGI * surface.albedo + surface.emission, surface.alpha);
134138

135139
//return BRDFDataToGbuffer(brdfData, inputData, surfaceDescription.Smoothness, surfaceDescription.Emission + color, surfaceDescription.Occlusion);
136140
return SurfaceDataToGbuffer(surface, inputData, color.rgb, kLightingSimpleLit);

Plugins/UniversalShaderGraphExtensions/Editor/UniversalTargetExtensions/Targets/UniversalSimpleLitSubTarget.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ sealed class UniversalSimpleLitSubTarget : UniversalSubTarget/*, ILegacyTarget*/
1717
{
1818
static readonly GUID kSourceCodeGuid = new GUID("d6c78107b64145745805d963de80cc28"); // UniversalSimpleLitSubTarget.cs
1919

20+
// Should be in UniversalTarget
21+
public const string kSimpleLitMaterialTypeTag = "\"UniversalMaterialType\" = \"SimpleLit\"";
22+
2023
#if UNITY_2022_1_OR_NEWER
2124
public override int latestVersion => 1;
2225
#endif
@@ -374,7 +377,8 @@ public static SubShaderDescriptor SimpleLitComputeDotsSubShader(UniversalTarget
374377
SubShaderDescriptor result = new SubShaderDescriptor()
375378
{
376379
pipelineTag = UniversalTarget.kPipelineTag,
377-
customTags = UniversalTarget.kLitMaterialTypeTag,
380+
//customTags = UniversalTarget.kLitMaterialTypeTag,
381+
customTags = kSimpleLitMaterialTypeTag,
378382
renderType = renderType,
379383
renderQueue = renderQueue,
380384
generatesPreview = true,
@@ -433,7 +437,8 @@ public static SubShaderDescriptor SimpleLitGLESSubShader(UniversalTarget target,
433437
SubShaderDescriptor result = new SubShaderDescriptor()
434438
{
435439
pipelineTag = UniversalTarget.kPipelineTag,
436-
customTags = UniversalTarget.kLitMaterialTypeTag,
440+
//customTags = UniversalTarget.kLitMaterialTypeTag,
441+
customTags = kSimpleLitMaterialTypeTag,
437442
renderType = renderType,
438443
renderQueue = renderQueue,
439444
generatesPreview = true,

0 commit comments

Comments
 (0)