ParticlesUnlitInput.hlsl 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef UNIVERSAL_PARTICLES_UNLIT_INPUT_INCLUDED
  2. #define UNIVERSAL_PARTICLES_UNLIT_INPUT_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Particles.hlsl"
  4. CBUFFER_START(UnityPerMaterial)
  5. float4 _SoftParticleFadeParams;
  6. float4 _CameraFadeParams;
  7. float4 _BaseMap_ST;
  8. half4 _BaseColor;
  9. half4 _EmissionColor;
  10. half4 _BaseColorAddSubDiff;
  11. half _Cutoff;
  12. half _DistortionStrengthScaled;
  13. half _DistortionBlend;
  14. CBUFFER_END
  15. #define SOFT_PARTICLE_NEAR_FADE _SoftParticleFadeParams.x
  16. #define SOFT_PARTICLE_INV_FADE_DISTANCE _SoftParticleFadeParams.y
  17. #define CAMERA_NEAR_FADE _CameraFadeParams.x
  18. #define CAMERA_INV_FADE_DISTANCE _CameraFadeParams.y
  19. half4 SampleAlbedo(float2 uv, float3 blendUv, half4 color, float4 particleColor, float4 projectedPosition, TEXTURE2D_PARAM(albedoMap, sampler_albedoMap))
  20. {
  21. half4 albedo = BlendTexture(TEXTURE2D_ARGS(albedoMap, sampler_albedoMap), uv, blendUv) * color;
  22. // No distortion Support
  23. half4 colorAddSubDiff = half4(0, 0, 0, 0);
  24. #if defined (_COLORADDSUBDIFF_ON)
  25. colorAddSubDiff = _BaseColorAddSubDiff;
  26. #endif
  27. albedo = MixParticleColor(albedo, particleColor, colorAddSubDiff);
  28. AlphaDiscard(albedo.a, _Cutoff);
  29. albedo.rgb = AlphaModulate(albedo.rgb, albedo.a);
  30. #if defined(_SOFTPARTICLES_ON)
  31. albedo = SOFT_PARTICLE_MUL_ALBEDO(albedo, SoftParticles(SOFT_PARTICLE_NEAR_FADE, SOFT_PARTICLE_INV_FADE_DISTANCE, projectedPosition));
  32. #endif
  33. #if defined(_FADING_ON)
  34. ALBEDO_MUL *= CameraFade(CAMERA_NEAR_FADE, CAMERA_INV_FADE_DISTANCE, projectedPosition);
  35. #endif
  36. return albedo;
  37. }
  38. #endif // UNIVERSAL_PARTICLES_PBR_INCLUDED