vec3 ssr_block(vec3 RVec, float Dist, vec3 ViewPos, float Fresnel, float WNy, bool IsDH, sampler2D lightmap, vec2 lmcoord) {
    
    // 1. Setup the Ray in 3D View Space
    vec3 rayDir = normalize(RVec);
    
    // Step size in View Space (meters/blocks). 
    // Increase for better performance, decrease for higher quality.
    float stepSize = 0.5; 
    vec3 stepVector = rayDir * stepSize;
    
    // Add dither to hide banding/stepping artifacts
    float noise = dither(gl_FragCoord.xy);
    vec3 currentViewPos = ViewPos + (stepVector * noise);
    
    // 2. March forward in 3D Space
    for (int i = 0; i < SSR_STEPS; i++) {
        
        // Move the ray in the physical 3D world
        currentViewPos += stepVector;
        
        // Project the 3D point onto the 2D monitor screen
        vec3 screenPos = view_screen(currentViewPos, IsDH);
        
        // Abort if the ray goes off the edge of the monitor
        if (screenPos.x < 0.0 || screenPos.x > 1.0 || 
            screenPos.y < 0.0 || screenPos.y > 1.0) {
            break;
        }
        
        // Read the actual depth of the scene geometry at this pixel
        float realDepth = get_depth_solid(screenPos.xy, IsDH);
        
        // Sky threshold (stop marching if we hit the sky)
        if (realDepth < 0.56) {
            break; 
        }
        
        // 3. Intersection Check
        // screenPos.z is the depth of our ray. realDepth is the geometry.
        if (screenPos.z > realDepth) {
            
            // Thickness check to prevent hitting the back of foreground objects.
            // (0.005 is a standard screen-depth tolerance)
            if (screenPos.z - realDepth < 0.005) {
                
                // --- Binary Search Refinement ---
                // We hit something! Now backtrack in smaller steps to find the exact surface
                vec3 refinePos = currentViewPos;
                vec3 refineStep = stepVector;
                
                for (int j = 0; j < 4; j++) {
                    refineStep *= 0.5;
                    vec3 testPos = refinePos - refineStep;
                    
                    vec3 testScreen = view_screen(testPos, IsDH);
                    float testDepth = get_depth_solid(testScreen.xy, IsDH);
                    
                    if (testScreen.z > testDepth) {
                        refinePos = testPos; // Still inside geometry, pull back
                    }
                }
                
                // Sample the final color!
                vec3 hitScreenPos = view_screen(refinePos, IsDH);
                vec3 rawSSR = texture2D(colortex0, hitScreenPos.xy).rgb;
                return max(rawSSR, vec3(0.0));
            }
        }
    }
    
    return sky_reflection(RVec, WNy, Dist,ViewPos,lightmap,lmcoord) * isOutdoorsSmooth * (1.0 + wetness * 3.0 * (1.0 - rainStrength));
}