Skip to content

Commit

Permalink
Increase ssao ray steps
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Feb 12, 2025
1 parent 2d15685 commit a94c612
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions base/shaders/ssao_pass.frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ in vec3 view_ray;
in vec2 tex_coord;
out float frag_color;

const int max_steps = 8;
const float ray_step = 0.01;
const float angle_mix = 0.5;
const float strength = 3.6;
const int max_steps = 32;
const float ray_step = 0.001;

vec3 hit_coord;
vec2 coord;
Expand All @@ -43,7 +41,7 @@ float get_delta_depth(vec3 hit_coord) {

void ray_cast(vec3 dir) {
hit_coord = vpos;
dir *= ray_step * 2;
dir *= ray_step;
float dist = 0.15;
for (int i = 0; i < max_steps; i++) {
hit_coord += dir;
Expand Down Expand Up @@ -81,8 +79,8 @@ void main() {
vec3 o2 = (cross(o1, n));
vec3 c1 = 0.5f * (o1 + o2);
vec3 c2 = 0.5f * (o1 - o2);
ray_cast(mix(n, o1, angle_mix));
ray_cast(mix(n, o2, angle_mix));
ray_cast(mix(n, -c1, angle_mix));
ray_cast(mix(n, -c2, angle_mix));
ray_cast(mix(n, o1, 0.5));
ray_cast(mix(n, o2, 0.5));
ray_cast(mix(n, -c1, 0.5));
ray_cast(mix(n, -c2, 0.5));
}
2 changes: 1 addition & 1 deletion base/sources/uniforms_ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function uniforms_ext_vec4_link(object: object_t, mat: material_data_t, link: st
return v;
}
else if (link == "_envmap_data") {
return vec4_create(context_raw.envmap_angle, math_sin(-context_raw.envmap_angle), math_cos(-context_raw.envmap_angle), scene_world.strength);
return vec4_create(context_raw.envmap_angle, math_sin(-context_raw.envmap_angle), math_cos(-context_raw.envmap_angle), scene_world.strength * 1.5);
}
else if (link == "_envmap_data_world") {
return vec4_create(context_raw.envmap_angle, math_sin(-context_raw.envmap_angle), math_cos(-context_raw.envmap_angle), context_raw.show_envmap ? scene_world.strength : 1.0);
Expand Down

0 comments on commit a94c612

Please sign in to comment.