ssao works

This commit is contained in:
Tuomas Katajisto 2025-10-20 20:18:21 +03:00
parent 4136bac55d
commit e3fa3031fa
6 changed files with 283 additions and 301 deletions

View File

@ -159,7 +159,7 @@
"sunIntensity": 2, "sunIntensity": 2,
"skyIntensity": 1, "skyIntensity": 1,
"hasClouds": 1, "hasClouds": 1,
"planeHeight": 2.349047, "planeHeight": 0,
"planeType": 1, "planeType": 1,
"waterColor": { "waterColor": {
"x": 0.113144, "x": 0.113144,
@ -219,11 +219,21 @@
},{ },{
"trileName": "test", "trileName": "test",
"positions": [ "positions": [
-3,1,-1,1,0,0,2,1,-3,0,2,1,-3,0,-1,1,-3,1,2,1,0,1,2,1,0,0,-1,1 -3,1,-1,1,0,1,2,1,-3,1,2,1
] ]
},{ },{
"trileName": "plat", "trileName": "plat",
"positions": [ "positions": [
-4,0,-1,1,-4,0,0,1,-4,0,2,1,-1,0,-1,1,-3,0,1,1,-3,0,0,1,0,0,0,1,-2,0,-1,1,-2,0,1,1,-2,0,2,1,-1,0,2,1,-1,0,1,1,-2,0,0,1,-1,0,0,1,0,0,1,1
]
},{
"trileName": "deck",
"positions": [
]
},{
"trileName": "aaa",
"positions": [
-3,0,2,1,-4,0,1,1,-3,0,-1,1,0,0,-1,1,0,0,2,1
] ]
} }
], ],

View File

