123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #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"
- CBUFFER_START(UnityPerMaterial)
- float4 _BaseMap_ST;
- half4 _BaseColor;
- half4 _SpecColor;
- half4 _EmissionColor;
- half _Cutoff;
- half _Surface;
- 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)
- #define _BaseColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata_BaseColor)
- #define _SpecColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata_SpecColor)
- #define _EmissionColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata_EmissionColor)
- #define _Cutoff UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_Cutoff)
- #define _Surface UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata_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;
- AlphaDiscard(outSurfaceData.alpha, _Cutoff);
- outSurfaceData.albedo = albedoAlpha.rgb * _BaseColor.rgb;
- #ifdef _ALPHAPREMULTIPLY_ON
- outSurfaceData.albedo *= outSurfaceData.alpha;
- #endif
- 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
|