Unlit.hlsl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef UNLIT_INCLUDED
  2. #define UNLIT_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging3D.hlsl"
  4. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  5. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceData.hlsl"
  6. half4 UniversalFragmentUnlit(InputData inputData, SurfaceData surfaceData)
  7. {
  8. half3 albedo = surfaceData.albedo;
  9. #if defined(DEBUG_DISPLAY)
  10. half4 debugColor;
  11. if (CanDebugOverrideOutputColor(inputData, surfaceData, debugColor))
  12. {
  13. return debugColor;
  14. }
  15. #endif
  16. half4 finalColor = half4(albedo + surfaceData.emission, surfaceData.alpha);
  17. return finalColor;
  18. }
  19. // Deprecated: Use the version which takes "SurfaceData" instead of passing all of these arguments.
  20. half4 UniversalFragmentUnlit(InputData inputData, half3 color, half alpha)
  21. {
  22. SurfaceData surfaceData;
  23. surfaceData.albedo = color;
  24. surfaceData.alpha = alpha;
  25. surfaceData.emission = 0;
  26. surfaceData.metallic = 0;
  27. surfaceData.occlusion = 1;
  28. surfaceData.smoothness = 1;
  29. surfaceData.specular = 0;
  30. surfaceData.clearCoatMask = 0;
  31. surfaceData.clearCoatSmoothness = 1;
  32. surfaceData.normalTS = half3(0, 0, 1);
  33. return UniversalFragmentUnlit(inputData, surfaceData);
  34. }
  35. #endif