@ -87,7 +87,7 @@ init :: () {
state.font_default.fons_font = FONS_INVALID; state.font_default.fons_font = FONS_INVALID;
create_pipelines(); create_pipelines();
state.pass_action_clear.colors[0] = .{ load_action = .CLEAR, clear_value = .{ r = 0.6, g = 0.7, b = 1.0, a = 1 } }; state.pass_action_clear.colors[0] = .{ load_action = .CLEAR, clear_value = .{ r = 0, g = 0, b = 0, a = 0 } };
state.pass_action.colors[0] = .{ load_action = .LOAD }; state.pass_action.colors[0] = .{ load_action = .LOAD };
init_asset_pack_load(); init_asset_pack_load();

View File

@ -260,10 +260,10 @@ backend_process_command_buckets :: () {
sg_apply_pipeline(gPipelines.ssao.pipeline); sg_apply_pipeline(gPipelines.ssao.pipeline);
gPipelines.ssao.bind.images[0] = g_gbuf_position; gPipelines.ssao.bind.images[0] = g_gbuf_position;
gPipelines.ssao.bind.images[1] = g_gbuf_normal; gPipelines.ssao.bind.images[1] = g_gbuf_normal;
gPipelines.ssao.bind.images[2] = g_gbuf_position; gPipelines.ssao.bind.images[2] = g_ssao_noise_buf;
sg_apply_bindings(*gPipelines.ssao.bind); sg_apply_bindings(*gPipelines.ssao.bind);
ssao_fs_uniform : Ssao_Fs_Params; ssao_fs_uniform : Ssao_Fs_Params;
mvp := create_viewproj(*camera); mvp := create_perspective(*camera);
ssao_fs_uniform.projection = mvp.floats; ssao_fs_uniform.projection = mvp.floats;
ssao_fs_uniform.samples = g_ssao_samples; ssao_fs_uniform.samples = g_ssao_samples;
sg_apply_uniforms(UB_ssao_fs_params, *(sg_range.{ ptr = *ssao_fs_uniform, size = size_of(type_of(ssao_fs_uniform)) })); sg_apply_uniforms(UB_ssao_fs_params, *(sg_range.{ ptr = *ssao_fs_uniform, size = size_of(type_of(ssao_fs_uniform)) }));

View File

@ -678,6 +678,7 @@ create_postprocess_pipeline :: () {
} }
create_ssao_pipeline :: () { create_ssao_pipeline :: () {
init_ssao();
platconf := get_plat_conf(); platconf := get_plat_conf();
pipeline: sg_pipeline_desc; pipeline: sg_pipeline_desc;
shader_desc := ssao_shader_desc(sg_query_backend()); shader_desc := ssao_shader_desc(sg_query_backend());
@ -729,8 +730,8 @@ create_ssao_pipeline :: () {
gPipelines.ssao.bind.vertex_buffers[0] = sg_make_buffer(*vbuffer); gPipelines.ssao.bind.vertex_buffers[0] = sg_make_buffer(*vbuffer);
gPipelines.ssao.bind.index_buffer = sg_make_buffer(*ibuffer); gPipelines.ssao.bind.index_buffer = sg_make_buffer(*ibuffer);
gPipelines.ssao.bind.samplers[0] = sg_make_sampler(*(sg_sampler_desc.{ gPipelines.ssao.bind.samplers[0] = sg_make_sampler(*(sg_sampler_desc.{
wrap_u = .CLAMP_TO_EDGE, wrap_u = .REPEAT,
wrap_v = .CLAMP_TO_EDGE, wrap_v = .REPEAT,
min_filter = .NEAREST, min_filter = .NEAREST,
mag_filter = .NEAREST, mag_filter = .NEAREST,
})); }));
@ -760,12 +761,12 @@ create_ssao_pipeline :: () {
g_ssao_attachments = sg_make_attachments(*attachmentsDesc); g_ssao_attachments = sg_make_attachments(*attachmentsDesc);
imgdata : sg_image_data; imgdata : sg_image_data;
imgdata.subimage[0][0] = .{g_ssao_noise.data, cast(u64) (16*4)}; imgdata.subimage[0][0] = .{g_ssao_noise.data, cast(u64) (16*4*4)};
texdesc : sg_image_desc = .{ texdesc : sg_image_desc = .{
render_target = false, render_target = false,
width = 4, width = 4,
height = 4, height = 4,
pixel_format = sg_pixel_format.RGBA8, pixel_format = sg_pixel_format.RGBA32F,
sample_count = 1, sample_count = 1,
data = imgdata data = imgdata
}; };

View File

@ -81,7 +81,7 @@ vs_ssao_source_glsl430 := u8.[
/* /*
#version 430 #version 430
vec4 _204; vec4 _208;
uniform vec4 ssao_fs_params[68]; uniform vec4 ssao_fs_params[68];
layout(binding = 16) uniform sampler2D g_position_ssao_smp; layout(binding = 16) uniform sampler2D g_position_ssao_smp;
@ -93,39 +93,36 @@ vs_ssao_source_glsl430 := u8.[
void main() void main()
{ {
vec4 _25 = texture(g_position_ssao_smp, quad_uv); vec3 _26 = texture(g_position_ssao_smp, quad_uv).xyz;
vec3 _26 = _25.xyz;
vec3 _35 = normalize(texture(g_normal_ssao_smp, quad_uv).xyz); vec3 _35 = normalize(texture(g_normal_ssao_smp, quad_uv).xyz);
vec3 _51 = normalize(texture(tex_noise_ssao_smp, quad_uv * vec2(320.0, 180.0)).xyz); vec3 _51 = normalize(texture(tex_noise_ssao_smp, quad_uv * vec2(480.0, 270.0)).xyz);
vec3 _60 = normalize(_51 - (_35 * dot(_51, _35))); vec3 _60 = normalize(_51 - (_35 * dot(_51, _35)));
mat3 _85 = mat3(_60, cross(_35, _60), _35); mat3 _85 = mat3(_60, cross(_35, _60), _35);
float occlusion = 0.0; float occlusion = 0.0;
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
vec3 _119 = _26 + (_85 * ssao_fs_params[i * 1 + 4].xyz); vec3 _121 = _26 + ((_85 * ssao_fs_params[i * 1 + 4].xyz) * 0.20000000298023223876953125);
vec4 _131 = mat4(ssao_fs_params[0], ssao_fs_params[1], ssao_fs_params[2], ssao_fs_params[3]) * vec4(_119, 1.0); vec4 _133 = mat4(ssao_fs_params[0], ssao_fs_params[1], ssao_fs_params[2], ssao_fs_params[3]) * vec4(_121, 1.0);
vec2 _138 = _131.xy / vec2(_131.w); vec3 _140 = _133.xyz / vec3(_133.w);
vec4 _192; vec4 _193;
_192.x = _138.x; _193.x = _140.x;
_192.y = _138.y; _193.y = _140.y;
vec2 _150 = (_192.xy * 0.5) + vec2(0.5); vec3 _155 = (_193.xyz * 0.5) + vec3(0.5);
vec4 _196; vec4 _199;
_196.x = _150.x; _199.x = _155.x;
_196.y = _150.y; _199.y = _155.y;
vec4 _161 = texture(g_position_ssao_smp, _196.xy); occlusion += float(texture(g_position_ssao_smp, _199.xy).z >= _121.z);
float _163 = _161.z;
occlusion += (float(_163 >= _119.z) * smoothstep(0.0, 1.0, 1.0 - (_25.z - _163)));
} }
float _182 = occlusion; float _179 = occlusion;
float _185 = 1.0 - (_182 * 0.015625); float _182 = 1.0 - (_179 * 0.015625);
occlusion = _185; occlusion = _182;
out_color = vec4(_185, _185, _185, 1.0); out_color = vec4(_182, _182, _182, 1.0);
} }
*/ */
fs_ssao_source_glsl430 := u8.[ fs_ssao_source_glsl430 := u8.[
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x76,0x65, 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x76,0x65,
0x63,0x34,0x20,0x5f,0x32,0x30,0x34,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72, 0x63,0x34,0x20,0x5f,0x32,0x30,0x38,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,
0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70, 0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, 0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20, 0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,
@ -145,78 +142,72 @@ fs_ssao_source_glsl430 := u8.[
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34, 0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69, 0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76, 0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,
0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72, 0x65,0x63,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,
0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61, 0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,
0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x3b, 0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,0x20, 0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,
0x5f,0x32,0x35,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, 0x35,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,
0x33,0x20,0x5f,0x33,0x35,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a, 0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x73,
0x65,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d, 0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,
0x61,0x6c,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61, 0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,
0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x20,0x5f,0x35,0x31,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x76,0x65,0x63,0x33,0x20,0x5f,0x35,0x31,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61, 0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,
0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78, 0x73,0x65,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,
0x5f,0x6e,0x6f,0x69,0x73,0x65,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c, 0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x34,0x38,0x30,0x2e,
0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28, 0x30,0x2c,0x20,0x32,0x37,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,
0x33,0x32,0x30,0x2e,0x30,0x2c,0x20,0x31,0x38,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78, 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,
0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x36, 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20,
0x30,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35, 0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20,
0x31,0x20,0x2d,0x20,0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,0x64,0x6f,0x74,0x28,0x5f, 0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x74,0x33,
0x35,0x31,0x2c,0x20,0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x20,0x5f,0x38,0x35,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x5f,0x36,0x30,0x2c,
0x6d,0x61,0x74,0x33,0x20,0x5f,0x38,0x35,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28, 0x20,0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,
0x5f,0x36,0x30,0x2c,0x20,0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,0x33,0x35,0x2c,0x20, 0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
0x5f,0x36,0x30,0x29,0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x2e,
0x66,0x6c,0x6f,0x61,0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20, 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,
0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28, 0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x36,0x34,0x3b,0x20,0x69,
0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x36, 0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x34,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20, 0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x32,0x31,0x20,0x3d,0x20,0x5f,0x32,
0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x31,0x39,0x20, 0x36,0x20,0x2b,0x20,0x28,0x28,0x5f,0x38,0x35,0x20,0x2a,0x20,0x73,0x73,0x61,0x6f,
0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,0x5f,0x38,0x35,0x20,0x2a,0x20,0x73, 0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x69,0x20,0x2a,0x20,0x31,
0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x69,0x20, 0x20,0x2b,0x20,0x34,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x30,0x2e,0x32,
0x2a,0x20,0x31,0x20,0x2b,0x20,0x34,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20, 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x33,0x31, 0x38,0x37,0x36,0x39,0x35,0x33,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f, 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x33,0x33,0x20,0x3d,0x20,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f, 0x6d,0x61,0x74,0x34,0x28,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,
0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x73,0x73, 0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,
0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c, 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,
0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x73,0x73,
0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x31,0x39,0x2c, 0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76, 0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x32,0x31,0x2c,0x20,0x31,0x2e,
0x65,0x63,0x32,0x20,0x5f,0x31,0x33,0x38,0x20,0x3d,0x20,0x5f,0x31,0x33,0x31,0x2e, 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,
0x78,0x79,0x20,0x2f,0x20,0x76,0x65,0x63,0x32,0x28,0x5f,0x31,0x33,0x31,0x2e,0x77, 0x20,0x5f,0x31,0x34,0x30,0x20,0x3d,0x20,0x5f,0x31,0x33,0x33,0x2e,0x78,0x79,0x7a,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20, 0x20,0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x31,0x33,0x33,0x2e,0x77,0x29,0x3b,
0x5f,0x31,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31, 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,
0x39,0x32,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x33,0x38,0x2e,0x78,0x3b,0x0a,0x20, 0x39,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x33,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x32,0x2e,0x79,0x20,0x3d,0x20, 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,
0x5f,0x31,0x33,0x38,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x33,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,
0x76,0x65,0x63,0x32,0x20,0x5f,0x31,0x35,0x30,0x20,0x3d,0x20,0x28,0x5f,0x31,0x39, 0x34,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,
0x32,0x2e,0x78,0x79,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65, 0x63,0x33,0x20,0x5f,0x31,0x35,0x35,0x20,0x3d,0x20,0x28,0x5f,0x31,0x39,0x33,0x2e,
0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,
0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x33,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x36,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35, 0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x39,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39, 0x20,0x20,0x20,0x5f,0x31,0x39,0x39,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35,0x35,
0x36,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x35,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20, 0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x39,
0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x36,0x31,0x20, 0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x35,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,
0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69, 0x20,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x2b,
0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x5f, 0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,
0x31,0x39,0x36,0x2e,0x78,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x36,0x33,0x20,0x3d,0x20,0x5f,0x31, 0x73,0x6d,0x70,0x2c,0x20,0x5f,0x31,0x39,0x39,0x2e,0x78,0x79,0x29,0x2e,0x7a,0x20,
0x36,0x31,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x63, 0x3e,0x3d,0x20,0x5f,0x31,0x32,0x31,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x2b,0x3d,0x20,0x28,0x66,0x6c,0x6f,0x61, 0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x37,0x39,
0x74,0x28,0x5f,0x31,0x36,0x33,0x20,0x3e,0x3d,0x20,0x5f,0x31,0x31,0x39,0x2e,0x7a, 0x20,0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,
0x29,0x20,0x2a,0x20,0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30, 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x32,0x20,0x3d,0x20,0x31,
0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28, 0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x37,0x39,0x20,0x2a,0x20,0x30,0x2e,0x30,
0x5f,0x32,0x35,0x2e,0x7a,0x20,0x2d,0x20,0x5f,0x31,0x36,0x33,0x29,0x29,0x29,0x3b, 0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,
0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, 0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x38,0x32,0x3b,0x0a,0x20,0x20,
0x20,0x5f,0x31,0x38,0x32,0x20,0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f, 0x20,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,
0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38, 0x63,0x34,0x28,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,
0x35,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x38,0x32,0x20, 0x31,0x38,0x32,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x2a,0x20,0x30,0x2e,0x30,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x38,
0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x38,0x35,0x2c,0x20,0x5f,0x31,
0x38,0x35,0x2c,0x20,0x5f,0x31,0x38,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
0x7d,0x0a,0x0a,0x00,
]; ];
/* /*
#version 300 es #version 300 es
@ -251,7 +242,7 @@ vs_ssao_source_glsl300es := u8.[
precision mediump float; precision mediump float;
precision highp int; precision highp int;
vec4 _204; vec4 _208;
uniform highp vec4 ssao_fs_params[68]; uniform highp vec4 ssao_fs_params[68];
uniform highp sampler2D g_position_ssao_smp; uniform highp sampler2D g_position_ssao_smp;
@ -263,33 +254,30 @@ vs_ssao_source_glsl300es := u8.[
void main() void main()
{ {
highp vec4 _25 = texture(g_position_ssao_smp, quad_uv); highp vec3 _26 = texture(g_position_ssao_smp, quad_uv).xyz;
highp vec3 _26 = _25.xyz;
highp vec3 _35 = normalize(texture(g_normal_ssao_smp, quad_uv).xyz); highp vec3 _35 = normalize(texture(g_normal_ssao_smp, quad_uv).xyz);
highp vec3 _51 = normalize(texture(tex_noise_ssao_smp, quad_uv * vec2(320.0, 180.0)).xyz); highp vec3 _51 = normalize(texture(tex_noise_ssao_smp, quad_uv * vec2(480.0, 270.0)).xyz);
highp vec3 _60 = normalize(_51 - (_35 * dot(_51, _35))); highp vec3 _60 = normalize(_51 - (_35 * dot(_51, _35)));
highp mat3 _85 = mat3(_60, cross(_35, _60), _35); highp mat3 _85 = mat3(_60, cross(_35, _60), _35);
highp float occlusion = 0.0; highp float occlusion = 0.0;
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
highp vec3 _119 = _26 + (_85 * ssao_fs_params[i * 1 + 4].xyz); highp vec3 _121 = _26 + ((_85 * ssao_fs_params[i * 1 + 4].xyz) * 0.20000000298023223876953125);
highp vec4 _131 = mat4(ssao_fs_params[0], ssao_fs_params[1], ssao_fs_params[2], ssao_fs_params[3]) * vec4(_119, 1.0); highp vec4 _133 = mat4(ssao_fs_params[0], ssao_fs_params[1], ssao_fs_params[2], ssao_fs_params[3]) * vec4(_121, 1.0);
highp vec2 _138 = _131.xy / vec2(_131.w); highp vec3 _140 = _133.xyz / vec3(_133.w);
highp vec4 _192; highp vec4 _193;
_192.x = _138.x; _193.x = _140.x;
_192.y = _138.y; _193.y = _140.y;
highp vec2 _150 = (_192.xy * 0.5) + vec2(0.5); highp vec3 _155 = (_193.xyz * 0.5) + vec3(0.5);
highp vec4 _196; highp vec4 _199;
_196.x = _150.x; _199.x = _155.x;
_196.y = _150.y; _199.y = _155.y;
highp vec4 _161 = texture(g_position_ssao_smp, _196.xy); occlusion += float(texture(g_position_ssao_smp, _199.xy).z >= _121.z);
highp float _163 = _161.z;
occlusion += (float(_163 >= _119.z) * smoothstep(0.0, 1.0, 1.0 - (_25.z - _163)));
} }
highp float _182 = occlusion; highp float _179 = occlusion;
highp float _185 = 1.0 - (_182 * 0.015625); highp float _182 = 1.0 - (_179 * 0.015625);
occlusion = _185; occlusion = _182;
out_color = vec4(_185, _185, _185, 1.0); out_color = vec4(_182, _182, _182, 1.0);
} }
*/ */
@ -298,7 +286,7 @@ fs_ssao_source_glsl300es := u8.[
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x76, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x76,
0x65,0x63,0x34,0x20,0x5f,0x32,0x30,0x34,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f, 0x65,0x63,0x34,0x20,0x5f,0x32,0x30,0x38,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,
0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x73, 0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x73,0x73,
0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x38,0x5d, 0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x38,0x5d,
0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20, 0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,
@ -315,84 +303,78 @@ fs_ssao_source_glsl300es := u8.[
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63, 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
0x34,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f, 0x34,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x32,0x35,0x20,0x3d, 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74, 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75, 0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,
0x61,0x64,0x5f,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68, 0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,0x20,0x5f,0x32,0x35, 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x35,0x20,0x3d,
0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20, 0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,0x78,0x74,0x75,
0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x35,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61, 0x72,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x73,0x73,0x61,0x6f,
0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x6e, 0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,
0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20, 0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20, 0x65,0x63,0x33,0x20,0x5f,0x35,0x31,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x35, 0x69,0x7a,0x65,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,
0x31,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x65, 0x6e,0x6f,0x69,0x73,0x65,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,
0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,0x73,0x65,0x5f, 0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x34,
0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x71,0x75,0x61,0x64,0x5f,0x75, 0x38,0x30,0x2e,0x30,0x2c,0x20,0x32,0x37,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,
0x76,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x33,0x32,0x30,0x2e,0x30,0x2c,0x20, 0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
0x31,0x38,0x30,0x2e,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20, 0x63,0x33,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x36,0x30, 0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20,0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,
0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x31, 0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20,0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,
0x20,0x2d,0x20,0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,0x64,0x6f,0x74,0x28,0x5f,0x35, 0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x6d,0x61,0x74,0x33,0x20,
0x31,0x2c,0x20,0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68, 0x5f,0x38,0x35,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x5f,0x36,0x30,0x2c,0x20,
0x69,0x67,0x68,0x70,0x20,0x6d,0x61,0x74,0x33,0x20,0x5f,0x38,0x35,0x20,0x3d,0x20, 0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,0x2c,
0x6d,0x61,0x74,0x33,0x28,0x5f,0x36,0x30,0x2c,0x20,0x63,0x72,0x6f,0x73,0x73,0x28, 0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,
0x5f,0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b, 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,
0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74, 0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,
0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x2e,0x30, 0x28,0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69, 0x36,0x34,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,
0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x36,0x34,0x3b,0x20,0x69,0x2b, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x33,0x20,0x5f,0x31,0x32,0x31,0x20,0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,
0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x31,0x39, 0x28,0x5f,0x38,0x35,0x20,0x2a,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,
0x20,0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,0x5f,0x38,0x35,0x20,0x2a,0x20, 0x61,0x72,0x61,0x6d,0x73,0x5b,0x69,0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x34,0x5d,
0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x69, 0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,
0x20,0x2a,0x20,0x31,0x20,0x2b,0x20,0x34,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a, 0x30,0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, 0x33,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,
0x63,0x34,0x20,0x5f,0x31,0x33,0x31,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x73, 0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x33,0x33,0x20,0x3d,
0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d, 0x20,0x6d,0x61,0x74,0x34,0x28,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,
0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, 0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,
0x5b,0x31,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72, 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,
0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x73,0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f, 0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x73,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63, 0x73,0x61,0x6f,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,
0x34,0x28,0x5f,0x31,0x31,0x39,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20, 0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x32,0x31,0x2c,0x20,0x31,
0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32, 0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,
0x20,0x5f,0x31,0x33,0x38,0x20,0x3d,0x20,0x5f,0x31,0x33,0x31,0x2e,0x78,0x79,0x20, 0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x34,0x30,0x20,0x3d,0x20,0x5f,
0x2f,0x20,0x76,0x65,0x63,0x32,0x28,0x5f,0x31,0x33,0x31,0x2e,0x77,0x29,0x3b,0x0a, 0x31,0x33,0x33,0x2e,0x78,0x79,0x7a,0x20,0x2f,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, 0x31,0x33,0x33,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x63,0x34,0x20,0x5f,0x31,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x39,0x33,0x3b,
0x20,0x5f,0x31,0x39,0x32,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x33,0x38,0x2e,0x78, 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x33,0x2e,0x78,0x20,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x32,0x2e,0x79, 0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x3d,0x20,0x5f,0x31,0x33,0x38,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x5f,0x31,0x39,0x33,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,
0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x31, 0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,
0x35,0x30,0x20,0x3d,0x20,0x28,0x5f,0x31,0x39,0x32,0x2e,0x78,0x79,0x20,0x2a,0x20, 0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x31,0x35,0x35,0x20,0x3d,0x20,0x28,0x5f,0x31,
0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29, 0x39,0x33,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20, 0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x34,0x20,0x5f,0x31,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,
0x20,0x20,0x20,0x5f,0x31,0x39,0x36,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35,0x30, 0x39,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x39,
0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x36, 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,
0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x35,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x39,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,
0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20, 0x35,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x63,
0x5f,0x31,0x36,0x31,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67, 0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x2b,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73, 0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,
0x6d,0x70,0x2c,0x20,0x5f,0x31,0x39,0x36,0x2e,0x78,0x79,0x29,0x3b,0x0a,0x20,0x20, 0x69,0x6f,0x6e,0x5f,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x31,
0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61, 0x39,0x39,0x2e,0x78,0x79,0x29,0x2e,0x7a,0x20,0x3e,0x3d,0x20,0x5f,0x31,0x32,0x31,
0x74,0x20,0x5f,0x31,0x36,0x33,0x20,0x3d,0x20,0x5f,0x31,0x36,0x31,0x2e,0x7a,0x3b, 0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x68,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69, 0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x37,0x39,0x20,
0x6f,0x6e,0x20,0x2b,0x3d,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31,0x36, 0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,
0x33,0x20,0x3e,0x3d,0x20,0x5f,0x31,0x31,0x39,0x2e,0x7a,0x29,0x20,0x2a,0x20,0x73, 0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,
0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31, 0x32,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x37,0x39,0x20,
0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x32,0x35,0x2e,0x7a, 0x2a,0x20,0x30,0x2e,0x30,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x2d,0x20,0x5f,0x31,0x36,0x33,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x38,
0x7d,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c,0x6f,0x61, 0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
0x74,0x20,0x5f,0x31,0x38,0x32,0x20,0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69, 0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,0x31,
0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x66,0x6c, 0x38,0x32,0x2c,0x20,0x5f,0x31,0x38,0x32,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x35,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d, 0x7d,0x0a,0x0a,0x00,
0x20,0x28,0x5f,0x31,0x38,0x32,0x20,0x2a,0x20,0x30,0x2e,0x30,0x31,0x35,0x36,0x32,
0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x5f,0x31,0x38,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,
0x31,0x38,0x35,0x2c,0x20,0x5f,0x31,0x38,0x35,0x2c,0x20,0x5f,0x31,0x38,0x35,0x2c,
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
]; ];
/* /*
#include <metal_stdlib> #include <metal_stdlib>
@ -463,7 +445,7 @@ vs_ssao_source_metal_macos := u8.[
float4 samples[64]; float4 samples[64];
}; };
constant float4 _204 = {}; constant float4 _208 = {};
struct main0_out struct main0_out
{ {
@ -478,33 +460,30 @@ vs_ssao_source_metal_macos := u8.[
fragment main0_out main0(main0_in in [[stage_in]], constant ssao_fs_params& _109 [[buffer(0)]], texture2d<float> g_position [[texture(0)]], texture2d<float> g_normal [[texture(1)]], texture2d<float> tex_noise [[texture(2)]], sampler ssao_smp [[sampler(0)]]) fragment main0_out main0(main0_in in [[stage_in]], constant ssao_fs_params& _109 [[buffer(0)]], texture2d<float> g_position [[texture(0)]], texture2d<float> g_normal [[texture(1)]], texture2d<float> tex_noise [[texture(2)]], sampler ssao_smp [[sampler(0)]])
{ {
main0_out out = {}; main0_out out = {};
float4 _25 = g_position.sample(ssao_smp, in.quad_uv); float3 _26 = g_position.sample(ssao_smp, in.quad_uv).xyz;
float3 _26 = _25.xyz;
float3 _35 = fast::normalize(g_normal.sample(ssao_smp, in.quad_uv).xyz); float3 _35 = fast::normalize(g_normal.sample(ssao_smp, in.quad_uv).xyz);
float3 _51 = fast::normalize(tex_noise.sample(ssao_smp, (in.quad_uv * float2(320.0, 180.0))).xyz); float3 _51 = fast::normalize(tex_noise.sample(ssao_smp, (in.quad_uv * float2(480.0, 270.0))).xyz);
float3 _60 = fast::normalize(_51 - (_35 * dot(_51, _35))); float3 _60 = fast::normalize(_51 - (_35 * dot(_51, _35)));
float3x3 _85 = float3x3(_60, cross(_35, _60), _35); float3x3 _85 = float3x3(_60, cross(_35, _60), _35);
float occlusion = 0.0; float occlusion = 0.0;
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
float3 _119 = _26 + (_85 * _109.samples[i].xyz); float3 _121 = _26 + ((_85 * _109.samples[i].xyz) * 0.20000000298023223876953125);
float4 _131 = _109.projection * float4(_119, 1.0); float4 _133 = _109.projection * float4(_121, 1.0);
float2 _138 = _131.xy / float2(_131.w); float3 _140 = _133.xyz / float3(_133.w);
float4 _192; float4 _193;
_192.x = _138.x; _193.x = _140.x;
_192.y = _138.y; _193.y = _140.y;
float2 _150 = (_192.xy * 0.5) + float2(0.5); float3 _155 = (_193.xyz * 0.5) + float3(0.5);
float4 _196; float4 _199;
_196.x = _150.x; _199.x = _155.x;
_196.y = _150.y; _199.y = _155.y;
float4 _161 = g_position.sample(ssao_smp, _196.xy); occlusion += float(g_position.sample(ssao_smp, _199.xy).z >= _121.z);
float _163 = _161.z;
occlusion += (float(_163 >= _119.z) * smoothstep(0.0, 1.0, 1.0 - (_25.z - _163)));
} }
float _182 = occlusion; float _179 = occlusion;
float _185 = 1.0 - (_182 * 0.015625); float _182 = 1.0 - (_179 * 0.015625);
occlusion = _185; occlusion = _182;
out.out_color = float4(_185, _185, _185, 1.0); out.out_color = float4(_182, _182, _182, 1.0);
return out; return out;
} }
@ -520,7 +499,7 @@ fs_ssao_source_metal_macos := u8.[
0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x73,0x5b,0x36,0x34,0x5d,0x3b, 0x61,0x74,0x34,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x73,0x5b,0x36,0x34,0x5d,0x3b,
0x0a,0x7d,0x3b,0x0a,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x66,0x6c, 0x0a,0x7d,0x3b,0x0a,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,0x30,0x34,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a, 0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,0x30,0x38,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,
0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6f, 0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6f,
0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72, 0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,
@ -546,79 +525,73 @@ fs_ssao_source_metal_macos := u8.[
0x61,0x6f,0x5f,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, 0x61,0x6f,0x5f,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, 0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,
0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x32,0x35,0x20, 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x36,0x20,
0x3d,0x20,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x73,0x61,0x6d, 0x3d,0x20,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x73,0x61,0x6d,
0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e, 0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,
0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, 0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,
0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x36,0x20,0x3d,0x20,0x5f,0x32,0x35,0x2e, 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x33,0x35,0x20,0x3d,0x20,
0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20, 0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x5f,0x33,0x35,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d, 0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,
0x61,0x6c,0x69,0x7a,0x65,0x28,0x67,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x73, 0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x71,0x75,0x61,
0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20, 0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x69,0x6e,0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x29,0x2e,0x78,0x79,0x7a,0x29, 0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x35,0x31,0x20,0x3d,0x20,0x66,0x61,0x73,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x35,0x31, 0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x65,0x78,
0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69, 0x5f,0x6e,0x6f,0x69,0x73,0x65,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x73,
0x7a,0x65,0x28,0x74,0x65,0x78,0x5f,0x6e,0x6f,0x69,0x73,0x65,0x2e,0x73,0x61,0x6d, 0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x28,0x69,0x6e,0x2e,0x71,0x75,0x61,0x64,
0x70,0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x28,0x69, 0x5f,0x75,0x76,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x34,0x38,0x30,
0x6e,0x2e,0x71,0x75,0x61,0x64,0x5f,0x75,0x76,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61, 0x2e,0x30,0x2c,0x20,0x32,0x37,0x30,0x2e,0x30,0x29,0x29,0x29,0x2e,0x78,0x79,0x7a,
0x74,0x32,0x28,0x33,0x32,0x30,0x2e,0x30,0x2c,0x20,0x31,0x38,0x30,0x2e,0x30,0x29, 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x36,
0x29,0x29,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 0x30,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x61,0x74,0x33,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a, 0x69,0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20,0x28,0x5f,0x33,0x35,0x20,0x2a,
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x31,0x20,0x2d,0x20, 0x20,0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20,0x5f,0x33,0x35,0x29,0x29,0x29,
0x28,0x5f,0x33,0x35,0x20,0x2a,0x20,0x64,0x6f,0x74,0x28,0x5f,0x35,0x31,0x2c,0x20, 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x20,0x5f,
0x5f,0x33,0x35,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, 0x38,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x28,0x5f,0x36,
0x74,0x33,0x78,0x33,0x20,0x5f,0x38,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, 0x30,0x2c,0x20,0x63,0x72,0x6f,0x73,0x73,0x28,0x5f,0x33,0x35,0x2c,0x20,0x5f,0x36,
0x33,0x78,0x33,0x28,0x5f,0x36,0x30,0x2c,0x20,0x63,0x72,0x6f,0x73,0x73,0x28,0x5f, 0x30,0x29,0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x33,0x35,0x2c,0x20,0x5f,0x36,0x30,0x29,0x2c,0x20,0x5f,0x33,0x35,0x29,0x3b,0x0a, 0x6f,0x61,0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73, 0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x28,0x69,0x6e,
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, 0x74,0x20,0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69,0x20,0x3c,0x20,0x36,0x34,0x3b,
0x6f,0x72,0x20,0x28,0x69,0x6e,0x74,0x20,0x69,0x20,0x3d,0x20,0x30,0x3b,0x20,0x69, 0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x3c,0x20,0x36,0x34,0x3b,0x20,0x69,0x2b,0x2b,0x29,0x0a,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x32,0x31,0x20,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, 0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,0x28,0x5f,0x38,0x35,0x20,0x2a,0x20,
0x20,0x5f,0x31,0x31,0x39,0x20,0x3d,0x20,0x5f,0x32,0x36,0x20,0x2b,0x20,0x28,0x5f, 0x5f,0x31,0x30,0x39,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x73,0x5b,0x69,0x5d,0x2e,
0x38,0x35,0x20,0x2a,0x20,0x5f,0x31,0x30,0x39,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65, 0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x30,0x2e,0x32,0x30,0x30,0x30,0x30,0x30,0x30,
0x73,0x5b,0x69,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, 0x30,0x32,0x39,0x38,0x30,0x32,0x33,0x32,0x32,0x33,0x38,0x37,0x36,0x39,0x35,0x33,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x33,0x31,0x20,0x3d, 0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,
0x20,0x5f,0x31,0x30,0x39,0x2e,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e, 0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x33,0x33,0x20,0x3d,0x20,0x5f,0x31,0x30,0x39,
0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x31,0x31,0x39,0x2c,0x20, 0x2e,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20,0x66,0x6c,
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c, 0x6f,0x61,0x74,0x34,0x28,0x5f,0x31,0x32,0x31,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
0x6f,0x61,0x74,0x32,0x20,0x5f,0x31,0x33,0x38,0x20,0x3d,0x20,0x5f,0x31,0x33,0x31, 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,
0x2e,0x78,0x79,0x20,0x2f,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x31,0x33, 0x5f,0x31,0x34,0x30,0x20,0x3d,0x20,0x5f,0x31,0x33,0x33,0x2e,0x78,0x79,0x7a,0x20,
0x31,0x2e,0x77,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c, 0x2f,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x31,0x33,0x33,0x2e,0x77,0x29,
0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x5f,0x31,0x39,0x32,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x33,0x38,
0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x32,
0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,0x33,0x38,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x5f,0x31,0x35,0x30,
0x20,0x3d,0x20,0x28,0x5f,0x31,0x39,0x32,0x2e,0x78,0x79,0x20,0x2a,0x20,0x30,0x2e,
0x35,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x35,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
0x20,0x5f,0x31,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f, 0x20,0x5f,0x31,0x39,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,
0x31,0x39,0x36,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35,0x30,0x2e,0x78,0x3b,0x0a, 0x31,0x39,0x33,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x34,0x30,0x2e,0x78,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x36,0x2e,0x79,0x20,0x3d, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x33,0x2e,0x79,0x20,0x3d,
0x20,0x5f,0x31,0x35,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0x5f,0x31,0x34,0x30,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x36,0x31,0x20,0x3d,0x20,0x67, 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x31,0x35,0x35,0x20,0x3d,0x20,0x28,
0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65, 0x5f,0x31,0x39,0x33,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,
0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x31,0x39,0x36,0x2e, 0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,
0x78,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,
0x61,0x74,0x20,0x5f,0x31,0x36,0x33,0x20,0x3d,0x20,0x5f,0x31,0x36,0x31,0x2e,0x7a, 0x39,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x39,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73, 0x2e,0x78,0x20,0x3d,0x20,0x5f,0x31,0x35,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,
0x69,0x6f,0x6e,0x20,0x2b,0x3d,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x31, 0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x39,0x39,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x31,
0x36,0x33,0x20,0x3e,0x3d,0x20,0x5f,0x31,0x31,0x39,0x2e,0x7a,0x29,0x20,0x2a,0x20, 0x35,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x63,
0x73,0x6d,0x6f,0x6f,0x74,0x68,0x73,0x74,0x65,0x70,0x28,0x30,0x2e,0x30,0x2c,0x20, 0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x2b,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x32,0x35,0x2e, 0x28,0x67,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x73,0x61,0x6d,0x70,
0x7a,0x20,0x2d,0x20,0x5f,0x31,0x36,0x33,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20, 0x6c,0x65,0x28,0x73,0x73,0x61,0x6f,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x5f,0x31,0x39,
0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38, 0x39,0x2e,0x78,0x79,0x29,0x2e,0x7a,0x20,0x3e,0x3d,0x20,0x5f,0x31,0x32,0x31,0x2e,
0x32,0x20,0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20, 0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x38,0x35,0x20,0x3d,0x20, 0x6f,0x61,0x74,0x20,0x5f,0x31,0x37,0x39,0x20,0x3d,0x20,0x6f,0x63,0x63,0x6c,0x75,
0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,0x38,0x32,0x20,0x2a,0x20,0x30,0x2e, 0x73,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
0x30,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x63,0x63, 0x5f,0x31,0x38,0x32,0x20,0x3d,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x28,0x5f,0x31,
0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x38,0x35,0x3b,0x0a,0x20, 0x37,0x39,0x20,0x2a,0x20,0x30,0x2e,0x30,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 0x20,0x20,0x20,0x20,0x6f,0x63,0x63,0x6c,0x75,0x73,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x31,0x38,0x35,0x2c,0x20, 0x5f,0x31,0x38,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x6f,0x75,
0x5f,0x31,0x38,0x35,0x2c,0x20,0x5f,0x31,0x38,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29, 0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74, 0x28,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,0x31,0x38,0x32,0x2c,0x20,0x5f,0x31,0x38,
0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 0x32,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,
0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
]; ];
ssao_shader_desc :: (backend: sg_backend) -> sg_shader_desc { ssao_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc: sg_shader_desc; desc: sg_shader_desc;

View File

@ -29,7 +29,7 @@ out vec4 out_color;
void main() { void main() {
vec3 frag_pos = texture(sampler2D(g_position, ssao_smp), quad_uv).xyz; vec3 frag_pos = texture(sampler2D(g_position, ssao_smp), quad_uv).xyz;
vec3 normal = normalize(texture(sampler2D(g_normal, ssao_smp), quad_uv).rgb); vec3 normal = normalize(texture(sampler2D(g_normal, ssao_smp), quad_uv).rgb);
vec2 noise_scale = vec2(1280.0/4.0, 720.0/4.0); // @Incomplete: get screen size vec2 noise_scale = vec2(1920.0/4.0, 1080.0/4.0); // @Incomplete: get screen size
vec3 random_vec = normalize(texture(sampler2D(tex_noise, ssao_smp), quad_uv * noise_scale).xyz); vec3 random_vec = normalize(texture(sampler2D(tex_noise, ssao_smp), quad_uv * noise_scale).xyz);
vec3 tangent = normalize(random_vec - normal * dot(random_vec, normal)); vec3 tangent = normalize(random_vec - normal * dot(random_vec, normal));
@ -37,22 +37,20 @@ void main() {
mat3 tbn = mat3(tangent, bitangent, normal); mat3 tbn = mat3(tangent, bitangent, normal);
float occlusion = 0.0; float occlusion = 0.0;
for (int i = 0; i < 64; ++i) { for(int i = 0; i < 64; i++) {
vec3 sample_pos = tbn * samples[i].xyz; vec3 sample_pos = tbn * samples[i].xyz;
sample_pos = frag_pos + sample_pos; sample_pos = frag_pos + sample_pos * 0.2;
vec4 offset = vec4(sample_pos, 1.0); vec4 offset = vec4(sample_pos, 1.0);
offset = projection * offset; offset = projection * offset;
offset.xy /= offset.w; offset.xyz /= offset.w;
offset.xy = offset.xy * 0.5 + 0.5; offset.xyz = offset.xyz * 0.5 + 0.5;
float sample_depth = texture(sampler2D(g_position, ssao_smp), offset.xy).z; float sample_depth = texture(sampler2D(g_position, ssao_smp), offset.xy).z;
float range_check = smoothstep(0.0, 1.0, 1.0 - (frag_pos.z - sample_depth)); occlusion += (sample_depth >= sample_pos.z ? 1.0 : 0.0);
occlusion += (sample_depth >= sample_pos.z ? 1.0 : 0.0) * range_check;
} }
occlusion = 1.0 - (occlusion / 64.0); occlusion = 1.0 - (occlusion / 64.0);
out_color = vec4(occlusion, occlusion, occlusion, 1.0); out_color = vec4(vec3(occlusion), 1.0);
} }
@end @end