No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MotionBlurConverter.cs 1.6KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #if PPV2_EXISTS
  2. using System;
  3. using BIRPToURPConversionExtensions;
  4. using UnityEditor;
  5. using UnityEngine.Rendering;
  6. using BIRPRendering = UnityEngine.Rendering.PostProcessing;
  7. using URPRendering = UnityEngine.Rendering.Universal;
  8. namespace UnityEditor.Rendering.Universal
  9. {
  10. public class MotionBlurConverter : PostProcessEffectSettingsConverter
  11. {
  12. protected override Type OldSettingsType { get; } = typeof(BIRPRendering.MotionBlur);
  13. protected override void ConvertToTarget(BIRPRendering.PostProcessEffectSettings oldSettings, VolumeProfile targetProfile)
  14. {
  15. var oldMotionBlur = oldSettings as BIRPRendering.MotionBlur;
  16. var newVolumeComponent = AddVolumeComponentToAsset<URPRendering.MotionBlur>(targetProfile);
  17. newVolumeComponent.active = oldMotionBlur.active;
  18. // Note: These settings cannot provide visual parity,
  19. // but this scale factor provides a good starting point.
  20. oldMotionBlur.shutterAngle.Convert(newVolumeComponent.intensity, scale: 1f / 360f, oldMotionBlur.enabled);
  21. newVolumeComponent.quality.overrideState = oldMotionBlur.sampleCount.overrideState;
  22. if (oldMotionBlur.sampleCount >= 24)
  23. newVolumeComponent.quality.value = URPRendering.MotionBlurQuality.High;
  24. else if (oldMotionBlur.sampleCount > 12)
  25. newVolumeComponent.quality.value = URPRendering.MotionBlurQuality.Medium;
  26. else
  27. newVolumeComponent.quality.value = URPRendering.MotionBlurQuality.Low;
  28. }
  29. }
  30. }
  31. #endif