Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Simple Procedural Skybox V3.1

Discussion in 'Assets and Asset Store' started by WillNode, Apr 21, 2017.

  1. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    Simple Procedural Skybox

    This is the official thread to my asset Simple Procedural Skybox. The asset was not updated for more than a year so now I give them a birth with the new look to V3.0.

    Screenshot (227).png Screenshot (228).png Screenshot (229).png Screenshot (230).png

    Chat anything about this asset here. Suggestion, problem, ideas are welcomed here.
     
    Last edited: May 6, 2017
  2. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    I just submitted V3.1. Changes include some final touches that will make skies not "so dark" in the night and make sun bit yellower at sunset.

    Cropped-28.jpg
    Cropped-27.jpg
     
  3. BMadrid

    BMadrid

    Joined:
    Nov 26, 2013
    Posts:
    26
    Publish a version for unity 5.4
     
  4. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    @BMadrid relax. You're blowing my cover. I have a plan about this asset to be upgraded in near days... with lots of surprise...

    Screenshot (447).png

    Yep. Moons there. Huge refinements in editor, sun, clouds just to make it feels more natural and simple. The only thing that hold it now is updating the documentation. I also made a plan to be downgraded to 5.4 just for you so be patient for that ;).
     
    BMadrid likes this.
  5. BMadrid

    BMadrid

    Joined:
    Nov 26, 2013
    Posts:
    26
    I'll wait patiently. Thanks for keeping the interest Although I am anxious
     
  6. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    @BMadrid.

    Bad news. I can't rollback. Scripts and shader are fine but example scenes were broken.
    However, If you want, I can send you the package so you can use the asset in 5.4.
     
  7. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    Yep, V3.2 just available today. I haven't update the screenshot but mostly stays the same. The online documentation is updated too.
     
  8. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    OMG! Last post was 2017. Did I just buy sucker bait or this still supported?
     
  9. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    Whoa, I wasn't aware that. Did you come to any problem using this asset?
     
  10. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    Hi @WillNode !

    Yeah, a couple. I wasn't sure at first what to do with the scripts, but the example scene helped.

    I was getting 4 errors all relating to the float "phase":

    Evaluate: time parameter is not a valid number​
    and
    Assertion failed on expression: 'curveT >= GetRange().first && curveT <= GetRange().second'​
    and
    Assertion failed on expression: 'curveT >= m_Curve[lhs].time && curveT <= m_Curve[rhs].time'​
    and
    Evaluate: time parameter is not a valid number​

    I fixed those by testing for numbers less than 0 and greater than 1.

    Now I am going to track time so I can do SunRise/Set and other time related things. Good to see your still around.

    Thanks!
    Mark
     
  11. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    You welcome. It's really good that you starts getting understand the scripts. Don't hesitate to come back here asking questions ;)
     
  12. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    I'm back!
    I've modified the scripts to my liking. I have synchronized the movement of the sun/moon with the passing of time and now display the "phases" of the day along with an game time clock. Working like a charm.

    Now I am about to introduce weather to the mix. I will start off with what I think should be the simple stuff, like increasing the number and/or size of clouds, and if possible, their heights. I see that this can be achieved by referencing the SimpleProcedural skybox parameters. Any hints or tips?

    Cheers!
    Mark
     
  13. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    Oh, right.

    You can change the material parameters using script like SetFloat. I recommend that you open the SimpleProceduralSkybox shader to see which shader properties name (in scripting) belongs to. Other than that it's all depends on how or when things should change when your game is running.
     
  14. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    476
    OK, poked around a bit. Now I have a better understanding of the skybox parameters.
    I am looking to increase the cloud cover using Lerp if a Random.Range call is a certain value.

    Here is my simple test code:
    Code (CSharp):
    1.  
    2. //In Update():
    3.         if (!weatherChecked && worldTimeHour == 10 && minutes == 55 || worldTimeHour == 23 && minutes == 55)
    4. // Check at around 11am and again at close to midnight... Might move to just midnight to hide if Lerp doesn't work.
    5.         {
    6.             float cloudFilterAmount = Random.Range(-1f, 2f);
    7.             StopCoroutine(CheckTheWeather(cloudFilterAmount)); // Stop Coroutine to avoid memory leaks.
    8.             StartCoroutine(CheckTheWeather(cloudFilterAmount));
    9.         }
    10.  
    11. IEnumerator CheckTheWeather(float cloudFilterAmount)
    12.     {
    13.         if (Random.Range(1, 100) < 50) // 50% of the time, change the cloud filter to some value.
    14.         {
    15.             weatherChecked = true;  // bool used in Update().
    16.             //Randomize cloud cover!
    17.             RenderSettings.skybox.SetFloat("_CloudFilter", Mathf.Lerp(RenderSettings.skybox.GetFloat("_CloudFilter"), cloudFilterAmount, Time.deltaTime / halfquarterDay));  // Seems to jump rather than Lerp.
    18.  
    19.             Debug.Log("Randomizing clouds " + RenderSettings.skybox.GetFloat("_CloudFilter"));
    20.         }
    21.         yield return new WaitForSeconds(cloudFilterAmount + 0.5f);
    22.         weatherChecked = false;
    23.     }
    24.  
    Question 1: Is _CloudFilter the "right" parameter to use to increase the cloud cover?
    Question 2: Any idea why my Lerp just jumps to the target# rather than changing over time?

    Mark
     
  15. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    409
    1. Correct. You also may want to manipulate _CloudLowAlt and _CloudHighAlt so that it appears shifting over time
    2. You need to loop the coroutine in order for transition happens, like

    Code (CSharp):
    1.  IEnumerator CheckTheWeather(float cloudFilterAmount)
    2.     {
    3.         if (Random.Range(1, 100) < 50) // 50% of the time, change the cloud filter to some value.
    4.         {
    5.             weatherChecked = true;  // bool used in Update().
    6.             //Randomize cloud cover!
    7.             float original = RenderSettings.skybox.GetFloat("_CloudFilter");
    8.             float time = Time.time;
    9.             float duration = cloudFilterAmount + 0.5f;
    10.             while (time + duration > Time.time)
    11.             {
    12.                 RenderSettings.skybox.SetFloat("_CloudFilter", Mathf.Lerp(original, cloudFilterAmount, (Time.time - time) / duration));
    13.                 yield return null;
    14.             }
    15.             Debug.Log("Randomizing clouds " + RenderSettings.skybox.GetFloat("_CloudFilter"));
    16.         }
    17.         weatherChecked = false;
    18.     }
    19.