proper horizon colours yay

This commit is contained in:
Crispy 2023-02-12 19:13:24 +01:00
parent 4647948009
commit 1acea90fc9
6 changed files with 131 additions and 13 deletions

View file

@ -68,6 +68,7 @@ Material:
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Grid: 0
- _HorizonTint: 0.1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
@ -82,8 +83,8 @@ Material:
- _StarTint: 0.5
- _StarsMissing: 0.75
- _SunAngle: 0
- _SunCutoff: 0.06
- _SunRadius: 0.06
- _SunCutoff: 0.121
- _SunRadius: 0.037
- _Temp: 0.5
- _UVSec: 0
- _WaveStrength: 1
@ -92,6 +93,6 @@ Material:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _HorizonCol: {r: 0.43, g: 0.27, b: 0.49, a: 1}
- _SkyCol: {r: 0.22, g: 0.23, b: 0.58, a: 1}
- _SunCol: {r: 1, g: 0.65, b: 0.05, a: 1}
- _SkyCol: {r: 0.13841508, g: 0.08388217, b: 0.2735849, a: 1}
- _SunCol: {r: 1, g: 0.5988961, b: 0.05098039, a: 1}
- _WaterCol: {r: 0.041651834, g: 0.0754717, b: 0.060873438, a: 1}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0e76bd19438f76495b4a89153191400f
guid: 01de444cda656e74ea4c64c47e6343cf
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000

View file

@ -0,0 +1,98 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Sunset Env_old
m_Shader: {fileID: 4800000, guid: 25430878f237178ac8983add8236827b, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1f675a065618d234abec48e229fcf618, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _WaterSurface:
m_Texture: {fileID: 2800000, guid: cafeae09bbcef5a6cabeaac76bab5462, type: 3}
m_Scale: {x: 1.6, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Grid: 0
- _HorizonTint: 0.1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StarDensity: 30
- _StarRandom: 0.85
- _StarSize: 0.06
- _StarSizeRandom: 0.5
- _StarTint: 0.5
- _StarsMissing: 0.75
- _SunAngle: 0
- _SunCutoff: 0.06
- _SunRadius: 0.06
- _Temp: 0.5
- _UVSec: 0
- _WaveStrength: 1
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _HorizonCol: {r: 0.43, g: 0.27, b: 0.49, a: 1}
- _SkyCol: {r: 0.22, g: 0.23, b: 0.58, a: 1}
- _SunCol: {r: 1, g: 0.65, b: 0.05, a: 1}
- _WaterCol: {r: 0.041651834, g: 0.0754717, b: 0.060873438, a: 1}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e76bd19438f76495b4a89153191400f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -567,7 +567,7 @@ PrefabInstance:
- target: {fileID: -8679921383154817045, guid: 5009e49fafd33ed0e980b53b1f9e954d,
type: 3}
propertyPath: m_LocalPosition.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5009e49fafd33ed0e980b53b1f9e954d,
type: 3}
@ -618,7 +618,7 @@ PrefabInstance:
type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: 0e76bd19438f76495b4a89153191400f, type: 2}
objectReference: {fileID: 2100000, guid: 01de444cda656e74ea4c64c47e6343cf, type: 2}
- target: {fileID: 919132149155446097, guid: 5009e49fafd33ed0e980b53b1f9e954d,
type: 3}
propertyPath: m_Name

View file

@ -4,7 +4,7 @@
{
[Header(Sky)]
_SkyCol ("Sky color", Color) = (0.22, 0.23, 0.58, 1.0)
_HorizonCol ("Horizon color", Color) = (0.43, 0.27, 0.49, 1.0)
_HorizonTint ("Horizon tint", Range(0, 1)) = 0.1
[Header(Sun)]
_SunCol ("Sun color", Color) = (1.0, 0.65, 0.05, 1.0)
_SunAngle ("Sun angle", Range(0, 6.28)) = 0
@ -61,7 +61,7 @@
sampler2D _MainTex;
fixed4 _SkyCol;
fixed4 _HorizonCol;
float _HorizonTint;
float _StarsMissing;
float _StarDensity;
@ -103,6 +103,18 @@
return normalize(normal.zxy);
}
float smin(float a, float b, float k)
{
float h = max(k - abs(a-b), 0) / k;
return min(a, b) - h*h*h*k * 1/6.0;
}
float smax(float a, float b, float k)
{
float h = max(k - abs(a - b), 0) / k;
return max(a, b) + h*h*h*k * 1/6.0;
}
fixed4 frag(v2f i) : SV_Target
{
float water_mod = 0.0;
@ -131,7 +143,8 @@
/// sky
float factor = smoothstep(0.0, 0.5, dir.y + 0.2);
factor = min(factor, 1.0);
fixed4 col = lerp(_HorizonCol, _SkyCol, factor);
fixed4 horizon_col = lerp(_SkyCol, _SunCol, _HorizonTint);
fixed4 col = lerp(horizon_col, _SkyCol, factor);
/// stars
float2 cells = float2(-1, floor(_StarDensity));
@ -172,9 +185,7 @@
/// sun
float3 sun_dir = float3(sin(_SunAngle), 0.0, cos(_SunAngle));
float alignment = min(acos(dot(dir, sun_dir)), 1);
// float sun_gradient = pow(y-1, 2) * 0.5 + 0.8;
float sun_gradient = 1;
float sun_amount = max(min(_SunRadius / alignment * sun_gradient, 5) - _SunCutoff, 0);
float sun_amount = smax(min(_SunRadius / alignment, 5) - _SunCutoff, 0, 0.15);
col = lerp(col, _SunCol, sun_amount);
col = lerp(col, _WaterCol, water_mod);