get scene looking nice and add fog

This commit is contained in:
Tuomas Katajisto 2025-10-23 23:01:34 +03:00
parent 78014fcb6f
commit 2bd90b3636
6 changed files with 1110 additions and 968 deletions

View File

@ -4,7 +4,7 @@
"saturation": 0.988528, "saturation": 0.988528,
"gamma": 2.194679, "gamma": 2.194679,
"tonemap": 1, "tonemap": 1,
"ssao": 0.864454, "ssao": 0.823773,
"dilate_separation": 1.318038, "dilate_separation": 1.318038,
"dilate_size": 7, "dilate_size": 7,
"dilate_min": 0.142381, "dilate_min": 0.142381,
@ -12,5 +12,5 @@
"dof_blur_size": 2, "dof_blur_size": 2,
"dof_min": 2.750411, "dof_min": 2.750411,
"dof_max": 15.987307, "dof_max": 15.987307,
"dof_point": 14.644861 "dof_point": 11.471807
} }

View File

@ -3,160 +3,160 @@
"name": "test_scene", "name": "test_scene",
"conf": { "conf": {
"skyBase": { "skyBase": {
"x": 0, "x": 0.969215,
"y": 0.739732, "y": 0.677765,
"z": 1, "z": 0.237475,
"xy": { "xy": {
"x": 0, "x": 0.969215,
"y": 0.739732, "y": 0.677765,
"component": [ "component": [
0,0.739732 0.969215,0.677765
] ]
}, },
"yz": { "yz": {
"x": 0.739732, "x": 0.677765,
"y": 1, "y": 0.237475,
"component": [ "component": [
0.739732,1 0.677765,0.237475
] ]
}, },
"component": [ "component": [
0,0.739732,1 0.969215,0.677765,0.237475
] ]
}, },
"skyTop": { "skyTop": {
"x": 0.00624, "x": 0.884736,
"y": 0.079472, "y": 0.566938,
"z": 0.319222, "z": 0.011473,
"xy": { "xy": {
"x": 0.00624, "x": 0.884736,
"y": 0.079472, "y": 0.566938,
"component": [ "component": [
0.00624,0.079472 0.884736,0.566938
] ]
}, },
"yz": { "yz": {
"x": 0.079472, "x": 0.566938,
"y": 0.319222, "y": 0.011473,
"component": [ "component": [
0.079472,0.319222 0.566938,0.011473
] ]
}, },
"component": [ "component": [
0.00624,0.079472,0.319222 0.884736,0.566938,0.011473
] ]
}, },
"sunDisk": { "sunDisk": {
"x": 1, "x": 0.923485,
"y": 1, "y": 0.505037,
"z": 1, "z": 0.050917,
"xy": { "xy": {
"x": 1, "x": 0.923485,
"y": 1, "y": 0.505037,
"component": [ "component": [
1,1 0.923485,0.505037
] ]
}, },
"yz": { "yz": {
"x": 1, "x": 0.505037,
"y": 1, "y": 0.050917,
"component": [ "component": [
1,1 0.505037,0.050917
] ]
}, },
"component": [ "component": [
1,1,1 0.923485,0.505037,0.050917
] ]
}, },
"horizonHalo": { "horizonHalo": {
"x": 1, "x": 1,
"y": 1, "y": 0,
"z": 1, "z": 0,
"xy": { "xy": {
"x": 1, "x": 1,
"y": 1, "y": 0,
"component": [ "component": [
1,1 1,0
] ]
}, },
"yz": { "yz": {
"x": 1, "x": 0,
"y": 1, "y": 0,
"component": [ "component": [
1,1 0,0
] ]
}, },
"component": [ "component": [
1,1,1 1,0,0
] ]
}, },
"sunHalo": { "sunHalo": {
"x": 1, "x": 0.927747,
"y": 1, "y": 0.011937,
"z": 1, "z": 0.011937,
"xy": { "xy": {
"x": 1, "x": 0.927747,
"y": 1, "y": 0.011937,
"component": [ "component": [
1,1 0.927747,0.011937
] ]
}, },
"yz": { "yz": {
"x": 1, "x": 0.011937,
"y": 1, "y": 0.011937,
"component": [ "component": [
1,1 0.011937,0.011937
] ]
}, },
"component": [ "component": [
1,1,1 0.927747,0.011937,0.011937
] ]
}, },
"sunLightColor": { "sunLightColor": {
"x": 1, "x": 0.866834,
"y": 1, "y": 0.505802,
"z": 1, "z": 0.032344,
"xy": { "xy": {
"x": 1, "x": 0.866834,
"y": 1, "y": 0.505802,
"component": [ "component": [
1,1 0.866834,0.505802
] ]
}, },
"yz": { "yz": {
"x": 1, "x": 0.505802,
"y": 1, "y": 0.032344,
"component": [ "component": [
1,1 0.505802,0.032344
] ]
}, },
"component": [ "component": [
1,1,1 0.866834,0.505802,0.032344
] ]
}, },
"sunPosition": { "sunPosition": {
"x": -1, "x": -1,
"y": 0.4, "y": 0.02,
"z": -0.3, "z": -0.5,
"xy": { "xy": {
"x": -1, "x": -1,
"y": 0.4, "y": 0.02,
"component": [ "component": [
-1,0.4 -1,0.02
] ]
}, },
"yz": { "yz": {
"x": 0.4, "x": 0.02,
"y": -0.3, "y": -0.5,
"component": [ "component": [
0.4,-0.3 0.02,-0.5
] ]
}, },
"component": [ "component": [
-1,0.4,-0.3 -1,0.02,-0.5
] ]
}, },
"sunIntensity": 2, "sunIntensity": 5.695224,
"skyIntensity": 1, "skyIntensity": 1,
"hasClouds": 1, "hasClouds": 1,
"planeHeight": 2.642177, "planeHeight": 2.642177,

File diff suppressed because it is too large Load Diff

View File

@ -163,17 +163,17 @@ vs_sky_source_glsl430 := u8.[
float _196 = dot(normalize(skypos), normalize(sunpos)); float _196 = dot(normalize(skypos), normalize(sunpos));
vec3 _199 = normalize(skypos); vec3 _199 = normalize(skypos);
vec3 final = mix(_178.skyBase, _178.skyTop, vec3(clamp(skypos.y * 2.0, 0.0, 0.699999988079071044921875))) + ((_178.sunHalo * clamp((_196 - 0.9700000286102294921875) * 10.0, 0.0, 0.800000011920928955078125)) * 1.0); vec3 final = mix(_178.skyBase, _178.skyTop, vec3(clamp(skypos.y * 2.0, 0.0, 0.699999988079071044921875))) + ((_178.sunHalo * clamp((_196 - 0.9700000286102294921875) * 10.0, 0.0, 0.800000011920928955078125)) * 1.0);
if (_196 > 0.999000012874603271484375) if (_196 > 0.999499976634979248046875)
{ {
final = _178.sunDisk; final = _178.sunDisk * 10.0;
} }
float _239 = _199.y; float _240 = _199.y;
final += (mix(_178.horizonHalo, vec3(0.0), vec3(clamp(abs(_239) * 80.0, 0.0, 1.0))) * 0.100000001490116119384765625); final += (mix(_178.horizonHalo, vec3(0.0), vec3(clamp(abs(_240) * 80.0, 0.0, 1.0))) * 0.100000001490116119384765625);
if (_178.hasClouds == 1) if (_178.hasClouds == 1)
{ {
vec3 param = ((_199 / vec3(_239)) * 2.0) + vec3(_178.time * 0.0500000007450580596923828125); vec3 param = ((_199 / vec3(_240)) * 2.0) + vec3(_178.time * 0.0500000007450580596923828125);
float _275 = fbm(param); float _276 = fbm(param);
final = mix(final, vec3(1.0), vec3((max(0.0, _239) * (smoothstep(0.5, 1.0, _275) * 0.300000011920928955078125)) * 2.0)); final = mix(final, vec3(1.0), vec3((max(0.0, _240) * (smoothstep(0.5, 1.0, _276) * 0.300000011920928955078125)) * 2.0));
} }
return final; return final;
} }
@ -382,50 +382,51 @@ fs_sky_source_glsl430 := u8.[
0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30, 0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,
0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a, 0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x39,0x36,0x20,0x3e,0x20,0x30, 0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x39,0x36,0x20,0x3e,0x20,0x30,
0x2e,0x39,0x39,0x39,0x30,0x30,0x30,0x30,0x31,0x32,0x38,0x37,0x34,0x36,0x30,0x33, 0x2e,0x39,0x39,0x39,0x34,0x39,0x39,0x39,0x37,0x36,0x36,0x33,0x34,0x39,0x37,0x39,
0x32,0x37,0x31,0x34,0x38,0x34,0x33,0x37,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b, 0x32,0x34,0x38,0x30,0x34,0x36,0x38,0x37,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d, 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,
0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x44,0x69,0x73,0x6b,0x3b,0x0a,0x20, 0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x44,0x69,0x73,0x6b,0x20,0x2a,0x20,
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f, 0x31,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
0x32,0x33,0x39,0x20,0x3d,0x20,0x5f,0x31,0x39,0x39,0x2e,0x79,0x3b,0x0a,0x20,0x20, 0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x34,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,
0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x2b,0x3d,0x20,0x28,0x6d,0x69,0x78,0x28, 0x39,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x2b,
0x5f,0x31,0x37,0x38,0x2e,0x68,0x6f,0x72,0x69,0x7a,0x6f,0x6e,0x48,0x61,0x6c,0x6f, 0x3d,0x20,0x28,0x6d,0x69,0x78,0x28,0x5f,0x31,0x37,0x38,0x2e,0x68,0x6f,0x72,0x69,
0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63, 0x7a,0x6f,0x6e,0x48,0x61,0x6c,0x6f,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,
0x33,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x61,0x62,0x73,0x28,0x5f,0x32,0x33,0x39, 0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x61,
0x29,0x20,0x2a,0x20,0x38,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31, 0x62,0x73,0x28,0x5f,0x32,0x34,0x30,0x29,0x20,0x2a,0x20,0x38,0x30,0x2e,0x30,0x2c,
0x2e,0x30,0x29,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,0x30, 0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x29,0x20,0x2a,0x20,0x30,
0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,0x37, 0x2e,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,
0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28, 0x31,0x31,0x39,0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,
0x5f,0x31,0x37,0x38,0x2e,0x68,0x61,0x73,0x43,0x6c,0x6f,0x75,0x64,0x73,0x20,0x3d, 0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x38,0x2e,0x68,0x61,0x73,0x43,
0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, 0x6c,0x6f,0x75,0x64,0x73,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20, 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,
0x28,0x28,0x5f,0x31,0x39,0x39,0x20,0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x32, 0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x28,0x28,0x5f,0x31,0x39,0x39,0x20,0x2f,0x20,
0x33,0x39,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2b,0x20,0x76,0x65, 0x76,0x65,0x63,0x33,0x28,0x5f,0x32,0x34,0x30,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,
0x63,0x33,0x28,0x5f,0x31,0x37,0x38,0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a,0x20,0x30, 0x30,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x31,0x37,0x38,0x2e,0x74,
0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,0x35,0x38, 0x69,0x6d,0x65,0x20,0x2a,0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,
0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x29,0x3b,0x0a, 0x30,0x37,0x34,0x35,0x30,0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32, 0x38,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
0x37,0x35,0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b, 0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x37,0x36,0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d, 0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x6d,0x69,0x78,0x28,0x66,0x69,0x6e,0x61,0x6c,0x2c,0x20,0x76,0x65,0x63,0x33, 0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x66,0x69,0x6e,0x61,
0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x28,0x6d,0x61,0x78, 0x6c,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,
0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x33,0x39,0x29,0x20,0x2a,0x20,0x28,0x73, 0x63,0x33,0x28,0x28,0x6d,0x61,0x78,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x34,
0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x35,0x2c,0x20,0x31, 0x30,0x29,0x20,0x2a,0x20,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,
0x2e,0x30,0x2c,0x20,0x5f,0x32,0x37,0x35,0x29,0x20,0x2a,0x20,0x30,0x2e,0x33,0x30, 0x28,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x37,0x36,0x29,
0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35, 0x20,0x2a,0x20,0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,
0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x29, 0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, 0x2a,0x20,0x32,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,
0x72,0x6e,0x20,0x66,0x69,0x6e,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69, 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x69,0x6e,0x61,0x6c,0x3b,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76, 0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d, 0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,
0x61,0x6c,0x69,0x7a,0x65,0x28,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a, 0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x70,0x6f,0x73,
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, 0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,
0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,0x69,0x74, 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,
0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, 0x75,0x6e,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x73,0x6b,0x79,0x28,0x70, 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,
0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x20,0x2a, 0x34,0x28,0x73,0x6b,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,
0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69, 0x61,0x6d,0x5f,0x31,0x29,0x20,0x2a,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x6b,0x79,
0x74,0x79,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x00,
]; ];
/* /*
#version 300 es #version 300 es
@ -538,17 +539,17 @@ vs_sky_source_glsl300es := u8.[
highp float _196 = dot(normalize(skypos), normalize(sunpos)); highp float _196 = dot(normalize(skypos), normalize(sunpos));
highp vec3 _199 = normalize(skypos); highp vec3 _199 = normalize(skypos);
highp vec3 final = mix(_178.skyBase, _178.skyTop, vec3(clamp(skypos.y * 2.0, 0.0, 0.699999988079071044921875))) + ((_178.sunHalo * clamp((_196 - 0.9700000286102294921875) * 10.0, 0.0, 0.800000011920928955078125)) * 1.0); highp vec3 final = mix(_178.skyBase, _178.skyTop, vec3(clamp(skypos.y * 2.0, 0.0, 0.699999988079071044921875))) + ((_178.sunHalo * clamp((_196 - 0.9700000286102294921875) * 10.0, 0.0, 0.800000011920928955078125)) * 1.0);
if (_196 > 0.999000012874603271484375) if (_196 > 0.999499976634979248046875)
{ {
final = _178.sunDisk; final = _178.sunDisk * 10.0;
} }
highp float _239 = _199.y; highp float _240 = _199.y;
final += (mix(_178.horizonHalo, vec3(0.0), vec3(clamp(abs(_239) * 80.0, 0.0, 1.0))) * 0.100000001490116119384765625); final += (mix(_178.horizonHalo, vec3(0.0), vec3(clamp(abs(_240) * 80.0, 0.0, 1.0))) * 0.100000001490116119384765625);
if (_178.hasClouds == 1) if (_178.hasClouds == 1)
{ {
highp vec3 param = ((_199 / vec3(_239)) * 2.0) + vec3(_178.time * 0.0500000007450580596923828125); highp vec3 param = ((_199 / vec3(_240)) * 2.0) + vec3(_178.time * 0.0500000007450580596923828125);
highp float _275 = fbm(param); highp float _276 = fbm(param);
final = mix(final, vec3(1.0), vec3((max(0.0, _239) * (smoothstep(0.5, 1.0, _275) * 0.300000011920928955078125)) * 2.0)); final = mix(final, vec3(1.0), vec3((max(0.0, _240) * (smoothstep(0.5, 1.0, _276) * 0.300000011920928955078125)) * 2.0));
} }
return final; return final;
} }
@ -776,53 +777,53 @@ fs_sky_source_glsl300es := u8.[
0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39, 0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,
0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20, 0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20,
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31, 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,
0x39,0x36,0x20,0x3e,0x20,0x30,0x2e,0x39,0x39,0x39,0x30,0x30,0x30,0x30,0x31,0x32, 0x39,0x36,0x20,0x3e,0x20,0x30,0x2e,0x39,0x39,0x39,0x34,0x39,0x39,0x39,0x37,0x36,
0x38,0x37,0x34,0x36,0x30,0x33,0x32,0x37,0x31,0x34,0x38,0x34,0x33,0x37,0x35,0x29, 0x36,0x33,0x34,0x39,0x37,0x39,0x32,0x34,0x38,0x30,0x34,0x36,0x38,0x37,0x35,0x29,
0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, 0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x44, 0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x44,
0x69,0x73,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x68, 0x69,0x73,0x6b,0x20,0x2a,0x20,0x31,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x33,0x39,0x20, 0x7d,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,
0x3d,0x20,0x5f,0x31,0x39,0x39,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x69, 0x74,0x20,0x5f,0x32,0x34,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x39,0x2e,0x79,0x3b,
0x6e,0x61,0x6c,0x20,0x2b,0x3d,0x20,0x28,0x6d,0x69,0x78,0x28,0x5f,0x31,0x37,0x38, 0x0a,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x2b,0x3d,0x20,0x28,0x6d,
0x2e,0x68,0x6f,0x72,0x69,0x7a,0x6f,0x6e,0x48,0x61,0x6c,0x6f,0x2c,0x20,0x76,0x65, 0x69,0x78,0x28,0x5f,0x31,0x37,0x38,0x2e,0x68,0x6f,0x72,0x69,0x7a,0x6f,0x6e,0x48,
0x63,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x63,0x6c, 0x61,0x6c,0x6f,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,
0x61,0x6d,0x70,0x28,0x61,0x62,0x73,0x28,0x5f,0x32,0x33,0x39,0x29,0x20,0x2a,0x20, 0x76,0x65,0x63,0x33,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x61,0x62,0x73,0x28,0x5f,
0x38,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29, 0x32,0x34,0x30,0x29,0x20,0x2a,0x20,0x38,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,
0x29,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34, 0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,
0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32, 0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,
0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x38, 0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,
0x2e,0x68,0x61,0x73,0x43,0x6c,0x6f,0x75,0x64,0x73,0x20,0x3d,0x3d,0x20,0x31,0x29, 0x66,0x20,0x28,0x5f,0x31,0x37,0x38,0x2e,0x68,0x61,0x73,0x43,0x6c,0x6f,0x75,0x64,
0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68, 0x73,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,
0x3d,0x20,0x28,0x28,0x5f,0x31,0x39,0x39,0x20,0x2f,0x20,0x76,0x65,0x63,0x33,0x28, 0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x28,0x28,0x5f,0x31,0x39,0x39,0x20,
0x5f,0x32,0x33,0x39,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2b,0x20, 0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x32,0x34,0x30,0x29,0x29,0x20,0x2a,0x20,
0x76,0x65,0x63,0x33,0x28,0x5f,0x31,0x37,0x38,0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a, 0x32,0x2e,0x30,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x31,0x37,0x38,
0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30, 0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a,0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,
0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x29, 0x30,0x30,0x30,0x37,0x34,0x35,0x30,0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20, 0x38,0x32,0x38,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x37,0x35,0x20,0x3d,0x20,0x66,0x62,0x6d, 0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x37,
0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x36,0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,
0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x66,0x69,0x6e, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,
0x61,0x6c,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,0x76, 0x6d,0x69,0x78,0x28,0x66,0x69,0x6e,0x61,0x6c,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,
0x65,0x63,0x33,0x28,0x28,0x6d,0x61,0x78,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x32, 0x31,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x28,0x6d,0x61,0x78,0x28,
0x33,0x39,0x29,0x20,0x2a,0x20,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65, 0x30,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x34,0x30,0x29,0x20,0x2a,0x20,0x28,0x73,0x6d,
0x70,0x28,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x37,0x35, 0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,
0x29,0x20,0x2a,0x20,0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39, 0x30,0x2c,0x20,0x5f,0x32,0x37,0x36,0x29,0x20,0x2a,0x20,0x30,0x2e,0x33,0x30,0x30,
0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x29, 0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,
0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, 0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x29,0x3b,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x69,0x6e,0x61,0x6c, 0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, 0x6e,0x20,0x66,0x69,0x6e,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63, 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,
0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c, 0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,
0x69,0x7a,0x65,0x28,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20, 0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x70,0x6f,0x73,0x2e,0x78,
0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72, 0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x50, 0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x31,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, 0x37,0x38,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x73, 0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
0x6b,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, 0x20,0x76,0x65,0x63,0x34,0x28,0x73,0x6b,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,
0x31,0x29,0x20,0x2a,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74, 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x20,0x2a,0x20,0x5f,0x31,0x37,0x38,
0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a, 0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x31,
0x0a,0x00, 0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
]; ];
/* /*
#include <metal_stdlib> #include <metal_stdlib>
@ -979,17 +980,17 @@ vs_sky_source_metal_macos := u8.[
float _196 = dot(fast::normalize(skypos), fast::normalize(sunpos)); float _196 = dot(fast::normalize(skypos), fast::normalize(sunpos));
float3 _199 = fast::normalize(skypos); float3 _199 = fast::normalize(skypos);
float3 final = mix(_178.skyBase, _178.skyTop, float3(fast::clamp(skypos.y * 2.0, 0.0, 0.699999988079071044921875))) + ((_178.sunHalo * fast::clamp((_196 - 0.9700000286102294921875) * 10.0, 0.0, 0.800000011920928955078125)) * 1.0); float3 final = mix(_178.skyBase, _178.skyTop, float3(fast::clamp(skypos.y * 2.0, 0.0, 0.699999988079071044921875))) + ((_178.sunHalo * fast::clamp((_196 - 0.9700000286102294921875) * 10.0, 0.0, 0.800000011920928955078125)) * 1.0);
if (_196 > 0.999000012874603271484375) if (_196 > 0.999499976634979248046875)
{ {
final = _178.sunDisk; final = _178.sunDisk * 10.0;
} }
float _239 = _199.y; float _240 = _199.y;
final += (mix(_178.horizonHalo, float3(0.0), float3(fast::clamp(abs(_239) * 80.0, 0.0, 1.0))) * 0.100000001490116119384765625); final += (mix(_178.horizonHalo, float3(0.0), float3(fast::clamp(abs(_240) * 80.0, 0.0, 1.0))) * 0.100000001490116119384765625);
if (_178.hasClouds == 1) if (_178.hasClouds == 1)
{ {
float3 param = ((_199 / float3(_239)) * 2.0) + float3(_178.time * 0.0500000007450580596923828125); float3 param = ((_199 / float3(_240)) * 2.0) + float3(_178.time * 0.0500000007450580596923828125);
float _275 = fbm(param); float _276 = fbm(param);
final = mix(final, float3(1.0), float3((fast::max(0.0, _239) * (smoothstep(0.5, 1.0, _275) * 0.300000011920928955078125)) * 2.0)); final = mix(final, float3(1.0), float3((fast::max(0.0, _240) * (smoothstep(0.5, 1.0, _276) * 0.300000011920928955078125)) * 2.0));
} }
return final; return final;
} }
@ -1232,63 +1233,63 @@ fs_sky_source_metal_macos := u8.[
0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, 0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,
0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29, 0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,
0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66, 0x29,0x20,0x2a,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,
0x20,0x28,0x5f,0x31,0x39,0x36,0x20,0x3e,0x20,0x30,0x2e,0x39,0x39,0x39,0x30,0x30, 0x20,0x28,0x5f,0x31,0x39,0x36,0x20,0x3e,0x20,0x30,0x2e,0x39,0x39,0x39,0x34,0x39,
0x30,0x30,0x31,0x32,0x38,0x37,0x34,0x36,0x30,0x33,0x32,0x37,0x31,0x34,0x38,0x34, 0x39,0x39,0x37,0x36,0x36,0x33,0x34,0x39,0x37,0x39,0x32,0x34,0x38,0x30,0x34,0x36,
0x33,0x37,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, 0x38,0x37,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e, 0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,
0x73,0x75,0x6e,0x44,0x69,0x73,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, 0x73,0x75,0x6e,0x44,0x69,0x73,0x6b,0x20,0x2a,0x20,0x31,0x30,0x2e,0x30,0x3b,0x0a,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x33,0x39,0x20,0x3d,0x20, 0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
0x5f,0x31,0x39,0x39,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61, 0x5f,0x32,0x34,0x30,0x20,0x3d,0x20,0x5f,0x31,0x39,0x39,0x2e,0x79,0x3b,0x0a,0x20,
0x6c,0x20,0x2b,0x3d,0x20,0x28,0x6d,0x69,0x78,0x28,0x5f,0x31,0x37,0x38,0x2e,0x68, 0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x2b,0x3d,0x20,0x28,0x6d,0x69,0x78,
0x6f,0x72,0x69,0x7a,0x6f,0x6e,0x48,0x61,0x6c,0x6f,0x2c,0x20,0x66,0x6c,0x6f,0x61, 0x28,0x5f,0x31,0x37,0x38,0x2e,0x68,0x6f,0x72,0x69,0x7a,0x6f,0x6e,0x48,0x61,0x6c,
0x74,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28, 0x6f,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,
0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c,0x61,0x6d,0x70,0x28,0x61,0x62,0x73,0x28, 0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c,0x61,
0x5f,0x32,0x33,0x39,0x29,0x20,0x2a,0x20,0x38,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e, 0x6d,0x70,0x28,0x61,0x62,0x73,0x28,0x5f,0x32,0x34,0x30,0x29,0x20,0x2a,0x20,0x38,
0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30, 0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x29,
0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39, 0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,
0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,
0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x38,0x2e,0x68,0x61,0x73,0x43,0x6c,0x6f,0x75, 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x37,0x38,0x2e,
0x64,0x73,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20, 0x68,0x61,0x73,0x43,0x6c,0x6f,0x75,0x64,0x73,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61, 0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,
0x72,0x61,0x6d,0x20,0x3d,0x20,0x28,0x28,0x5f,0x31,0x39,0x39,0x20,0x2f,0x20,0x66, 0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x28,0x28,0x5f,
0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x32,0x33,0x39,0x29,0x29,0x20,0x2a,0x20,0x32, 0x31,0x39,0x39,0x20,0x2f,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x32,0x34,
0x2e,0x30,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x31,0x37, 0x30,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,
0x38,0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a,0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30, 0x61,0x74,0x33,0x28,0x5f,0x31,0x37,0x38,0x2e,0x74,0x69,0x6d,0x65,0x20,0x2a,0x20,
0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32, 0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,0x35,
0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, 0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x29,0x3b,
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32,0x37,0x35,0x20,0x3d,0x20,0x66, 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
0x62,0x6d,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, 0x32,0x37,0x36,0x20,0x3d,0x20,0x66,0x62,0x6d,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,
0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x3d,0x20,0x6d,0x69,0x78,0x28,0x66, 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,
0x69,0x6e,0x61,0x6c,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30, 0x3d,0x20,0x6d,0x69,0x78,0x28,0x66,0x69,0x6e,0x61,0x6c,0x2c,0x20,0x66,0x6c,0x6f,
0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x28,0x66,0x61,0x73,0x74,0x3a, 0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,
0x3a,0x6d,0x61,0x78,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x33,0x39,0x29,0x20, 0x28,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x30,0x2e,0x30,0x2c,
0x2a,0x20,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e, 0x20,0x5f,0x32,0x34,0x30,0x29,0x20,0x2a,0x20,0x28,0x73,0x6d,0x6f,0x6f,0x74,0x68,
0x35,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x37,0x35,0x29,0x20,0x2a,0x20, 0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x5f,
0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32, 0x32,0x37,0x36,0x29,0x20,0x2a,0x20,0x30,0x2e,0x33,0x30,0x30,0x30,0x30,0x30,0x30,
0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x29,0x29,0x20,0x2a,0x20,0x32, 0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,
0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, 0x35,0x29,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x69,0x6e,0x61,0x6c,0x3b,0x0a,0x7d,0x0a, 0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x69,
0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 0x6e,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,
0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f, 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,
0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, 0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,
0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x73,0x6b,0x79, 0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,
0x5f,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x26,0x20,0x5f, 0x61,0x6e,0x74,0x20,0x73,0x6b,0x79,0x5f,0x77,0x6f,0x72,0x6c,0x64,0x5f,0x63,0x6f,
0x31,0x37,0x38,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d, 0x6e,0x66,0x69,0x67,0x26,0x20,0x5f,0x31,0x37,0x38,0x20,0x5b,0x5b,0x62,0x75,0x66,
0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f, 0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20, 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20, 0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,
0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28, 0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,
0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20, 0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2e,0x78,0x79,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20, 0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,
0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75, 0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,
0x6e,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x73,0x6b,0x79,0x28,0x70,0x61,0x72,0x61, 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x73,
0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x5f,0x31,0x37,0x38, 0x6b,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,
0x29,0x20,0x2a,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65, 0x31,0x2c,0x20,0x5f,0x31,0x37,0x38,0x29,0x20,0x2a,0x20,0x5f,0x31,0x37,0x38,0x2e,
0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20, 0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,0x20,0x31,0x2e,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,
0x00, 0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
]; ];
sky_shader_desc :: (backend: sg_backend) -> sg_shader_desc { sky_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc: sg_shader_desc; desc: sg_shader_desc;

View File

@ -10,11 +10,13 @@ layout(binding=0) uniform plane_vs_params {
out vec4 pos; out vec4 pos;
out flat int idx; out flat int idx;
out float depth;
void main() { void main() {
vec3 multisize = vec3(position.xyz * 1000.0); vec3 multisize = vec3(position.xyz * 1000.0);
multisize.y += float(gl_InstanceIndex) * planeHeight; multisize.y += float(gl_InstanceIndex) * planeHeight;
gl_Position = mvp * vec4(multisize, 1.0); gl_Position = mvp * vec4(multisize, 1.0);
depth = gl_Position.z;
pos = vec4(multisize, 1.0); pos = vec4(multisize, 1.0);
idx = gl_InstanceIndex; idx = gl_InstanceIndex;
} }
@ -24,6 +26,7 @@ void main() {
in vec4 pos; in vec4 pos;
in flat int idx; in flat int idx;
in float depth;
out vec4 frag_color; out vec4 frag_color;
// Uniform bindings from the original shader // Uniform bindings from the original shader
@ -101,6 +104,12 @@ float fbm(vec2 p) {
return value; return value;
} }
vec3 sky(vec3 skypos, vec3 sunpos) {
vec3 skyGradient = mix(skyBase, skyTop, clamp(skypos.y * 2.0, 0.0, 0.7));
vec3 final = skyGradient;
return final;
}
void main() { void main() {
if(idx == 1) { // Second instance of the plane is the actual water surface. if(idx == 1) { // Second instance of the plane is the actual water surface.
vec2 uv1 = pos.xz * 0.4 + time * vec2(-0.005, -0.012) * 1.5; vec2 uv1 = pos.xz * 0.4 + time * vec2(-0.005, -0.012) * 1.5;
@ -138,7 +147,10 @@ void main() {
float reflection_alpha = 0.5; float reflection_alpha = 0.5;
float alpha = mix(refraction_alpha, reflection_alpha, fresnel); float alpha = mix(refraction_alpha, reflection_alpha, fresnel);
frag_color = vec4(final_color, alpha); vec3 fog = skyIntensity * sky(normalize(pos.xyz), sunPosition);
float fogFactor = smoothstep(950.0, 1000.0, length(pos.xz));
frag_color = vec4(mix(final_color, fog, fogFactor), mix(alpha, 1.0, fogFactor));
} else { // Deep water plane } else { // Deep water plane
vec2 noise_uv = pos.xz * 0.05 + time * 0.01; vec2 noise_uv = pos.xz * 0.05 + time * 0.01;

View File

@ -91,8 +91,8 @@ vec3 sky(vec3 skypos, vec3 sunpos) {
final += sunHalo.xyz * clamp((sDist - 0.97) * 10.0, 0.0, 0.8) * 1.0; final += sunHalo.xyz * clamp((sDist - 0.97) * 10.0, 0.0, 0.8) * 1.0;
// Sun disk // Sun disk
if(sDist > 0.999) { if(sDist > 0.9995) {
final = sunDisk.xyz; final = sunDisk.xyz * 10.0;
} }
// Horizon halo // Horizon halo