Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Runtime/Shaders/SceneRendering/Scene.shader
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Shader "DCL/Scene"

[MainTexture] _BaseMap("Albedo", 2D) = "white" {}
[MainColor] _BaseColor("Color", Color) = (1,1,1,1)

_AlphaTexture("Alpha Texture", 2D) = "white" {}

_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5

_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
Expand Down
6 changes: 5 additions & 1 deletion Runtime/Shaders/SceneRendering/Scene_Input.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

UNITY_INSTANCING_BUFFER_START(UnityPerMaterial)
UNITY_DEFINE_INSTANCED_PROP(float4, _BaseMap_ST)
UNITY_DEFINE_INSTANCED_PROP(float4, _AlphaTexture_ST)
UNITY_DEFINE_INSTANCED_PROP(half4, _BaseColor)
UNITY_DEFINE_INSTANCED_PROP(half4, _SpecColor)
UNITY_DEFINE_INSTANCED_PROP(half4, _EmissionColor)
Expand All @@ -24,6 +25,7 @@ UNITY_DEFINE_INSTANCED_PROP(float4, _VerticalClipping)
UNITY_INSTANCING_BUFFER_END(UnityPerMaterial)

#define _BaseMap_ST UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _BaseMap_ST)
#define _AlphaTexture_ST UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _AlphaTexture_ST)
#define _BaseColor UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _BaseColor)
#define _SpecColor UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _SpecColor)
#define _EmissionColor UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _EmissionColor)
Expand Down Expand Up @@ -78,7 +80,9 @@ void ApplyPerPixelDisplacement(half3 viewDirTS, inout float2 uv)
inline void InitializeStandardLitSurfaceData_Scene(float2 uv, out SurfaceData_Scene outSurfaceData)
{
half4 albedoAlpha = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
outSurfaceData.alpha = Alpha(albedoAlpha.a, _BaseColor, _Cutoff);
half4 alphaTexture = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_AlphaTexture, sampler_AlphaTexture));

outSurfaceData.alpha = Alpha(albedoAlpha.a, _BaseColor, _Cutoff) * saturate(length(alphaTexture.rgb));
outSurfaceData.albedo = AlphaModulate(albedoAlpha.rgb * _BaseColor.rgb, outSurfaceData.alpha);

half4 specGloss = SampleMetallicSpecGloss(uv, albedoAlpha.a);
Expand Down
2 changes: 2 additions & 0 deletions Runtime/Shaders/SceneRendering/Scene_SurfaceInput.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
TEXTURE2D(_AlphaTexture);
SAMPLER(sampler_AlphaTexture);
float4 _BaseMap_TexelSize;
float4 _BaseMap_MipInfo;
TEXTURE2D(_BumpMap);
Expand Down