SkyMaterialController.cs 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Funly.SkyStudio
  5. {
  6. // This class manages the API for setting values on the sky shader.
  7. public class SkyMaterialController : System.Object
  8. {
  9. [SerializeField]
  10. private Material _skyboxMaterial;
  11. public Material SkyboxMaterial
  12. {
  13. get { return _skyboxMaterial; }
  14. set
  15. {
  16. _skyboxMaterial = value;
  17. RenderSettings.skybox = _skyboxMaterial;
  18. }
  19. }
  20. [SerializeField]
  21. private Color _skyColor = ColorHelper.ColorWithHex(0x2C2260);
  22. public Color SkyColor
  23. {
  24. get { return _skyColor; }
  25. set {
  26. _skyColor = value;
  27. SkyboxMaterial.SetColor("_GradientSkyUpperColor", _skyColor);
  28. }
  29. }
  30. [SerializeField]
  31. private Color _skyMiddleColor = Color.white;
  32. public Color SkyMiddleColor
  33. {
  34. get { return _skyMiddleColor; }
  35. set
  36. {
  37. _skyMiddleColor = value;
  38. SkyboxMaterial.SetColor("_GradientSkyMiddleColor", _skyMiddleColor);
  39. }
  40. }
  41. [SerializeField]
  42. private Color _horizonColor = ColorHelper.ColorWithHex(0xE3C882);
  43. public Color HorizonColor
  44. {
  45. get { return _horizonColor; }
  46. set {
  47. _horizonColor = value;
  48. SkyboxMaterial.SetColor("_GradientSkyLowerColor", _horizonColor);
  49. }
  50. }
  51. [SerializeField, Range(-1, 1)]
  52. private float _gradientFadeBegin = 0.0f;
  53. public float GradientFadeBegin
  54. {
  55. get { return _gradientFadeBegin; }
  56. set {
  57. _gradientFadeBegin = value;
  58. ApplyGradientValuesOnMaterial();
  59. }
  60. }
  61. [SerializeField, Range(0, 2)]
  62. private float _gradientFadeLength = 1.0f;
  63. public float GradientFadeLength
  64. {
  65. get { return _gradientFadeLength; }
  66. set {
  67. _gradientFadeLength = value;
  68. ApplyGradientValuesOnMaterial();
  69. }
  70. }
  71. [SerializeField, Range(0, 1)]
  72. private float _skyMiddlePosition = .5f;
  73. public float SkyMiddlePosition
  74. {
  75. get { return _skyMiddlePosition; }
  76. set
  77. {
  78. _skyMiddlePosition = value;
  79. SkyboxMaterial.SetFloat("_GradientFadeMiddlePosition", _skyMiddlePosition);
  80. }
  81. }
  82. [SerializeField]
  83. private Cubemap _backgroundCubemap;
  84. public Cubemap BackgroundCubemap
  85. {
  86. get { return _backgroundCubemap; }
  87. set {
  88. _backgroundCubemap = value;
  89. SkyboxMaterial.SetTexture("_MainTex", _backgroundCubemap);
  90. }
  91. }
  92. [SerializeField, Range(-1, 1)]
  93. private float _starFadeBegin = .067f;
  94. public float StarFadeBegin
  95. {
  96. get { return _starFadeBegin; }
  97. set {
  98. _starFadeBegin = value;
  99. ApplyStarFadeValuesOnMaterial();
  100. }
  101. }
  102. [SerializeField, Range(0, 2)]
  103. private float _starFadeLength = .36f;
  104. public float StarFadeLength
  105. {
  106. get { return _starFadeLength; }
  107. set {
  108. _starFadeLength = value;
  109. ApplyStarFadeValuesOnMaterial();
  110. }
  111. }
  112. [SerializeField, Range(0, 1)]
  113. private float _horizonDistanceScale = .7f;
  114. public float HorizonDistanceScale
  115. {
  116. get { return _horizonDistanceScale; }
  117. set {
  118. _horizonDistanceScale = value;
  119. SkyboxMaterial.SetFloat("_HorizonScaleFactor", _horizonDistanceScale);
  120. }
  121. }
  122. // Stars Basic.
  123. [SerializeField]
  124. private Texture _starBasicCubemap;
  125. public Texture StarBasicCubemap {
  126. get { return _starBasicCubemap; }
  127. set {
  128. _starBasicCubemap = value;
  129. SkyboxMaterial.SetTexture("_StarBasicCubemap", _starBasicCubemap);
  130. }
  131. }
  132. [SerializeField]
  133. private float _starBasicTwinkleSpeed;
  134. public float StarBasicTwinkleSpeed {
  135. get { return _starBasicTwinkleSpeed; }
  136. set {
  137. _starBasicTwinkleSpeed = value;
  138. SkyboxMaterial.SetFloat("_StarBasicTwinkleSpeed", _starBasicTwinkleSpeed);
  139. }
  140. }
  141. [SerializeField]
  142. private float _starBasicTwinkleAmount;
  143. public float StarBasicTwinkleAmount {
  144. get { return _starBasicTwinkleAmount; }
  145. set {
  146. _starBasicTwinkleAmount = value;
  147. SkyboxMaterial.SetFloat("_StarBasicTwinkleAmount", _starBasicTwinkleAmount);
  148. }
  149. }
  150. [SerializeField]
  151. private float _starBasicOpacity;
  152. public float StarBasicOpacity {
  153. get { return _starBasicOpacity; }
  154. set {
  155. _starBasicOpacity = value;
  156. SkyboxMaterial.SetFloat("_StarBasicOpacity", _starBasicOpacity);
  157. }
  158. }
  159. [SerializeField]
  160. private Color _starBasicTintColor;
  161. public Color StarBasicTintColor {
  162. get { return _starBasicTintColor; }
  163. set {
  164. _starBasicTintColor = value;
  165. SkyboxMaterial.SetColor("_StarBasicTintColor", _starBasicTintColor);
  166. }
  167. }
  168. [SerializeField]
  169. private float _starBasicExponent;
  170. public float StarBasicExponent {
  171. get { return _starBasicExponent; }
  172. set {
  173. _starBasicExponent = value;
  174. SkyboxMaterial.SetFloat("_StarBasicExponent", _starBasicExponent);
  175. }
  176. }
  177. [SerializeField]
  178. private float _starBasicIntensity;
  179. public float StarBasicIntensity {
  180. get { return _starBasicIntensity; }
  181. set {
  182. _starBasicIntensity = value;
  183. SkyboxMaterial.SetFloat("_StarBasicHDRBoost", _starBasicIntensity);
  184. }
  185. }
  186. // Star layer 1.
  187. [SerializeField]
  188. private Texture _starLayer1Texture;
  189. public Texture StarLayer1Texture
  190. {
  191. get { return _starLayer1Texture; }
  192. set {
  193. _starLayer1Texture = value;
  194. SkyboxMaterial.SetTexture("_StarLayer1Tex", _starLayer1Texture);
  195. }
  196. }
  197. [SerializeField]
  198. private Texture2D _starLayer1DataTexture;
  199. public Texture2D StarLayer1DataTexture
  200. {
  201. get { return _starLayer1DataTexture; }
  202. set {
  203. _starLayer1DataTexture = value;
  204. SkyboxMaterial.SetTexture("_StarLayer1DataTex", value);
  205. }
  206. }
  207. [SerializeField]
  208. private Color _starLayer1Color;
  209. public Color StarLayer1Color
  210. {
  211. get { return _starLayer1Color; }
  212. set {
  213. _starLayer1Color = value;
  214. SkyboxMaterial.SetColor("_StarLayer1Color", _starLayer1Color);
  215. }
  216. }
  217. [SerializeField, Range(0, .1f)]
  218. private float _starLayer1MaxRadius = .007f;
  219. public float StarLayer1MaxRadius
  220. {
  221. get { return _starLayer1MaxRadius; }
  222. set {
  223. _starLayer1MaxRadius = value;
  224. SkyboxMaterial.SetFloat("_StarLayer1MaxRadius", _starLayer1MaxRadius);
  225. }
  226. }
  227. [SerializeField, Range(0, 1)]
  228. private float _starLayer1TwinkleAmount = .7f;
  229. public float StarLayer1TwinkleAmount
  230. {
  231. get { return _starLayer1TwinkleAmount; }
  232. set {
  233. _starLayer1TwinkleAmount = value;
  234. SkyboxMaterial.SetFloat("_StarLayer1TwinkleAmount", _starLayer1TwinkleAmount);
  235. }
  236. }
  237. [SerializeField, Range(0, 10)]
  238. private float _starLayer1TwinkleSpeed = .7f;
  239. public float StarLayer1TwinkleSpeed
  240. {
  241. get { return _starLayer1TwinkleSpeed; }
  242. set {
  243. _starLayer1TwinkleSpeed = value;
  244. SkyboxMaterial.SetFloat("_StarLayer1TwinkleSpeed", _starLayer1TwinkleSpeed);
  245. }
  246. }
  247. [SerializeField, Range(0, 10)]
  248. private float _starLayer1RotationSpeed = .7f;
  249. public float StarLayer1RotationSpeed
  250. {
  251. get { return _starLayer1RotationSpeed; }
  252. set {
  253. _starLayer1RotationSpeed = value;
  254. SkyboxMaterial.SetFloat("_StarLayer1RotationSpeed", _starLayer1RotationSpeed);
  255. }
  256. }
  257. [SerializeField, Range(0.0001f, .9999f)]
  258. private float _starLayer1EdgeFeathering = .2f;
  259. public float StarLayer1EdgeFeathering
  260. {
  261. get { return _starLayer1EdgeFeathering; }
  262. set {
  263. _starLayer1EdgeFeathering = value;
  264. SkyboxMaterial.SetFloat("_StarLayer1EdgeFade", _starLayer1EdgeFeathering);
  265. }
  266. }
  267. [SerializeField, Range(1, 10)]
  268. private float _starLayer1BloomFilterBoost;
  269. public float StarLayer1BloomFilterBoost
  270. {
  271. get { return _starLayer1BloomFilterBoost; }
  272. set {
  273. _starLayer1BloomFilterBoost = value;
  274. SkyboxMaterial.SetFloat("_StarLayer1HDRBoost", _starLayer1BloomFilterBoost);
  275. }
  276. }
  277. [SerializeField]
  278. private Vector4 _starLayer1SpriteDimensions = Vector4.zero;
  279. public void SetStarLayer1SpriteDimensions(int columns, int rows)
  280. {
  281. _starLayer1SpriteDimensions.x = columns;
  282. _starLayer1SpriteDimensions.y = rows;
  283. SkyboxMaterial.SetVector("_StarLayer1SpriteDimensions", _starLayer1SpriteDimensions);
  284. }
  285. public Vector2 GetStarLayer1SpriteDimensions()
  286. {
  287. return new Vector2(_starLayer1SpriteDimensions.x, _starLayer1SpriteDimensions.y);
  288. }
  289. [SerializeField]
  290. private int _starLayer1SpriteItemCount = 1;
  291. public int StarLayer1SpriteItemCount
  292. {
  293. get { return _starLayer1SpriteItemCount; }
  294. set {
  295. _starLayer1SpriteItemCount = value;
  296. SkyboxMaterial.SetInt("_StarLayer1SpriteItemCount", _starLayer1SpriteItemCount);
  297. }
  298. }
  299. [SerializeField, Range(0.0f, 1.0f)]
  300. private float _starLayer1SpriteAnimationSpeed = 1.0f;
  301. public float StarLayer1SpriteAnimationSpeed
  302. {
  303. get { return _starLayer1SpriteAnimationSpeed; }
  304. set {
  305. _starLayer1SpriteAnimationSpeed = value;
  306. SkyboxMaterial.SetFloat("_StarLayer1SpriteAnimationSpeed", _starLayer1SpriteAnimationSpeed);
  307. }
  308. }
  309. // Star layer 2.
  310. [SerializeField]
  311. private Texture _starLayer2Texture;
  312. public Texture StarLayer2Texture
  313. {
  314. get { return _starLayer2Texture; }
  315. set {
  316. _starLayer2Texture = value;
  317. SkyboxMaterial.SetTexture("_StarLayer2Tex", _starLayer2Texture);
  318. }
  319. }
  320. [SerializeField]
  321. private Texture2D _starLayer2DataTexture;
  322. public Texture2D StarLayer2DataTexture
  323. {
  324. get { return _starLayer2DataTexture; }
  325. set {
  326. _starLayer2DataTexture = value;
  327. SkyboxMaterial.SetTexture("_StarLayer2DataTex", value);
  328. }
  329. }
  330. [SerializeField]
  331. private Color _starLayer2Color;
  332. public Color StarLayer2Color
  333. {
  334. get { return _starLayer2Color; }
  335. set {
  336. _starLayer2Color = value;
  337. SkyboxMaterial.SetColor("_StarLayer2Color", _starLayer2Color);
  338. }
  339. }
  340. [SerializeField, Range(0, .1f)]
  341. private float _starLayer2MaxRadius = .007f;
  342. public float StarLayer2MaxRadius
  343. {
  344. get { return _starLayer2MaxRadius; }
  345. set {
  346. _starLayer2MaxRadius = value;
  347. SkyboxMaterial.SetFloat("_StarLayer2MaxRadius", _starLayer2MaxRadius);
  348. }
  349. }
  350. [SerializeField, Range(0, 1)]
  351. private float _starLayer2TwinkleAmount = .7f;
  352. public float StarLayer2TwinkleAmount
  353. {
  354. get { return _starLayer2TwinkleAmount; }
  355. set {
  356. _starLayer2TwinkleAmount = value;
  357. SkyboxMaterial.SetFloat("_StarLayer2TwinkleAmount", _starLayer2TwinkleAmount);
  358. }
  359. }
  360. [SerializeField, Range(0, 10)]
  361. private float _starLayer2TwinkleSpeed = .7f;
  362. public float StarLayer2TwinkleSpeed
  363. {
  364. get { return _starLayer2TwinkleSpeed; }
  365. set {
  366. _starLayer2TwinkleSpeed = value;
  367. SkyboxMaterial.SetFloat("_StarLayer2TwinkleSpeed", _starLayer2TwinkleSpeed);
  368. }
  369. }
  370. [SerializeField, Range(0, 10)]
  371. private float _starLayer2RotationSpeed = .7f;
  372. public float StarLayer2RotationSpeed
  373. {
  374. get { return _starLayer2RotationSpeed; }
  375. set {
  376. _starLayer2RotationSpeed = value;
  377. SkyboxMaterial.SetFloat("_StarLayer2RotationSpeed", _starLayer2RotationSpeed);
  378. }
  379. }
  380. [SerializeField, Range(0.0001f, .9999f)]
  381. private float _starLayer2EdgeFeathering = .2f;
  382. public float StarLayer2EdgeFeathering
  383. {
  384. get { return _starLayer2EdgeFeathering; }
  385. set {
  386. _starLayer2EdgeFeathering = value;
  387. SkyboxMaterial.SetFloat("_StarLayer2EdgeFade", _starLayer2EdgeFeathering);
  388. }
  389. }
  390. [SerializeField, Range(1, 10)]
  391. private float _starLayer2BloomFilterBoost;
  392. public float StarLayer2BloomFilterBoost
  393. {
  394. get { return _starLayer2BloomFilterBoost; }
  395. set {
  396. _starLayer2BloomFilterBoost = value;
  397. SkyboxMaterial.SetFloat("_StarLayer2HDRBoost", _starLayer2BloomFilterBoost);
  398. }
  399. }
  400. [SerializeField]
  401. private Vector4 _starLayer2SpriteDimensions = Vector4.zero;
  402. public void SetStarLayer2SpriteDimensions(int columns, int rows)
  403. {
  404. _starLayer2SpriteDimensions.x = columns;
  405. _starLayer2SpriteDimensions.y = rows;
  406. SkyboxMaterial.SetVector("_StarLayer2SpriteDimensions", _starLayer2SpriteDimensions);
  407. }
  408. public Vector2 GetStarLayer2SpriteDimensions()
  409. {
  410. return new Vector2(_starLayer2SpriteDimensions.x, _starLayer2SpriteDimensions.y);
  411. }
  412. [SerializeField]
  413. private int _starLayer2SpriteItemCount = 1;
  414. public int StarLayer2SpriteItemCount
  415. {
  416. get { return _starLayer2SpriteItemCount; }
  417. set {
  418. _starLayer2SpriteItemCount = value;
  419. SkyboxMaterial.SetInt("_StarLayer2SpriteItemCount", _starLayer2SpriteItemCount);
  420. }
  421. }
  422. [SerializeField, Range(0.0f, 1.0f)]
  423. private float _starLayer2SpriteAnimationSpeed = 1.0f;
  424. public float StarLayer2SpriteAnimationSpeed
  425. {
  426. get { return _starLayer2SpriteAnimationSpeed; }
  427. set {
  428. _starLayer2SpriteAnimationSpeed = value;
  429. SkyboxMaterial.SetFloat("_StarLayer2SpriteAnimationSpeed", _starLayer2SpriteAnimationSpeed);
  430. }
  431. }
  432. // Star layer 3.
  433. [SerializeField]
  434. private Texture _starLayer3Texture;
  435. public Texture StarLayer3Texture
  436. {
  437. get { return _starLayer3Texture; }
  438. set {
  439. _starLayer3Texture = value;
  440. SkyboxMaterial.SetTexture("_StarLayer3Tex", _starLayer3Texture);
  441. }
  442. }
  443. [SerializeField]
  444. private Texture2D _starLayer3DataTexture;
  445. public Texture2D StarLayer3DataTexture
  446. {
  447. get { return _starLayer3DataTexture; }
  448. set {
  449. _starLayer3DataTexture = value;
  450. SkyboxMaterial.SetTexture("_StarLayer3DataTex", value);
  451. }
  452. }
  453. [SerializeField]
  454. private Color _starLayer3Color;
  455. public Color StarLayer3Color
  456. {
  457. get { return _starLayer3Color; }
  458. set {
  459. _starLayer3Color = value;
  460. SkyboxMaterial.SetColor("_StarLayer3Color", _starLayer3Color);
  461. }
  462. }
  463. [SerializeField, Range(0, .1f)]
  464. private float _starLayer3MaxRadius = .007f;
  465. public float StarLayer3MaxRadius
  466. {
  467. get { return _starLayer3MaxRadius; }
  468. set {
  469. _starLayer3MaxRadius = value;
  470. SkyboxMaterial.SetFloat("_StarLayer3MaxRadius", _starLayer3MaxRadius);
  471. }
  472. }
  473. [SerializeField, Range(0, 1)]
  474. private float _starLayer3TwinkleAmount = .7f;
  475. public float StarLayer3TwinkleAmount
  476. {
  477. get { return _starLayer3TwinkleAmount; }
  478. set {
  479. _starLayer3TwinkleAmount = value;
  480. SkyboxMaterial.SetFloat("_StarLayer3TwinkleAmount", _starLayer3TwinkleAmount);
  481. }
  482. }
  483. [SerializeField, Range(0, 10)]
  484. private float _starLayer3TwinkleSpeed = .7f;
  485. public float StarLayer3TwinkleSpeed
  486. {
  487. get { return _starLayer3TwinkleSpeed; }
  488. set {
  489. _starLayer3TwinkleSpeed = value;
  490. SkyboxMaterial.SetFloat("_StarLayer3TwinkleSpeed", _starLayer3TwinkleSpeed);
  491. }
  492. }
  493. [SerializeField, Range(0, 10)]
  494. private float _starLayer3RotationSpeed = .7f;
  495. public float StarLayer3RotationSpeed
  496. {
  497. get { return _starLayer3RotationSpeed; }
  498. set {
  499. _starLayer3RotationSpeed = value;
  500. SkyboxMaterial.SetFloat("_StarLayer3RotationSpeed", _starLayer3RotationSpeed);
  501. }
  502. }
  503. [SerializeField, Range(0.0001f, .9999f)]
  504. private float _starLayer3EdgeFeathering = .2f;
  505. public float StarLayer3EdgeFeathering
  506. {
  507. get { return _starLayer3EdgeFeathering; }
  508. set {
  509. _starLayer3EdgeFeathering = value;
  510. SkyboxMaterial.SetFloat("_StarLayer3EdgeFade", _starLayer3EdgeFeathering);
  511. }
  512. }
  513. [SerializeField, Range(1, 10)]
  514. private float _starLayer3BloomFilterBoost;
  515. public float StarLayer3BloomFilterBoost
  516. {
  517. get { return _starLayer3BloomFilterBoost; }
  518. set {
  519. _starLayer3BloomFilterBoost = value;
  520. SkyboxMaterial.SetFloat("_StarLayer3HDRBoost", _starLayer3BloomFilterBoost);
  521. }
  522. }
  523. [SerializeField]
  524. private Vector4 _starLayer3SpriteDimensions = Vector4.zero;
  525. public void SetStarLayer3SpriteDimensions(int columns, int rows)
  526. {
  527. _starLayer3SpriteDimensions.x = columns;
  528. _starLayer3SpriteDimensions.y = rows;
  529. SkyboxMaterial.SetVector("_StarLayer3SpriteDimensions", _starLayer3SpriteDimensions);
  530. }
  531. public Vector2 GetStarLayer3SpriteDimensions()
  532. {
  533. return new Vector2(_starLayer3SpriteDimensions.x, _starLayer3SpriteDimensions.y);
  534. }
  535. [SerializeField]
  536. private int _starLayer3SpriteItemCount = 1;
  537. public int StarLayer3SpriteItemCount
  538. {
  539. get { return _starLayer3SpriteItemCount; }
  540. set {
  541. _starLayer3SpriteItemCount = value;
  542. SkyboxMaterial.SetInt("_StarLayer3SpriteItemCount", _starLayer3SpriteItemCount);
  543. }
  544. }
  545. [SerializeField, Range(0.0f, 1.0f)]
  546. private float _starLayer3SpriteAnimationSpeed = 1.0f;
  547. public float StarLayer3SpriteAnimationSpeed
  548. {
  549. get { return _starLayer3SpriteAnimationSpeed; }
  550. set {
  551. _starLayer3SpriteAnimationSpeed = value;
  552. SkyboxMaterial.SetFloat("_StarLayer3SpriteAnimationSpeed", _starLayer3SpriteAnimationSpeed);
  553. }
  554. }
  555. // Moon
  556. [SerializeField]
  557. private Texture _moonTexture;
  558. public Texture MoonTexture
  559. {
  560. get { return _moonTexture; }
  561. set {
  562. _moonTexture = value;
  563. SkyboxMaterial.SetTexture("_MoonTex", _moonTexture);
  564. }
  565. }
  566. [SerializeField]
  567. private float _moonRotationSpeed = 0;
  568. public float MoonRotationSpeed
  569. {
  570. get { return _moonRotationSpeed; }
  571. set
  572. {
  573. _moonRotationSpeed = value;
  574. SkyboxMaterial.SetFloat("_MoonRotationSpeed", _moonRotationSpeed);
  575. }
  576. }
  577. [SerializeField]
  578. private Color _moonColor = Color.white;
  579. public Color MoonColor
  580. {
  581. get { return _moonColor; }
  582. set {
  583. _moonColor = value;
  584. SkyboxMaterial.SetColor("_MoonColor", _moonColor);
  585. }
  586. }
  587. [SerializeField]
  588. private Vector3 _moonDirection = Vector3.right;
  589. public Vector3 MoonDirection
  590. {
  591. get { return _moonDirection; }
  592. set {
  593. _moonDirection = value.normalized;
  594. SkyboxMaterial.SetVector("_MoonPosition", _moonDirection);
  595. }
  596. }
  597. [SerializeField]
  598. private Matrix4x4 _moonWorldToLocalMatrix = Matrix4x4.identity;
  599. public Matrix4x4 MoonWorldToLocalMatrix {
  600. get { return _moonWorldToLocalMatrix; }
  601. set {
  602. _moonWorldToLocalMatrix = value;
  603. SkyboxMaterial.SetMatrix("_MoonWorldToLocalMat", _moonWorldToLocalMatrix);
  604. }
  605. }
  606. [SerializeField, Range(0, 1)]
  607. private float _moonSize = .1f;
  608. public float MoonSize
  609. {
  610. get { return _moonSize; }
  611. set {
  612. _moonSize = value;
  613. SkyboxMaterial.SetFloat("_MoonRadius", _moonSize);
  614. }
  615. }
  616. [SerializeField, Range(0.0001f, .9999f)]
  617. private float _moonEdgeFeathering = 0.085f;
  618. public float MoonEdgeFeathering
  619. {
  620. get { return _moonEdgeFeathering; }
  621. set {
  622. _moonEdgeFeathering = value;
  623. SkyboxMaterial.SetFloat("_MoonEdgeFade", _moonEdgeFeathering);
  624. }
  625. }
  626. [SerializeField, Range(1, 10)]
  627. private float _moonBloomFilterBoost = 1.0f;
  628. public float MoonBloomFilterBoost
  629. {
  630. get { return _moonBloomFilterBoost; }
  631. set {
  632. _moonBloomFilterBoost = value;
  633. SkyboxMaterial.SetFloat("_MoonHDRBoost", _moonBloomFilterBoost);
  634. }
  635. }
  636. [SerializeField]
  637. private Vector4 _moonSpriteDimensions = Vector4.zero;
  638. public void SetMoonSpriteDimensions(int columns, int rows)
  639. {
  640. _moonSpriteDimensions.x = columns;
  641. _moonSpriteDimensions.y = rows;
  642. SkyboxMaterial.SetVector("_MoonSpriteDimensions", _moonSpriteDimensions);
  643. }
  644. public Vector2 GetMoonSpriteDimensions()
  645. {
  646. return new Vector2(_moonSpriteDimensions.x, _moonSpriteDimensions.y);
  647. }
  648. [SerializeField]
  649. private int _moonSpriteItemCount = 1;
  650. public int MoonSpriteItemCount
  651. {
  652. get { return _moonSpriteItemCount; }
  653. set {
  654. _moonSpriteItemCount = value;
  655. SkyboxMaterial.SetInt("_MoonSpriteItemCount", _moonSpriteItemCount);
  656. }
  657. }
  658. [SerializeField, Range(0.0f, 1.0f)]
  659. private float _moonSpriteAnimationSpeed = 1.0f;
  660. public float MoonSpriteAnimationSpeed
  661. {
  662. get { return _moonSpriteAnimationSpeed; }
  663. set {
  664. _moonSpriteAnimationSpeed = value;
  665. SkyboxMaterial.SetFloat("_MoonSpriteAnimationSpeed", _moonSpriteAnimationSpeed);
  666. }
  667. }
  668. // Sun
  669. [SerializeField]
  670. private Texture _sunTexture;
  671. public Texture SunTexture
  672. {
  673. get { return _sunTexture; }
  674. set {
  675. _sunTexture = value;
  676. SkyboxMaterial.SetTexture("_SunTex", _sunTexture);
  677. }
  678. }
  679. [SerializeField]
  680. private Color _sunColor = Color.white;
  681. public Color SunColor
  682. {
  683. get { return _sunColor; }
  684. set {
  685. _sunColor = value;
  686. SkyboxMaterial.SetColor("_SunColor", _sunColor);
  687. }
  688. }
  689. [SerializeField]
  690. private float _sunRotationSpeed = 0;
  691. public float SunRotationSpeed
  692. {
  693. get { return _sunRotationSpeed; }
  694. set {
  695. _sunRotationSpeed = value;
  696. SkyboxMaterial.SetFloat("_SunRotationSpeed", _sunRotationSpeed);
  697. }
  698. }
  699. [SerializeField]
  700. private Vector3 _sunDirection = Vector3.right;
  701. public Vector3 SunDirection
  702. {
  703. get { return _sunDirection; }
  704. set {
  705. _sunDirection = value.normalized;
  706. SkyboxMaterial.SetVector("_SunPosition", _sunDirection);
  707. }
  708. }
  709. [SerializeField]
  710. private Matrix4x4 _sunWorldToLocalMatrix = Matrix4x4.identity;
  711. public Matrix4x4 SunWorldToLocalMatrix {
  712. get { return _sunWorldToLocalMatrix; }
  713. set {
  714. _sunWorldToLocalMatrix = value;
  715. SkyboxMaterial.SetMatrix("_SunWorldToLocalMat", _sunWorldToLocalMatrix);
  716. }
  717. }
  718. [SerializeField, Range(0, 1)]
  719. private float _sunSize = .1f;
  720. public float SunSize
  721. {
  722. get { return _sunSize; }
  723. set {
  724. _sunSize = value;
  725. SkyboxMaterial.SetFloat("_SunRadius", _sunSize);
  726. }
  727. }
  728. [SerializeField, Range(0.0001f, .9999f)]
  729. private float _sunEdgeFeathering = 0.085f;
  730. public float SunEdgeFeathering
  731. {
  732. get { return _sunEdgeFeathering; }
  733. set {
  734. _sunEdgeFeathering = value;
  735. SkyboxMaterial.SetFloat("_SunEdgeFade", _sunEdgeFeathering);
  736. }
  737. }
  738. [SerializeField, Range(1, 10)]
  739. private float _sunBloomFilterBoost = 1.0f;
  740. public float SunBloomFilterBoost
  741. {
  742. get { return _sunBloomFilterBoost; }
  743. set {
  744. _sunBloomFilterBoost = value;
  745. SkyboxMaterial.SetFloat("_SunHDRBoost", _sunBloomFilterBoost);
  746. }
  747. }
  748. [SerializeField]
  749. private Vector4 _sunSpriteDimensions = Vector4.zero;
  750. public void SetSunSpriteDimensions(int columns, int rows)
  751. {
  752. _sunSpriteDimensions.x = columns;
  753. _sunSpriteDimensions.y = rows;
  754. SkyboxMaterial.SetVector("_SunSpriteDimensions", _sunSpriteDimensions);
  755. }
  756. public Vector2 GetSunSpriteDimensions()
  757. {
  758. return new Vector2(_sunSpriteDimensions.x, _sunSpriteDimensions.y);
  759. }
  760. [SerializeField]
  761. private int _sunSpriteItemCount = 1;
  762. public int SunSpriteItemCount
  763. {
  764. get { return _sunSpriteItemCount; }
  765. set {
  766. _sunSpriteItemCount = value;
  767. SkyboxMaterial.SetInt("_SunSpriteItemCount", _sunSpriteItemCount);
  768. }
  769. }
  770. [SerializeField, Range(0.0f, 1.0f)]
  771. private float _sunSpriteAnimationSpeed = 1.0f;
  772. public float SunSpriteAnimationSpeed
  773. {
  774. get { return _sunSpriteAnimationSpeed; }
  775. set {
  776. _sunSpriteAnimationSpeed = value;
  777. SkyboxMaterial.SetFloat("_SunSpriteAnimationSpeed", _sunSpriteAnimationSpeed);
  778. }
  779. }
  780. // Clouds.
  781. [SerializeField, Range(-1, 1)]
  782. private float _cloudBegin = .2f;
  783. public float CloudBegin
  784. {
  785. get { return _cloudBegin; }
  786. set
  787. {
  788. _cloudBegin = value;
  789. SkyboxMaterial.SetFloat("_CloudBegin", _cloudBegin);
  790. }
  791. }
  792. private float _cloudTextureTiling;
  793. public float CloudTextureTiling
  794. {
  795. get { return _cloudTextureTiling; }
  796. set
  797. {
  798. _cloudTextureTiling = value;
  799. SkyboxMaterial.SetFloat("_CloudTextureTiling", _cloudTextureTiling);
  800. }
  801. }
  802. [SerializeField]
  803. private Color _cloudColor = Color.white;
  804. public Color CloudColor
  805. {
  806. get { return _cloudColor; }
  807. set
  808. {
  809. _cloudColor = value;
  810. SkyboxMaterial.SetColor("_CloudColor", _cloudColor);
  811. }
  812. }
  813. [SerializeField]
  814. private Texture _cloudTexture = null;
  815. public Texture CloudTexture
  816. {
  817. get
  818. {
  819. return _cloudTexture != null ? _cloudTexture : Texture2D.blackTexture;
  820. }
  821. set
  822. {
  823. _cloudTexture = value;
  824. SkyboxMaterial.SetTexture("_CloudNoiseTexture", _cloudTexture);
  825. }
  826. }
  827. [SerializeField]
  828. private Texture _artCloudCustomTexture = null;
  829. public Texture ArtCloudCustomTexture
  830. {
  831. get {
  832. return _artCloudCustomTexture != null ? _artCloudCustomTexture : Texture2D.blackTexture;
  833. }
  834. set {
  835. _artCloudCustomTexture = value;
  836. SkyboxMaterial.SetTexture("_ArtCloudCustomTexture", _artCloudCustomTexture);
  837. }
  838. }
  839. [SerializeField]
  840. private float _cloudDensity = 0;
  841. public float CloudDensity
  842. {
  843. get { return _cloudDensity; }
  844. set
  845. {
  846. _cloudDensity = value;
  847. SkyboxMaterial.SetFloat("_CloudDensity", _cloudDensity);
  848. }
  849. }
  850. [SerializeField]
  851. private float _cloudSpeed = 0;
  852. public float CloudSpeed
  853. {
  854. get { return _cloudSpeed; }
  855. set {
  856. _cloudSpeed = value;
  857. SkyboxMaterial.SetFloat("_CloudSpeed", _cloudSpeed);
  858. }
  859. }
  860. [SerializeField]
  861. private float _cloudDirection = 0;
  862. public float CloudDirection
  863. {
  864. get { return _cloudDirection; }
  865. set
  866. {
  867. _cloudDirection = value;
  868. SkyboxMaterial.SetFloat("_CloudDirection", _cloudDirection);
  869. }
  870. }
  871. [SerializeField]
  872. private float _cloudHeight = 0;
  873. public float CloudHeight
  874. {
  875. get { return _cloudHeight; }
  876. set {
  877. _cloudHeight = value;
  878. SkyboxMaterial.SetFloat("_CloudHeight", _cloudHeight);
  879. }
  880. }
  881. [SerializeField]
  882. private Color _cloudColor1 = Color.white;
  883. public Color CloudColor1
  884. {
  885. get { return _cloudColor1; }
  886. set
  887. {
  888. _cloudColor1 = value;
  889. SkyboxMaterial.SetColor("_CloudColor1", _cloudColor1);
  890. }
  891. }
  892. [SerializeField]
  893. private Color _cloudColor2 = Color.white;
  894. public Color CloudColor2
  895. {
  896. get { return _cloudColor2; }
  897. set {
  898. _cloudColor2 = value;
  899. SkyboxMaterial.SetColor("_CloudColor2", _cloudColor2);
  900. }
  901. }
  902. [SerializeField]
  903. private float _cloudFadePosition = 0;
  904. public float CloudFadePosition
  905. {
  906. get { return _cloudFadePosition; }
  907. set {
  908. _cloudFadePosition = value;
  909. SkyboxMaterial.SetFloat("_CloudFadePosition", _cloudFadePosition);
  910. }
  911. }
  912. [SerializeField]
  913. private float _cloudFadeAmount = .5f;
  914. public float CloudFadeAmount
  915. {
  916. get { return _cloudFadeAmount; }
  917. set {
  918. _cloudFadeAmount = value;
  919. SkyboxMaterial.SetFloat("_CloudFadeAmount", _cloudFadeAmount);
  920. }
  921. }
  922. // Clouds Cubemap.
  923. [SerializeField]
  924. private Texture _cloudCubemap;
  925. public Texture CloudCubemap
  926. {
  927. get { return _cloudCubemap; }
  928. set {
  929. _cloudCubemap = value;
  930. SkyboxMaterial.SetTexture("_CloudCubemapTexture", _cloudCubemap);
  931. }
  932. }
  933. [SerializeField]
  934. private float _cloudCubemapRotationSpeed;
  935. public float CloudCubemapRotationSpeed
  936. {
  937. get { return _cloudCubemapRotationSpeed; }
  938. set {
  939. _cloudCubemapRotationSpeed = value;
  940. SkyboxMaterial.SetFloat("_CloudCubemapRotationSpeed", _cloudCubemapRotationSpeed);
  941. }
  942. }
  943. [SerializeField]
  944. private Texture _cloudCubemapDoubleLayerCustomTexture;
  945. public Texture CloudCubemapDoubleLayerCustomTexture
  946. {
  947. get { return _cloudCubemapDoubleLayerCustomTexture; }
  948. set {
  949. _cloudCubemapDoubleLayerCustomTexture = value;
  950. SkyboxMaterial.SetTexture("_CloudCubemapDoubleTexture", _cloudCubemapDoubleLayerCustomTexture);
  951. }
  952. }
  953. [SerializeField]
  954. private float _cloudCubemapDoubleLayerRotationSpeed;
  955. public float CloudCubemapDoubleLayerRotationSpeed
  956. {
  957. get { return _cloudCubemapDoubleLayerRotationSpeed; }
  958. set {
  959. _cloudCubemapDoubleLayerRotationSpeed = value;
  960. SkyboxMaterial.SetFloat("_CloudCubemapDoubleLayerRotationSpeed", _cloudCubemapDoubleLayerRotationSpeed);
  961. }
  962. }
  963. [SerializeField]
  964. private float _cloudCubemapDoubleLayerHeight;
  965. public float CloudCubemapDoubleLayerHeight
  966. {
  967. get { return _cloudCubemapDoubleLayerHeight; }
  968. set {
  969. _cloudCubemapDoubleLayerHeight = value;
  970. SkyboxMaterial.SetFloat("_CloudCubemapDoubleLayerHeight", _cloudCubemapDoubleLayerHeight);
  971. }
  972. }
  973. [SerializeField]
  974. private Color _cloudCubemapDoubleLayerTintColor = Color.white;
  975. public Color CloudCubemapDoubleLayerTintColor
  976. {
  977. get { return _cloudCubemapDoubleLayerTintColor; }
  978. set {
  979. _cloudCubemapDoubleLayerTintColor = value;
  980. SkyboxMaterial.SetColor("_CloudCubemapDoubleLayerTintColor", _cloudCubemapDoubleLayerTintColor);
  981. }
  982. }
  983. [SerializeField]
  984. private Color _cloudCubemapTintColor = Color.white;
  985. public Color CloudCubemapTintColor
  986. {
  987. get { return _cloudCubemapTintColor; }
  988. set {
  989. _cloudCubemapTintColor = value;
  990. SkyboxMaterial.SetColor("_CloudCubemapTintColor", _cloudCubemapTintColor);
  991. }
  992. }
  993. [SerializeField]
  994. private float _cloudCubemapHeight;
  995. public float CloudCubemapHeight
  996. {
  997. get { return _cloudCubemapHeight; }
  998. set {
  999. _cloudCubemapHeight = value;
  1000. SkyboxMaterial.SetFloat("_CloudCubemapHeight", _cloudCubemapHeight);
  1001. }
  1002. }
  1003. // Clouds Normal Cubemap.
  1004. [SerializeField]
  1005. private Texture _cloudCubemapNormalTexture;
  1006. public Texture CloudCubemapNormalTexture
  1007. {
  1008. get { return _cloudCubemap; }
  1009. set {
  1010. _cloudCubemapNormalTexture = value;
  1011. SkyboxMaterial.SetTexture("_CloudCubemapNormalTexture", _cloudCubemapNormalTexture);
  1012. }
  1013. }
  1014. [SerializeField]
  1015. private Color _cloudCubemapNormalLitColor = Color.white;
  1016. public Color CloudCubemapNormalLitColor
  1017. {
  1018. get { return _cloudCubemapNormalLitColor; }
  1019. set {
  1020. _cloudCubemapNormalLitColor = value;
  1021. SkyboxMaterial.SetColor("_CloudCubemapNormalLitColor", _cloudCubemapNormalLitColor);
  1022. }
  1023. }
  1024. [SerializeField]
  1025. private Color _cloudCubemapNormalShadowColor = Color.gray;
  1026. public Color CloudCubemapNormalShadowColor
  1027. {
  1028. get { return _cloudCubemapNormalShadowColor; }
  1029. set {
  1030. _cloudCubemapNormalShadowColor = value;
  1031. SkyboxMaterial.SetColor("_CloudCubemapNormalShadowColor", _cloudCubemapNormalShadowColor);
  1032. }
  1033. }
  1034. [SerializeField]
  1035. private float _cloudCubemapNormalRotationSpeed;
  1036. public float CloudCubemapNormalRotationSpeed
  1037. {
  1038. get { return _cloudCubemapNormalRotationSpeed; }
  1039. set {
  1040. _cloudCubemapNormalRotationSpeed = value;
  1041. SkyboxMaterial.SetFloat("_CloudCubemapNormalRotationSpeed", _cloudCubemapNormalRotationSpeed);
  1042. }
  1043. }
  1044. [SerializeField]
  1045. private float _cloudCubemapNormalHeight;
  1046. public float CloudCubemapNormalHeight
  1047. {
  1048. get { return _cloudCubemapNormalHeight; }
  1049. set {
  1050. _cloudCubemapNormalHeight = value;
  1051. SkyboxMaterial.SetFloat("_CloudCubemapNormalHeight", _cloudCubemapNormalHeight);
  1052. }
  1053. }
  1054. [SerializeField]
  1055. private float _cloudCubemapNormalAmbientItensity;
  1056. public float CloudCubemapNormalAmbientIntensity
  1057. {
  1058. get { return _cloudCubemapNormalAmbientItensity; }
  1059. set {
  1060. _cloudCubemapNormalAmbientItensity = value;
  1061. SkyboxMaterial.SetFloat("_CloudCubemapNormalAmbientIntensity", _cloudCubemapNormalAmbientItensity);
  1062. }
  1063. }
  1064. [SerializeField]
  1065. private Texture _cloudCubemapNormalDoubleLayerCustomTexture;
  1066. public Texture CloudCubemapNormalDoubleLayerCustomTexture
  1067. {
  1068. get { return _cloudCubemapNormalDoubleLayerCustomTexture; }
  1069. set {
  1070. _cloudCubemapNormalDoubleLayerCustomTexture = value;
  1071. SkyboxMaterial.SetTexture("_CloudCubemapNormalDoubleTexture", _cloudCubemapNormalDoubleLayerCustomTexture);
  1072. }
  1073. }
  1074. [SerializeField]
  1075. private float _cloudCubemapNormalDoubleLayerRotationSpeed;
  1076. public float CloudCubemapNormalDoubleLayerRotationSpeed
  1077. {
  1078. get { return _cloudCubemapNormalDoubleLayerRotationSpeed; }
  1079. set {
  1080. _cloudCubemapNormalDoubleLayerRotationSpeed = value;
  1081. SkyboxMaterial.SetFloat("_CloudCubemapNormalDoubleLayerRotationSpeed", _cloudCubemapNormalDoubleLayerRotationSpeed);
  1082. }
  1083. }
  1084. [SerializeField]
  1085. private float _cloudCubemapNormalDoubleLayerHeight;
  1086. public float CloudCubemapNormalDoubleLayerHeight
  1087. {
  1088. get { return _cloudCubemapDoubleLayerHeight; }
  1089. set {
  1090. _cloudCubemapNormalDoubleLayerHeight = value;
  1091. SkyboxMaterial.SetFloat("_CloudCubemapNormalDoubleLayerHeight", _cloudCubemapNormalDoubleLayerHeight);
  1092. }
  1093. }
  1094. [SerializeField]
  1095. private Color _cloudCubemapNormalDoubleLayerLitColor = Color.white;
  1096. public Color CloudCubemapNormalDoubleLayerLitColor
  1097. {
  1098. get { return _cloudCubemapNormalDoubleLayerLitColor; }
  1099. set {
  1100. _cloudCubemapNormalDoubleLayerLitColor = value;
  1101. SkyboxMaterial.SetColor("_CloudCubemapNormalDoubleLitColor", _cloudCubemapNormalDoubleLayerLitColor);
  1102. }
  1103. }
  1104. [SerializeField]
  1105. private Color _cloudCubemapNormalDoubleLayerShadowColor = Color.gray;
  1106. public Color CloudCubemapNormalDoubleLayerShadowColor
  1107. {
  1108. get { return _cloudCubemapNormalDoubleLayerShadowColor; }
  1109. set {
  1110. _cloudCubemapNormalDoubleLayerShadowColor = value;
  1111. SkyboxMaterial.SetColor("_CloudCubemapNormalDoubleShadowColor", _cloudCubemapNormalDoubleLayerShadowColor);
  1112. }
  1113. }
  1114. // Direction that points to the light source.
  1115. [SerializeField]
  1116. private Vector3 _cloudCubemapNormalLightDirection = new Vector3(0, 1, 0);
  1117. public Vector3 CloudCubemapNormalLightDirection
  1118. {
  1119. get { return _cloudCubemapNormalLightDirection; }
  1120. set {
  1121. _cloudCubemapNormalLightDirection = value;
  1122. SkyboxMaterial.SetVector("_CloudCubemapNormalToLight", _cloudCubemapNormalLightDirection);
  1123. }
  1124. }
  1125. // Fog.
  1126. [SerializeField]
  1127. private Color _fogColor = Color.white;
  1128. public Color FogColor
  1129. {
  1130. get { return _fogColor; }
  1131. set {
  1132. _fogColor = value;
  1133. SkyboxMaterial.SetColor("_HorizonFogColor", _fogColor);
  1134. }
  1135. }
  1136. [SerializeField]
  1137. private float _fogDensity = .12f;
  1138. public float FogDensity
  1139. {
  1140. get { return _fogDensity; }
  1141. set {
  1142. _fogDensity = value;
  1143. SkyboxMaterial.SetFloat("_HorizonFogDensity", _fogDensity);
  1144. }
  1145. }
  1146. [SerializeField]
  1147. private float _fogHeight = .12f;
  1148. public float FogHeight
  1149. {
  1150. get { return _fogHeight; }
  1151. set {
  1152. _fogHeight = value;
  1153. SkyboxMaterial.SetFloat("_HorizonFogLength", _fogHeight);
  1154. }
  1155. }
  1156. private void ApplyGradientValuesOnMaterial()
  1157. {
  1158. float gradientFadeEnd = Mathf.Clamp(_gradientFadeBegin + _gradientFadeLength, -1.0f, 1.0f);
  1159. SkyboxMaterial.SetFloat("_GradientFadeBegin", _gradientFadeBegin);
  1160. SkyboxMaterial.SetFloat("_GradientFadeEnd", gradientFadeEnd);
  1161. }
  1162. private void ApplyStarFadeValuesOnMaterial()
  1163. {
  1164. float starFadeEnd = Mathf.Clamp(_starFadeBegin + _starFadeLength, -1.0f, 1.0f);
  1165. SkyboxMaterial.SetFloat("_StarFadeBegin", _starFadeBegin);
  1166. SkyboxMaterial.SetFloat("_StarFadeEnd", starFadeEnd);
  1167. }
  1168. }
  1169. }