- Home /
Skybox blending
Hello ! I am trying to use this shader to have a transition between 2 skyboxes: http://www.unifycommunity.com/wiki/index.php?title=SkyboxBlended
However, I must admit I am quite a rookie with Unity and shaders. I don't really understand how to use it.
I created the shader in my Project, copied what was written but...
What should I modify in the shader code ? _FrontTex ("Front (+Z)", 2D) = "white" {} : should I replace white or Front (+Z) with my material name ?
Should I now apply the shader on some material ? How ?
How can I move the "blend" and how can I do this from a script ? skyboxmaterial.SetFloat("_Blend", yourBlend) <= Skybox.material exists, but I don't think this is what is required, considering the SetFloat.
Well, if one could give me an example of how I can use this, he would be most welcome :)
Answer by DaveA · Nov 21, 2011 at 09:04 PM
Are you trying to modify the shader or use it as-is?
I have not tried it in 3.4, but in theory, you put it on a material, it should let you drop 12 textures on it in the Inspector (6 for one box, 6 for the other), and have a slider that lets you set the blend amount.
Ok thank you, that was very simple indeed ^^ I did not really understand the principle of shader, that's why I had troubles.
I'll try to figure out by myselft how to change the blend from a script.
How do we make it blend dynamically in the game itself like a day/night cycle through script?
Answer by bentoBAUX · Jan 13, 2019 at 02:15 AM
You can refer to: https://www.youtube.com/watch?v=aAtzPTWxEtw for the skybox set up.
The scripting for the blending part is:
Create an empty game object.
Reset its position (0,0,0) [optional]
Drag your Skybox material from the folder where your shader, textures and skybox material is and into the empty material section in the empty game object's inspector.
You are good to go!
@bentoBAUX Searched all over the place for this. Thanks for the clear instructions and screenshots.. endlessly helpful and kind :)
Answer by Hyvemind · Jan 17, 2012 at 11:01 AM
Can we try setting up three skyboxes using this method? If so what changes will i need to make to the code?
I guess that you can change the texture used by the skybox shader.
For example, you have a day skybox that you blend with a dusk skybox. When the dusk is fully visible, you just change the day skybox textures with night textures, and blend back to this one.
If you want to blend 3 textures at the same time, then yes, you need to modify the code, and for this I can't help you.
Anyway, you should ask your question normally, with the ask a question button top right, as nobody will be noticed of your question here except me.
Your answer
Follow this Question
Related Questions
Shader Blending Question 1 Answer
Unity 5 Skybox not Rotating 3 Answers
Represent Land 3D Area End 0 Answers
Decal Alpha Blend 0 Answers
Errors with ENDCG in shaders 1 Answer