rabidus-test/Assets/Amazing Assets/Advanced Dissolve/Shaders/Universal/AdvancedDissolve_Initialize...

54 lines
2.0 KiB
HLSL
Raw Permalink Normal View History

2023-09-18 20:09:22 +03:00
#ifndef ADVANCED_DISSOLVE_INITIALIZE_STANDARD_LIT_SURFACE_Data
#define ADVANCED_DISSOLVE_INITIALIZE_STANDARD_LIT_SURFACE_Data
#include "AdvancedDissolve_Alpha.hlsl"
inline void AdvancedDissolve_InitializeStandardLitSurfaceData(float2 uv, out SurfaceData outSurfaceData, float4 cutoutSource)
{
outSurfaceData = (SurfaceData)0;
half4 albedoAlpha = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
//outSurfaceData.alpha = Alpha(albedoAlpha.a, _BaseColor, _Cutoff);
//Advanced Dissolve/////////////////////////////////////////
outSurfaceData.alpha = AdvancedDissolve_Alpha(albedoAlpha.a, _BaseColor, _Cutoff, cutoutSource);
half4 specGloss = SampleMetallicSpecGloss(uv, albedoAlpha.a);
outSurfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb;
#if _SPECULAR_SETUP
outSurfaceData.metallic = half(1.0);
outSurfaceData.specular = specGloss.rgb;
#else
outSurfaceData.metallic = specGloss.r;
outSurfaceData.specular = half3(0.0, 0.0, 0.0);
#endif
outSurfaceData.smoothness = specGloss.a;
outSurfaceData.normalTS = SampleNormal(uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap), _BumpScale);
outSurfaceData.occlusion = SampleOcclusion(uv);
outSurfaceData.emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap));
#if defined(_CLEARCOAT) || defined(_CLEARCOATMAP)
half2 clearCoat = SampleClearCoat(uv);
outSurfaceData.clearCoatMask = clearCoat.r;
outSurfaceData.clearCoatSmoothness = clearCoat.g;
#else
outSurfaceData.clearCoatMask = half(0.0);
outSurfaceData.clearCoatSmoothness = half(0.0);
#endif
#if defined(_DETAIL)
half detailMask = SAMPLE_TEXTURE2D(_DetailMask, sampler_DetailMask, uv).a;
float2 detailUv = uv * _DetailAlbedoMap_ST.xy + _DetailAlbedoMap_ST.zw;
outSurfaceData.albedo = ApplyDetailAlbedo(detailUv, outSurfaceData.albedo, detailMask);
outSurfaceData.normalTS = ApplyDetailNormal(detailUv, outSurfaceData.normalTS, detailMask);
#endif
}
#endif