설명 없음
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.

ScreenSpaceLensFlareEditor.cs 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using UnityEngine;
  2. using UnityEditor.Rendering;
  3. using UnityEngine.Rendering.Universal;
  4. namespace UnityEditor.Rendering.Universal
  5. {
  6. [CustomEditor(typeof(ScreenSpaceLensFlare))]
  7. class ScreenSpaceLensFlareEditor : VolumeComponentEditor
  8. {
  9. protected SerializedDataParameter m_Intensity;
  10. protected SerializedDataParameter m_TintColor;
  11. protected SerializedDataParameter m_BloomMip;
  12. protected SerializedDataParameter m_FirstFlareIntensity;
  13. protected SerializedDataParameter m_SecondaryFlareIntensity;
  14. protected SerializedDataParameter m_WarpedFlareIntensity;
  15. protected SerializedDataParameter m_WarpedFlareScale;
  16. protected SerializedDataParameter m_Samples;
  17. protected SerializedDataParameter m_SampleDimmer;
  18. protected SerializedDataParameter m_VignetteEffect;
  19. protected SerializedDataParameter m_StartingPosition;
  20. protected SerializedDataParameter m_Scale;
  21. protected SerializedDataParameter m_ChromaticAbberationIntensity;
  22. protected SerializedDataParameter m_StreaksIntensity;
  23. protected SerializedDataParameter m_StreaksLength;
  24. protected SerializedDataParameter m_StreaksOrientation;
  25. protected SerializedDataParameter m_StreaksThreshold;
  26. protected SerializedDataParameter m_Resolution;
  27. static GUIContent s_Intensity = EditorGUIUtility.TrTextContent("Intensity", "Sets the global intensity of the Screen Space Lens Flare effect. When set to 0, the pass is skipped. ");
  28. static GUIContent s_TintColor = EditorGUIUtility.TrTextContent("Tint Color", "Sets the color used to tint all the flares. ");
  29. static GUIContent s_BloomMip = EditorGUIUtility.TrTextContent("Bloom Mip Bias", "Controls the Bloom mip used as a source for the Lens Flare effect. A high value will result in a blurrier result for all the flares.");
  30. static GUIContent s_FirstFlareIntensity = EditorGUIUtility.TrTextContent("Regular Multiplier", "Controls the intensity of the Regular Flare sample. Those flares are sampled using scaled screen coordinates.");
  31. static GUIContent s_SecondaryFlareIntensity = EditorGUIUtility.TrTextContent("Reversed Multiplier", "Controls the intensity of the Reversed Flare sample. Those flares are sampled using scaled and flipped screen coordinates.");
  32. static GUIContent s_WarpedFlareIntensity = EditorGUIUtility.TrTextContent("Warped Multiplier", "Controls the intensity of the Warped Flare sample. Those flares are sampled using polar screen coordinates.");
  33. static GUIContent s_WarpedFlareScale = EditorGUIUtility.TrTextContent("Scale", "Sets the scale of the Warped Flare sample. A value of 1,1 will keep this flare circular. Set values below 1 can lead to stretching artifacts on the side of the screen.");
  34. static GUIContent s_Samples = EditorGUIUtility.TrTextContent("Samples", "Controls the number of times the flare effect is repeated for each flare type (regular, reversed, warped). This parameter has a strong impact on performance.");
  35. static GUIContent s_SampleDimmer = EditorGUIUtility.TrTextContent("Sample Dimmer", "Controls the value by which each additionnal sample is multiplied. This parameter has an effect only after the first sample.");
  36. static GUIContent s_VignetteEffect = EditorGUIUtility.TrTextContent("Vignette Effect", "Controls the intensity of the vignette effect to occlude the Lens Flare effect at the center of the screen.");
  37. static GUIContent s_StartingPosition = EditorGUIUtility.TrTextContent("Starting Position", "Controls the starting position of the flares in screen space relative to their source.");
  38. static GUIContent s_Scale = EditorGUIUtility.TrTextContent("Scale", "Controls the scale at which the flares are sampled. This parameter only impacts regular, reversed and warped flares.");
  39. static GUIContent s_ChromaticAbberationIntensity = EditorGUIUtility.TrTextContent("Intensity", "Controls the strength of the Chromatic Aberration effect. The higher the value, the more light is dispersed on the sides of the screen.");
  40. static GUIContent s_StreaksIntensity = EditorGUIUtility.TrTextContent("Multiplier", "Controls the intensity of streaks effect. This effect has an impact on performance when above zero. When this intensity is zero, this effect is not evaluated to save costs.");
  41. static GUIContent s_StreaksOrientation = EditorGUIUtility.TrTextContent("Orientation", "Controls the orientation streaks effect in degrees. A value of 0 creates horizontal streaks.");
  42. static GUIContent s_StreaksLength = EditorGUIUtility.TrTextContent("Length", "Controls the length of streaks effect. A value of one creates streaks about the width of the screen.");
  43. static GUIContent s_StreaksThreshold = EditorGUIUtility.TrTextContent("Threshold", "Controls the threshold of streak effect. A high value makes the effect more localised on the high intensity areas of the screen. When using a non HDR Camera, a high threshold can remove streaks entirely.");
  44. static GUIContent s_Resolution = EditorGUIUtility.TrTextContent("Resolution", "Specifies the resolution ratio at which the streaks effect is computed.");
  45. public override void OnEnable()
  46. {
  47. var o = new PropertyFetcher<ScreenSpaceLensFlare>(serializedObject);
  48. m_Intensity = Unpack(o.Find(x => x.intensity));
  49. m_TintColor = Unpack(o.Find(x => x.tintColor));
  50. m_BloomMip = Unpack(o.Find(x => x.bloomMip));
  51. m_FirstFlareIntensity = Unpack(o.Find(x => x.firstFlareIntensity));
  52. m_SecondaryFlareIntensity = Unpack(o.Find(x => x.secondaryFlareIntensity));
  53. m_WarpedFlareIntensity = Unpack(o.Find(x => x.warpedFlareIntensity));
  54. m_WarpedFlareScale = Unpack(o.Find(x => x.warpedFlareScale));
  55. m_Samples = Unpack(o.Find(x => x.samples));
  56. m_SampleDimmer = Unpack(o.Find(x => x.sampleDimmer));
  57. m_VignetteEffect = Unpack(o.Find(x => x.vignetteEffect));
  58. m_StartingPosition = Unpack(o.Find(x => x.startingPosition));
  59. m_Scale = Unpack(o.Find(x => x.scale));
  60. m_ChromaticAbberationIntensity = Unpack(o.Find(x => x.chromaticAbberationIntensity));
  61. m_StreaksIntensity = Unpack(o.Find(x => x.streaksIntensity));
  62. m_StreaksLength = Unpack(o.Find(x => x.streaksLength));
  63. m_StreaksOrientation = Unpack(o.Find(x => x.streaksOrientation));
  64. m_StreaksThreshold = Unpack(o.Find(x => x.streaksThreshold));
  65. m_Resolution = Unpack(o.Find(x => x.resolution));
  66. }
  67. public override void OnInspectorGUI()
  68. {
  69. PropertyField(m_Intensity, s_Intensity);
  70. PropertyField(m_TintColor, s_TintColor);
  71. PropertyField(m_BloomMip, s_BloomMip);
  72. //Regular Flares
  73. PropertyField(m_FirstFlareIntensity, s_FirstFlareIntensity);
  74. PropertyField(m_SecondaryFlareIntensity, s_SecondaryFlareIntensity);
  75. PropertyField(m_WarpedFlareIntensity, s_WarpedFlareIntensity);
  76. if(showAdditionalProperties)
  77. {
  78. using (new IndentLevelScope())
  79. {
  80. PropertyField(m_WarpedFlareScale, s_WarpedFlareScale);
  81. }
  82. }
  83. //Parameters for Regular Flares
  84. PropertyField(m_Samples, s_Samples);
  85. if(showAdditionalProperties)
  86. {
  87. using (new IndentLevelScope())
  88. {
  89. PropertyField(m_SampleDimmer, s_SampleDimmer);
  90. }
  91. }
  92. PropertyField(m_VignetteEffect, s_VignetteEffect);
  93. PropertyField(m_StartingPosition, s_StartingPosition);
  94. PropertyField(m_Scale, s_Scale);
  95. //Streaks
  96. PropertyField(m_StreaksIntensity, s_StreaksIntensity);
  97. using (new IndentLevelScope())
  98. {
  99. PropertyField(m_StreaksLength, s_StreaksLength);
  100. PropertyField(m_StreaksOrientation, s_StreaksOrientation);
  101. PropertyField(m_StreaksThreshold, s_StreaksThreshold);
  102. PropertyField(m_Resolution, s_Resolution);
  103. }
  104. //Chromatic Aberration
  105. PropertyField(m_ChromaticAbberationIntensity, s_ChromaticAbberationIntensity);
  106. }
  107. }
  108. }