Search code examples
unity-game-engineskybox

How to make smooth transition between skyboxes in unity?


I have a couple of skyboxes in unity (Day and Night) and want to achieve a smooth transition between them periodically, to create a day and night cycle. I've looked up many questions but they're either outdated or I have no idea what they mean, Any help would be appreciated.


Solution

  • Thanks for the comment responses.

    I used this shader - http://wiki.unity3d.com/index.php?title=SkyboxBlended as suggested in an answer to another question. The problem is, a lot of beginners do not know how to use shaders, which I'm going to illustrate right now.

    1. Create a shader in your project, open it, and copy-paste the shader in the link above.
    2. Create a material.
    3. Drag the shader and drop it onto the material.
    4. (Assuming that you have imported your skybox textures) If you click on your material, it should let your drop 12 textures in the inspector window (6 for one skybox, 6 for the other)
    5. Now, by playing around with the Blend slider, you should be able to see your skyboxes fade into each other :). You can write a script to change the Blend value, to make an automatic day/night cycle, or season cycle.

    If you want more help, feel free to comment

    Edit : The page doesn't seem to exist anymore, but I'm sure you'll find a lot of shaders on GitHub.