UnlitMetaPass.hlsl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef UNIVERSAL_UNLIT_META_PASS_INCLUDED
  2. #define UNIVERSAL_UNLIT_META_PASS_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
  4. struct Attributes
  5. {
  6. float4 positionOS : POSITION;
  7. float3 normalOS : NORMAL;
  8. float2 uv0 : TEXCOORD0;
  9. float2 uv1 : TEXCOORD1;
  10. float2 uv2 : TEXCOORD2;
  11. #ifdef _TANGENT_TO_WORLD
  12. float4 tangentOS : TANGENT;
  13. #endif
  14. };
  15. struct Varyings
  16. {
  17. float4 positionCS : SV_POSITION;
  18. float2 uv : TEXCOORD0;
  19. };
  20. Varyings UniversalVertexMeta(Attributes input)
  21. {
  22. Varyings output;
  23. output.positionCS = MetaVertexPosition(input.positionOS, input.uv1, input.uv2,
  24. unity_LightmapST, unity_DynamicLightmapST);
  25. output.uv = TRANSFORM_TEX(input.uv0, _BaseMap);
  26. return output;
  27. }
  28. half4 UniversalFragmentMetaUnlit(Varyings input) : SV_Target
  29. {
  30. MetaInput metaInput = (MetaInput)0;
  31. metaInput.Albedo = _BaseColor.rgb * SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).rgb;
  32. return MetaFragment(metaInput);
  33. }
  34. //LWRP -> Universal Backwards Compatibility
  35. Varyings LightweightVertexMeta(Attributes input)
  36. {
  37. return UniversalVertexMeta(input);
  38. }
  39. half4 LightweightFragmentMetaUnlit(Varyings input) : SV_Target
  40. {
  41. return UniversalFragmentMetaUnlit(input);
  42. }
  43. #endif