Skip to content

Commit

Permalink
extra branch condition for dual scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtarsia committed Oct 28, 2024
1 parent 0863b44 commit de6898f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shaders/dual_scaling.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ uniform float dual_scale_near : hint_range(0,1000) = 100.0;
normal_rg.xz = unpack_normal(normal_rg).xz;
normal_rg.xz = rotate_normal(normal_rg.xz, -normal_angle);

if(out_mat.base == dual_scale_texture || out_mat.over == dual_scale_texture) {
float far_factor = clamp(smoothstep(dual_scale_near, dual_scale_far, length(v_vertex - v_camera_pos)), 0.0, 1.0);
if (far_factor > 0.f && (out_mat.base == dual_scale_texture || out_mat.over == dual_scale_texture)) {
mat_scale *= dual_scale_reduction;
dd1 *= dual_scale_reduction;
float dual_scale_normal = uv_rotation; //do not add near & far rotations
Expand All @@ -38,7 +39,6 @@ uniform float dual_scale_near : hint_range(0,1000) = 100.0;
normal_far.xz = rotate_normal(normal_far.xz, -dual_scale_normal);
}

float far_factor = clamp(smoothstep(dual_scale_near, dual_scale_far, length(v_vertex - v_camera_pos)), 0.0, 1.0);
if(out_mat.base == dual_scale_texture) {
albedo_ht = mix(albedo_ht, albedo_far, far_factor);
normal_rg = mix(normal_rg, normal_far, far_factor);
Expand Down

0 comments on commit de6898f

Please sign in to comment.