├── .github └── FUNDING.yml ├── LICENSE ├── PlainColorSkybox.shader ├── ProcSkyBoxTex.shader ├── README.md ├── screenshot.png └── screenshot2.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [increpare] 4 | patreon: increpare 5 | custom: ['paypal.me/increparegames'] 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Stephen Lavelle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PlainColorSkybox.shader: -------------------------------------------------------------------------------- 1 | // MIT license (see license.txt) 2 | 3 | Shader "Custom/Color Skybox" { 4 | Properties { 5 | _SkyTint ("Sky", Color) = (.5, .5, .5, 1) 6 | _HorizonColor ("Horizon", Color) = (1.0, 1.0, 1.0, 1) 7 | _GroundColor ("Ground", Color) = (.369, .349, .341, 1) 8 | _HorizonSize("Horizon Size", Range(0.00001,1)) = 1.0 9 | } 10 | 11 | SubShader { 12 | Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" } 13 | Cull Off ZWrite Off 14 | 15 | Pass { 16 | 17 | CGPROGRAM 18 | #pragma vertex vert 19 | #pragma fragment frag 20 | 21 | #include "UnityCG.cginc" 22 | #include "Lighting.cginc" 23 | 24 | uniform half3 _SkyTint; 25 | uniform half3 _HorizonColor; 26 | uniform half3 _GroundColor; 27 | uniform half _HorizonSize; 28 | 29 | struct appdata_t 30 | { 31 | float4 vertex : POSITION; 32 | }; 33 | 34 | struct v2f 35 | { 36 | float4 pos : SV_POSITION; 37 | half skyGroundFactor : TEXCOORD0; 38 | }; 39 | 40 | 41 | v2f vert (appdata_t v) 42 | { 43 | v2f OUT; 44 | OUT.pos = UnityObjectToClipPos(v.vertex); 45 | float3 eyeRay = normalize(mul((float3x3)unity_ObjectToWorld, v.vertex.xyz)); 46 | OUT.skyGroundFactor = sign(eyeRay.y)*pow( abs(eyeRay.y) , _HorizonSize); 47 | return OUT; 48 | } 49 | 50 | 51 | half4 frag (v2f IN) : SV_Target 52 | { 53 | half3 col = half3(0.0, 0.0, 0.0); 54 | if (IN.skyGroundFactor<0){ 55 | col=lerp(_HorizonColor,_GroundColor,saturate((1-IN.skyGroundFactor-1)/_HorizonSize)); 56 | } else { 57 | col=lerp(_HorizonColor,_SkyTint,saturate((IN.skyGroundFactor)/_HorizonSize)); 58 | } 59 | return half4(col,1.0); 60 | } 61 | ENDCG 62 | } 63 | } 64 | 65 | 66 | Fallback Off 67 | 68 | } 69 | -------------------------------------------------------------------------------- /ProcSkyBoxTex.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/Color Skybox with Gradient" { 2 | Properties { 3 | _SkyTint ("Sky", Color) = (.5, .5, .5, 1) 4 | 5 | _Gradient ("Gradient", 2D) = "white" {} 6 | 7 | _HorizonSize("Horizon Size", Range(0.00001,1)) = 1.0 8 | } 9 | 10 | SubShader { 11 | Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" } 12 | Cull Off ZWrite Off 13 | 14 | Pass { 15 | 16 | CGPROGRAM 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | 20 | #include "UnityCG.cginc" 21 | #include "Lighting.cginc" 22 | 23 | uniform half4 _SkyTint; 24 | uniform half _HorizonSize; 25 | sampler2D _Gradient; 26 | 27 | 28 | struct appdata_t 29 | { 30 | float4 vertex : POSITION; 31 | }; 32 | 33 | struct v2f 34 | { 35 | float4 pos : SV_POSITION; 36 | half skyGroundFactor : TEXCOORD0; 37 | }; 38 | 39 | 40 | v2f vert (appdata_t v) 41 | { 42 | v2f OUT; 43 | OUT.pos = UnityObjectToClipPos(v.vertex); 44 | float3 eyeRay = normalize(mul((float3x3)unity_ObjectToWorld, v.vertex.xyz)); 45 | OUT.skyGroundFactor = sign(eyeRay.y)*pow( abs(eyeRay.y) , _HorizonSize); 46 | return OUT; 47 | } 48 | 49 | 50 | half4 frag (v2f IN) : SV_Target 51 | { 52 | half3 col = half3(0.0, 0.0, 0.0); 53 | half pos = 0; 54 | if (IN.skyGroundFactor<0){ 55 | pos = lerp(0.5,0,saturate((1-IN.skyGroundFactor-1)/_HorizonSize)); 56 | } else { 57 | pos = lerp(0.5,1,saturate((IN.skyGroundFactor)/_HorizonSize)); 58 | } 59 | return tex2D (_Gradient, half2(pos,0) )*_SkyTint; 60 | } 61 | 62 | ENDCG 63 | } 64 | } 65 | 66 | 67 | Fallback Off 68 | 69 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity-Colour-Skybox 2 | remaking the old unity procedural skybox that was in the beta version ages ago that lets you set sky/ground/horizon colours directly 3 | 4 | with 3-colors: 5 | ![screenshot](screenshot.png) 6 | 7 | with gradient texture: 8 | ![screenshot2](screenshot2.png) 9 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increpare/Unity-Colour-Skybox/81c4f2ec5c4af97a92f470e662aefe63b5a5c5cc/screenshot.png -------------------------------------------------------------------------------- /screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/increpare/Unity-Colour-Skybox/81c4f2ec5c4af97a92f470e662aefe63b5a5c5cc/screenshot2.png --------------------------------------------------------------------------------