
/*
====================================================================================================

    Copyright (C) 2025 Pyvtron Shaders - Pyvtron

    All Rights Reserved unless otherwise explicitly stated.

====================================================================================================
*/


float underwaterDepth(vec3 fragmentPosition, vec3 userPosition) {
    vec3 vectorToUser = fragmentPosition - userPosition;
    float normalizedDotProduct = abs(dot(normalize(vectorToUser), normalize(normal.rgb)));
    float distanceFactor = length(vectorToUser) * normalizedDotProduct * 0.1;
    float depthEffect = 1.0 - clamp(distanceFactor, 0.0, 1.0);
    return depthEffect;
}