Bonnate / Unity-Skybox-Blender

Blend the skybox in unity to change the sky during runtime.

Home Page:https://bonnate.tistory.com/269

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skybox Blender

Blend the skybox in unity to change the sky during runtime. You can set Directional Light, Fog, and Skybox Reflection Intensity.

thumb gif

How to use?

  1. Set the material that uses the VertBlendedSkybox shader to the SkyBox material. step 1
  • This shaders and material files are uploaded to the GitHub project.

  1. Create a scriptable object to store the preset. step 2
  • In the project, click Create > Preset < Environment Preset to create a new scriptable object.



  1. Insert the Skybox Preset of the scriptable object file as appropriate. step 3
  • Insert 6 image files according to the 6 side.



  1. Create an object that uses EnviromentManager.cs in the scene. enter image description here
  • Insert the generated presets into Presets.
  • You also set Directional Light and RotSpeed.

  1. Call the script to complete Sky Blend using the preset you set.

public  class  SampleScript : MonoBehaviour 
{ 
    private  void  Start() 
    { 
	    StartCoroutine(CoBlendSkies()); 
    } 
    
    private IEnumerator CoBlendSkies() 
    { 
	    while (true) 
	    { 
		    EnviromentManager.Instance.BlendEnviroment("Mid", 5.0f); 
		    yield  return  new  WaitForSeconds(10.0f); 
		    EnviromentManager.Instance.BlendEnviroment("Night", 5.0f); 
		    yield  return  new  WaitForSeconds(10.0f);
		    EnviromentManager.Instance.BlendEnviroment("Day", 5.0f);
		    yield  return  new  WaitForSeconds(10.0f);  
	    } 
    } 
}

  • You can call with the name of the set file as a key in a single tone, such as EnvironmentManager.Instance.BlendEnvironment("Mid", 5.0f).


References

The project uploaded on GitHub was uploaded using free Asset. https://assetstore.unity.com/packages/3d/environments/lowpoly-environment-nature-pack-free-187052

https://assetstore.unity.com/packages/2d/textures-materials/sky/skybox-series-free-103633

The shader used in the project referred to the file here. https://gist.github.com/tolotratlt/0cf71ff58a7e7c37a235ec38c6e8b99e

About

Blend the skybox in unity to change the sky during runtime.

https://bonnate.tistory.com/269


Languages

Language:ShaderLab 98.4%Language:C# 1.5%Language:HLSL 0.2%