#ifndef UNIVERSAL_SIMPLE_LIT_INPUT_INCLUDED #define UNIVERSAL_SIMPLE_LIT_INPUT_INCLUDED #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" CBUFFER_START(UnityPerMaterial) float4 _BaseMap_ST; half4 _BaseColor; half4 _SpecColor; half4 _EmissionColor; half _Cutoff; half _Surface; UNITY_TEXTURE_STREAMING_DEBUG_VARS; CBUFFER_END #ifdef UNITY_DOTS_INSTANCING_ENABLED UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) UNITY_DOTS_INSTANCED_PROP(float4, _BaseColor) UNITY_DOTS_INSTANCED_PROP(float4, _SpecColor) UNITY_DOTS_INSTANCED_PROP(float4, _EmissionColor) UNITY_DOTS_INSTANCED_PROP(float , _Cutoff) UNITY_DOTS_INSTANCED_PROP(float , _Surface) UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) static float4 unity_DOTS_Sampled_BaseColor; static float4 unity_DOTS_Sampled_SpecColor; static float4 unity_DOTS_Sampled_EmissionColor; static float unity_DOTS_Sampled_Cutoff; static float unity_DOTS_Sampled_Surface; void SetupDOTSSimpleLitMaterialPropertyCaches() { unity_DOTS_Sampled_BaseColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _BaseColor); unity_DOTS_Sampled_SpecColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _SpecColor); unity_DOTS_Sampled_EmissionColor = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float4 , _EmissionColor); unity_DOTS_Sampled_Cutoff = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _Cutoff); unity_DOTS_Sampled_Surface = UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _Surface); } #undef UNITY_SETUP_DOTS_MATERIAL_PROPERTY_CACHES #define UNITY_SETUP_DOTS_MATERIAL_PROPERTY_CACHES() SetupDOTSSimpleLitMaterialPropertyCaches() #define _BaseColor unity_DOTS_Sampled_BaseColor #define _SpecColor unity_DOTS_Sampled_SpecColor #define _EmissionColor unity_DOTS_Sampled_EmissionColor #define _Cutoff unity_DOTS_Sampled_Cutoff #define _Surface unity_DOTS_Sampled_Surface #endif TEXTURE2D(_SpecGlossMap); SAMPLER(sampler_SpecGlossMap); half4 SampleSpecularSmoothness(float2 uv, half alpha, half4 specColor, TEXTURE2D_PARAM(specMap, sampler_specMap)) { half4 specularSmoothness = half4(0, 0, 0, 1); #ifdef _SPECGLOSSMAP specularSmoothness = SAMPLE_TEXTURE2D(specMap, sampler_specMap, uv) * specColor; #elif defined(_SPECULAR_COLOR) specularSmoothness = specColor; #endif #ifdef _GLOSSINESS_FROM_BASE_ALPHA specularSmoothness.a = alpha; #endif return specularSmoothness; } inline void InitializeSimpleLitSurfaceData(float2 uv, out SurfaceData outSurfaceData) { outSurfaceData = (SurfaceData)0; half4 albedoAlpha = SampleAlbedoAlpha(uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)); outSurfaceData.alpha = albedoAlpha.a * _BaseColor.a; outSurfaceData.alpha = AlphaDiscard(outSurfaceData.alpha, _Cutoff); outSurfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb; outSurfaceData.albedo = AlphaModulate(outSurfaceData.albedo, outSurfaceData.alpha); half4 specularSmoothness = SampleSpecularSmoothness(uv, outSurfaceData.alpha, _SpecColor, TEXTURE2D_ARGS(_SpecGlossMap, sampler_SpecGlossMap)); outSurfaceData.metallic = 0.0; // unused outSurfaceData.specular = specularSmoothness.rgb; outSurfaceData.smoothness = specularSmoothness.a; outSurfaceData.normalTS = SampleNormal(uv, TEXTURE2D_ARGS(_BumpMap, sampler_BumpMap)); outSurfaceData.occlusion = 1.0; outSurfaceData.emission = SampleEmission(uv, _EmissionColor.rgb, TEXTURE2D_ARGS(_EmissionMap, sampler_EmissionMap)); } #endif