Skip to content

Commit

Permalink
add texture and depth depth bias
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtarsia committed Oct 25, 2024
1 parent 11b1ca5 commit 7c8ca63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/shaders/main.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ uniform uint _mouse_layer = 0x80000000u; // Layer 32
// Public uniforms
uniform bool enable_projection = true;
uniform float projection_threshold : hint_range(0.0, 1.0, 0.01) = 0.5;
uniform float texture_lod_bias : hint_range(0.5, 1.5, 0.01) = 1.0;
uniform float texture_depth_blur : hint_range(1.0, 8.0, 0.1) = 1.0;
uniform bool height_blending = true;
uniform float blend_sharpness : hint_range(0, 1) = 0.87;
//INSERT: AUTO_SHADER_UNIFORMS
Expand Down Expand Up @@ -315,6 +317,9 @@ void fragment() {
// skip all extra lookups required for bilinear blend.
float maptexel_fragment_ratio = length(base_derivatives);
bool bilerp = maptexel_fragment_ratio <= 2.0;

// Adjust derivatives for mipmap bias and depth blur effect
base_derivatives *= mix(texture_lod_bias, texture_depth_blur, smoothstep(0.0,1.0,(v_vertex_xz_dist-512.0)*0.00048828125));

ivec3 indexUV[4];
// control map lookups, used for some normal lookups as well
Expand Down

0 comments on commit 7c8ca63

Please sign in to comment.