HighlightProfile.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. using UnityEngine;
  2. namespace HighlightPlus {
  3. [CreateAssetMenu(menuName = "Highlight Plus Profile", fileName = "Highlight Plus Profile", order = 100)]
  4. [HelpURL("https://www.dropbox.com/s/1p9h8xys68lm4a3/Documentation.pdf?dl=0")]
  5. public class HighlightProfile : ScriptableObject {
  6. [Tooltip("Different options to specify which objects are affected by this Highlight Effect component.")]
  7. public TargetOptions effectGroup = TargetOptions.Children;
  8. [Tooltip("The layer that contains the affected objects by this effect when effectGroup is set to LayerMask.")]
  9. public LayerMask effectGroupLayer = -1;
  10. [Tooltip("Only include objects whose names contains this text.")]
  11. public string effectNameFilter;
  12. [Tooltip("Combine meshes of all objects in this group affected by Highlight Effect reducing draw calls.")]
  13. public bool combineMeshes;
  14. [Tooltip("The alpha threshold for transparent cutout objects. Pixels with alpha below this value will be discarded.")]
  15. [Range(0, 1)]
  16. public float alphaCutOff;
  17. [Tooltip("If back facing triangles are ignored.Backfaces triangles are not visible but you may set this property to false to force highlight effects to act on those triangles as well.")]
  18. public bool cullBackFaces = true;
  19. [Tooltip("Normals handling option:\nPreserve original: use original mesh normals.\nSmooth: average normals to produce a smoother outline/glow mesh based effect.\nReorient: recomputes normals based on vertex direction to centroid.")]
  20. public NormalsOption normalsOption;
  21. public float fadeInDuration;
  22. public float fadeOutDuration;
  23. [Tooltip("Fades out effects based on distance to camera")]
  24. public bool cameraDistanceFade;
  25. [Tooltip("The closest distance particles can get to the camera before they fade from the camera’s view.")]
  26. public float cameraDistanceFadeNear;
  27. [Tooltip("The farthest distance particles can get away from the camera before they fade from the camera’s view.")]
  28. public float cameraDistanceFadeFar = 1000;
  29. [Tooltip("Keeps the outline/glow size unaffected by object distance.")]
  30. public bool constantWidth = true;
  31. [Range(0, 1)]
  32. [Tooltip("Intensity of the overlay effect. A value of 0 disables the overlay completely.")]
  33. public float overlay;
  34. public OverlayMode overlayMode = OverlayMode.WhenHighlighted;
  35. [ColorUsage(true, true)] public Color overlayColor = Color.yellow;
  36. public float overlayAnimationSpeed = 1f;
  37. [Range(0, 1)]
  38. public float overlayMinIntensity = 0.5f;
  39. [Range(0, 1)]
  40. [Tooltip("Controls the blending or mix of the overlay color with the natural colors of the object.")]
  41. public float overlayBlending = 1.0f;
  42. [Tooltip("Optional overlay texture.")]
  43. public Texture2D overlayTexture;
  44. public TextureUVSpace overlayTextureUVSpace;
  45. public float overlayTextureScale = 1f;
  46. public Visibility overlayVisibility = Visibility.Normal;
  47. [Range(0, 1)]
  48. [Tooltip("Intensity of the outline. A value of 0 disables the outline completely.")]
  49. public float outline = 1f;
  50. [ColorUsage(true, true)] public Color outlineColor = Color.black;
  51. public ColorStyle outlineColorStyle = ColorStyle.SingleColor;
  52. [GradientUsage(hdr: true, ColorSpace.Linear)] public Gradient outlineGradient;
  53. public bool outlineGradientInLocalSpace;
  54. [Range(1, 3)]
  55. public int outlineBlurPasses = 2;
  56. public float outlineWidth = 0.45f;
  57. public QualityLevel outlineQuality = QualityLevel.High;
  58. public OutlineEdgeMode outlineEdgeMode = OutlineEdgeMode.Exterior;
  59. public float outlineEdgeThreshold = 0.995f;
  60. [Range(1, 8)]
  61. [Tooltip("Reduces the quality of the outline but improves performance a bit.")]
  62. public int outlineDownsampling = 1;
  63. public ContourStyle outlineContourStyle = ContourStyle.AroundVisibleParts;
  64. public Visibility outlineVisibility = Visibility.Normal;
  65. [Tooltip("If enabled, this object won't combine the outline with other objects.")]
  66. public bool outlineIndependent;
  67. [Range(0, 5)]
  68. [Tooltip("The intensity of the outer glow effect. A value of 0 disables the glow completely.")]
  69. public float glow;
  70. public float glowWidth = 0.4f;
  71. public QualityLevel glowQuality = QualityLevel.High;
  72. public BlurMethod glowBlurMethod = BlurMethod.Gaussian;
  73. [Range(1, 8)]
  74. [Tooltip("Reduces the quality of the glow but improves performance a bit.")]
  75. public int glowDownsampling = 2;
  76. [ColorUsage(true, true)] public Color glowHQColor = new Color(0.64f, 1f, 0f, 1f);
  77. [Tooltip("When enabled, outer glow renders with dithering. When disabled, glow appears as a solid color.")]
  78. public bool glowDithering = true;
  79. [Tooltip("Seed for the dithering effect")]
  80. public float glowMagicNumber1 = 0.75f;
  81. [Tooltip("Another seed for the dithering effect that combines with first seed to create different patterns")]
  82. public float glowMagicNumber2 = 0.5f;
  83. public float glowAnimationSpeed = 1f;
  84. public Visibility glowVisibility = Visibility.Normal;
  85. public GlowBlendMode glowBlendMode = GlowBlendMode.Additive;
  86. [Tooltip("Blends glow passes one after another. If this option is disabled, glow passes won't overlap (in this case, make sure the glow pass 1 has a smaller offset than pass 2, etc.)")]
  87. public bool glowBlendPasses = true;
  88. public GlowPassData[] glowPasses;
  89. [Tooltip("If enabled, glow effect will not use a stencil mask. This can be used to render the glow effect alone.")]
  90. public bool glowIgnoreMask;
  91. [Range(0, 5f)]
  92. [Tooltip("The intensity of the inner glow effect. A value of 0 disables the glow completely.")]
  93. public float innerGlow;
  94. [Range(0, 2)]
  95. public float innerGlowWidth = 1f;
  96. public InnerGlowBlendMode innerGlowBlendMode = InnerGlowBlendMode.Additive;
  97. [ColorUsage(true, true)] public Color innerGlowColor = Color.white;
  98. public Visibility innerGlowVisibility = Visibility.Normal;
  99. [Tooltip("Enables the targetFX effect. This effect draws an animated sprite over the object.")]
  100. public bool targetFX;
  101. public Texture2D targetFXTexture;
  102. [ColorUsage(true, true)] public Color targetFXColor = Color.white;
  103. public float targetFXRotationSpeed = 50f;
  104. public float targetFXInitialScale = 4f;
  105. public float targetFXEndScale = 1.5f;
  106. [Tooltip("Makes target scale relative to object renderer bounds.")]
  107. public bool targetFXScaleToRenderBounds;
  108. [Tooltip("Places target FX sprite at the bottom of the highlighted object.")]
  109. public bool targetFXAlignToGround;
  110. [Tooltip("Max distance from the center of the highlighted object to the ground.")]
  111. public float targetFXGroundMaxDistance = 15f;
  112. public LayerMask targetFXGroundLayerMask = -1;
  113. [Tooltip("Fade out effect with altitude")]
  114. public float targetFXFadePower = 32;
  115. public float targetFXTransitionDuration = 0.5f;
  116. public float targetFXStayDuration = 1.5f;
  117. public Visibility targetFXVisibility = Visibility.AlwaysOnTop;
  118. [Tooltip("See-through mode for this Highlight Effect component.")]
  119. public SeeThroughMode seeThrough = SeeThroughMode.Never;
  120. [Tooltip("This mask setting let you specify which objects will be considered as occluders and cause the see-through effect for this Highlight Effect component. For example, you assign your walls to a different layer and specify that layer here, so only walls and not other objects, like ground or ceiling, will trigger the see-through effect.")]
  121. public LayerMask seeThroughOccluderMask = -1;
  122. [Tooltip("Uses stencil buffers to ensure pixel-accurate occlusion test. If this option is disabled, only physics raycasting is used to test for occlusion.")]
  123. public bool seeThroughOccluderMaskAccurate;
  124. [Tooltip("A multiplier for the occluder volume size which can be used to reduce the actual size of occluders when Highlight Effect checks if they're occluding this object.")]
  125. [Range(0.01f, 0.9f)] public float seeThroughOccluderThreshold = 0.4f;
  126. [Tooltip("The interval of time between occlusion tests.")]
  127. public float seeThroughOccluderCheckInterval = 1f;
  128. [Tooltip("If enabled, occlusion test is performed for each children element. If disabled, the bounds of all children is combined and a single occlusion test is performed for the combined bounds.")]
  129. public bool seeThroughOccluderCheckIndividualObjects;
  130. [Tooltip("Shows the see-through effect only if the occluder if at this 'offset' distance from the object.")]
  131. public float seeThroughDepthOffset;
  132. [Tooltip("Hides the see-through effect if the occluder is further than this distance from the object (0 = infinite)")]
  133. public float seeThroughMaxDepth;
  134. [Range(0, 5f)] public float seeThroughIntensity = 0.8f;
  135. [Range(0, 1)] public float seeThroughTintAlpha = 0.5f;
  136. public Color seeThroughTintColor = Color.red;
  137. [Range(0, 1)] public float seeThroughNoise = 1f;
  138. [Range(0, 1)] public float seeThroughBorder;
  139. public Color seeThroughBorderColor = Color.black;
  140. public float seeThroughBorderWidth = 0.45f;
  141. [Tooltip("Only display the border instead of the full see-through effect.")]
  142. public bool seeThroughBorderOnly;
  143. [Tooltip("This option clears the stencil buffer after rendering the see-through effect which results in correct rendering order and supports other stencil-based effects that render afterwards.")]
  144. public bool seeThroughOrdered;
  145. [Tooltip("Optional see-through mask effect texture.")]
  146. public Texture2D seeThroughTexture;
  147. public TextureUVSpace seeThroughTextureUVSpace;
  148. public float seeThroughTextureScale = 1f;
  149. [Tooltip("The order by which children objects are rendered by the see-through effect")]
  150. public SeeThroughSortingMode seeThroughChildrenSortingMode = SeeThroughSortingMode.Default;
  151. [Range(0, 1)] public float hitFxInitialIntensity;
  152. public HitFxMode hitFxMode = HitFxMode.Overlay;
  153. public float hitFxFadeOutDuration = 0.25f;
  154. [ColorUsage(true, true)] public Color hitFxColor = Color.white;
  155. public float hitFxRadius = 0.5f;
  156. public void Load(HighlightEffect effect) {
  157. effect.effectGroup = effectGroup;
  158. effect.effectGroupLayer = effectGroupLayer;
  159. effect.effectNameFilter = effectNameFilter;
  160. effect.combineMeshes = combineMeshes;
  161. effect.alphaCutOff = alphaCutOff;
  162. effect.cullBackFaces = cullBackFaces;
  163. effect.normalsOption = normalsOption;
  164. effect.fadeInDuration = fadeInDuration;
  165. effect.fadeOutDuration = fadeOutDuration;
  166. effect.cameraDistanceFade = cameraDistanceFade;
  167. effect.cameraDistanceFadeFar = cameraDistanceFadeFar;
  168. effect.cameraDistanceFadeNear = cameraDistanceFadeNear;
  169. effect.constantWidth = constantWidth;
  170. effect.overlay = overlay;
  171. effect.overlayMode = overlayMode;
  172. effect.overlayColor = overlayColor;
  173. effect.overlayAnimationSpeed = overlayAnimationSpeed;
  174. effect.overlayMinIntensity = overlayMinIntensity;
  175. effect.overlayBlending = overlayBlending;
  176. effect.overlayTexture = overlayTexture;
  177. effect.overlayTextureUVSpace = overlayTextureUVSpace;
  178. effect.overlayTextureScale = overlayTextureScale;
  179. effect.overlayVisibility = overlayVisibility;
  180. effect.outline = outline;
  181. effect.outlineColor = outlineColor;
  182. effect.outlineColorStyle = outlineColorStyle;
  183. effect.outlineGradient = outlineGradient;
  184. effect.outlineGradientInLocalSpace = outlineGradientInLocalSpace;
  185. effect.outlineWidth = outlineWidth;
  186. effect.outlineBlurPasses = outlineBlurPasses;
  187. effect.outlineQuality = outlineQuality;
  188. effect.outlineEdgeMode = outlineEdgeMode;
  189. effect.outlineEdgeThreshold = outlineEdgeThreshold;
  190. effect.outlineDownsampling = outlineDownsampling;
  191. effect.outlineVisibility = outlineVisibility;
  192. effect.outlineIndependent = outlineIndependent;
  193. effect.outlineContourStyle = outlineContourStyle;
  194. effect.glow = glow;
  195. effect.glowWidth = glowWidth;
  196. effect.glowQuality = glowQuality;
  197. effect.glowBlurMethod = glowBlurMethod;
  198. effect.glowDownsampling = glowDownsampling;
  199. effect.glowHQColor = glowHQColor;
  200. effect.glowDithering = glowDithering;
  201. effect.glowMagicNumber1 = glowMagicNumber1;
  202. effect.glowMagicNumber2 = glowMagicNumber2;
  203. effect.glowAnimationSpeed = glowAnimationSpeed;
  204. effect.glowVisibility = glowVisibility;
  205. effect.glowBlendMode = glowBlendMode;
  206. effect.glowBlendPasses = glowBlendPasses;
  207. effect.glowPasses = GetGlowPassesCopy(glowPasses);
  208. effect.glowIgnoreMask = glowIgnoreMask;
  209. effect.innerGlow = innerGlow;
  210. effect.innerGlowWidth = innerGlowWidth;
  211. effect.innerGlowColor = innerGlowColor;
  212. effect.innerGlowBlendMode = innerGlowBlendMode;
  213. effect.innerGlowVisibility = innerGlowVisibility;
  214. effect.targetFX = targetFX;
  215. effect.targetFXColor = targetFXColor;
  216. effect.targetFXInitialScale = targetFXInitialScale;
  217. effect.targetFXEndScale = targetFXEndScale;
  218. effect.targetFXScaleToRenderBounds = targetFXScaleToRenderBounds;
  219. effect.targetFXAlignToGround = targetFXAlignToGround;
  220. effect.targetFXGroundMaxDistance = targetFXGroundMaxDistance;
  221. effect.targetFXGroundLayerMask = targetFXGroundLayerMask;
  222. effect.targetFXFadePower = targetFXFadePower;
  223. effect.targetFXRotationSpeed = targetFXRotationSpeed;
  224. effect.targetFXStayDuration = targetFXStayDuration;
  225. effect.targetFXTexture = targetFXTexture;
  226. effect.targetFXTransitionDuration = targetFXTransitionDuration;
  227. effect.targetFXVisibility = targetFXVisibility;
  228. effect.seeThrough = seeThrough;
  229. effect.seeThroughOccluderMask = seeThroughOccluderMask;
  230. effect.seeThroughOccluderMaskAccurate = seeThroughOccluderMaskAccurate;
  231. effect.seeThroughOccluderThreshold = seeThroughOccluderThreshold;
  232. effect.seeThroughOccluderCheckInterval = seeThroughOccluderCheckInterval;
  233. effect.seeThroughOccluderCheckIndividualObjects = seeThroughOccluderCheckIndividualObjects;
  234. effect.seeThroughIntensity = seeThroughIntensity;
  235. effect.seeThroughTintAlpha = seeThroughTintAlpha;
  236. effect.seeThroughTintColor = seeThroughTintColor;
  237. effect.seeThroughNoise = seeThroughNoise;
  238. effect.seeThroughBorder = seeThroughBorder;
  239. effect.seeThroughBorderColor = seeThroughBorderColor;
  240. effect.seeThroughBorderWidth = seeThroughBorderWidth;
  241. effect.seeThroughBorderOnly = seeThroughBorderOnly;
  242. effect.seeThroughDepthOffset = seeThroughDepthOffset;
  243. effect.seeThroughMaxDepth = seeThroughMaxDepth;
  244. effect.seeThroughOrdered = seeThroughOrdered;
  245. effect.seeThroughTexture = seeThroughTexture;
  246. effect.seeThroughTextureScale = seeThroughTextureScale;
  247. effect.seeThroughTextureUVSpace = seeThroughTextureUVSpace;
  248. effect.seeThroughChildrenSortingMode = seeThroughChildrenSortingMode;
  249. effect.hitFxInitialIntensity = hitFxInitialIntensity;
  250. effect.hitFxMode = hitFxMode;
  251. effect.hitFxFadeOutDuration = hitFxFadeOutDuration;
  252. effect.hitFxColor = hitFxColor;
  253. effect.hitFxRadius = hitFxRadius;
  254. effect.UpdateMaterialProperties();
  255. }
  256. public void Save(HighlightEffect effect) {
  257. effectGroup = effect.effectGroup;
  258. effectGroupLayer = effect.effectGroupLayer;
  259. effectNameFilter = effect.effectNameFilter;
  260. combineMeshes = effect.combineMeshes;
  261. alphaCutOff = effect.alphaCutOff;
  262. cullBackFaces = effect.cullBackFaces;
  263. normalsOption = effect.normalsOption;
  264. fadeInDuration = effect.fadeInDuration;
  265. fadeOutDuration = effect.fadeOutDuration;
  266. cameraDistanceFade = effect.cameraDistanceFade;
  267. cameraDistanceFadeFar = effect.cameraDistanceFadeFar;
  268. cameraDistanceFadeNear = effect.cameraDistanceFadeNear;
  269. constantWidth = effect.constantWidth;
  270. overlay = effect.overlay;
  271. overlayMode = effect.overlayMode;
  272. overlayColor = effect.overlayColor;
  273. overlayAnimationSpeed = effect.overlayAnimationSpeed;
  274. overlayMinIntensity = effect.overlayMinIntensity;
  275. overlayBlending = effect.overlayBlending;
  276. overlayTexture = effect.overlayTexture;
  277. overlayTextureUVSpace = effect.overlayTextureUVSpace;
  278. overlayTextureScale = effect.overlayTextureScale;
  279. overlayVisibility = effect.overlayVisibility;
  280. outline = effect.outline;
  281. outlineColor = effect.outlineColor;
  282. outlineColorStyle = effect.outlineColorStyle;
  283. outlineGradient = effect.outlineGradient;
  284. outlineGradientInLocalSpace = effect.outlineGradientInLocalSpace;
  285. outlineWidth = effect.outlineWidth;
  286. outlineBlurPasses = effect.outlineBlurPasses;
  287. outlineQuality = effect.outlineQuality;
  288. outlineEdgeMode = effect.outlineEdgeMode;
  289. outlineEdgeThreshold = effect.outlineEdgeThreshold;
  290. outlineDownsampling = effect.outlineDownsampling;
  291. outlineVisibility = effect.outlineVisibility;
  292. outlineIndependent = effect.outlineIndependent;
  293. outlineContourStyle = effect.outlineContourStyle;
  294. glow = effect.glow;
  295. glowWidth = effect.glowWidth;
  296. glowQuality = effect.glowQuality;
  297. glowBlurMethod = effect.glowBlurMethod;
  298. glowDownsampling = effect.glowDownsampling;
  299. glowHQColor = effect.glowHQColor;
  300. glowDithering = effect.glowDithering;
  301. glowMagicNumber1 = effect.glowMagicNumber1;
  302. glowMagicNumber2 = effect.glowMagicNumber2;
  303. glowAnimationSpeed = effect.glowAnimationSpeed;
  304. glowVisibility = effect.glowVisibility;
  305. glowBlendMode = effect.glowBlendMode;
  306. glowBlendPasses = effect.glowBlendPasses;
  307. glowPasses = GetGlowPassesCopy(effect.glowPasses);
  308. glowIgnoreMask = effect.glowIgnoreMask;
  309. innerGlow = effect.innerGlow;
  310. innerGlowWidth = effect.innerGlowWidth;
  311. innerGlowColor = effect.innerGlowColor;
  312. innerGlowBlendMode = effect.innerGlowBlendMode;
  313. innerGlowVisibility = effect.innerGlowVisibility;
  314. targetFX = effect.targetFX;
  315. targetFXColor = effect.targetFXColor;
  316. targetFXInitialScale = effect.targetFXInitialScale;
  317. targetFXEndScale = effect.targetFXEndScale;
  318. targetFXScaleToRenderBounds = effect.targetFXScaleToRenderBounds;
  319. targetFXAlignToGround = effect.targetFXAlignToGround;
  320. targetFXGroundMaxDistance = effect.targetFXGroundMaxDistance;
  321. targetFXGroundLayerMask = effect.targetFXGroundLayerMask;
  322. targetFXFadePower = effect.targetFXFadePower;
  323. targetFXRotationSpeed = effect.targetFXRotationSpeed;
  324. targetFXStayDuration = effect.targetFXStayDuration;
  325. targetFXTexture = effect.targetFXTexture;
  326. targetFXTransitionDuration = effect.targetFXTransitionDuration;
  327. targetFXVisibility = effect.targetFXVisibility;
  328. seeThrough = effect.seeThrough;
  329. seeThroughOccluderMask = effect.seeThroughOccluderMask;
  330. seeThroughOccluderMaskAccurate = effect.seeThroughOccluderMaskAccurate;
  331. seeThroughOccluderThreshold = effect.seeThroughOccluderThreshold;
  332. seeThroughOccluderCheckInterval = effect.seeThroughOccluderCheckInterval;
  333. seeThroughOccluderCheckIndividualObjects = effect.seeThroughOccluderCheckIndividualObjects;
  334. seeThroughIntensity = effect.seeThroughIntensity;
  335. seeThroughTintAlpha = effect.seeThroughTintAlpha;
  336. seeThroughTintColor = effect.seeThroughTintColor;
  337. seeThroughNoise = effect.seeThroughNoise;
  338. seeThroughBorder = effect.seeThroughBorder;
  339. seeThroughBorderColor = effect.seeThroughBorderColor;
  340. seeThroughBorderWidth = effect.seeThroughBorderWidth;
  341. seeThroughDepthOffset = effect.seeThroughDepthOffset;
  342. seeThroughBorderOnly = effect.seeThroughBorderOnly;
  343. seeThroughMaxDepth = effect.seeThroughMaxDepth;
  344. seeThroughOrdered = effect.seeThroughOrdered;
  345. seeThroughTexture = effect.seeThroughTexture;
  346. seeThroughTextureScale = effect.seeThroughTextureScale;
  347. seeThroughTextureUVSpace = effect.seeThroughTextureUVSpace;
  348. seeThroughChildrenSortingMode = effect.seeThroughChildrenSortingMode;
  349. hitFxInitialIntensity = effect.hitFxInitialIntensity;
  350. hitFxMode = effect.hitFxMode;
  351. hitFxFadeOutDuration = effect.hitFxFadeOutDuration;
  352. hitFxColor = effect.hitFxColor;
  353. hitFxRadius = effect.hitFxRadius;
  354. }
  355. GlowPassData[] GetGlowPassesCopy(GlowPassData[] glowPasses) {
  356. if (glowPasses == null) {
  357. return new GlowPassData[0];
  358. }
  359. GlowPassData[] pd = new GlowPassData[glowPasses.Length];
  360. for (int k = 0; k < glowPasses.Length; k++) {
  361. pd[k].alpha = glowPasses[k].alpha;
  362. pd[k].color = glowPasses[k].color;
  363. pd[k].offset = glowPasses[k].offset;
  364. }
  365. return pd;
  366. }
  367. private void OnValidate() {
  368. outlineEdgeThreshold = Mathf.Clamp01(outlineEdgeThreshold);
  369. seeThroughDepthOffset = Mathf.Max(0, seeThroughDepthOffset);
  370. seeThroughMaxDepth = Mathf.Max(0, seeThroughMaxDepth);
  371. seeThroughBorderWidth = Mathf.Max(0, seeThroughBorderWidth);
  372. targetFXFadePower = Mathf.Max(0, targetFXFadePower);
  373. cameraDistanceFadeNear = Mathf.Max(0, cameraDistanceFadeNear);
  374. cameraDistanceFadeFar = Mathf.Max(0, cameraDistanceFadeFar);
  375. if (glowPasses == null || glowPasses.Length == 0) {
  376. glowPasses = new GlowPassData[4];
  377. glowPasses[0] = new GlowPassData() { offset = 4, alpha = 0.1f, color = new Color(0.64f, 1f, 0f, 1f) };
  378. glowPasses[1] = new GlowPassData() { offset = 3, alpha = 0.2f, color = new Color(0.64f, 1f, 0f, 1f) };
  379. glowPasses[2] = new GlowPassData() { offset = 2, alpha = 0.3f, color = new Color(0.64f, 1f, 0f, 1f) };
  380. glowPasses[3] = new GlowPassData() { offset = 1, alpha = 0.4f, color = new Color(0.64f, 1f, 0f, 1f) };
  381. }
  382. }
  383. }
  384. }