playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
15 lines (14 loc) • 462 B
JavaScript
var fogMath_default = `
fn evaluateFogFactorLinear(depth: f32, fogStart: f32, fogEnd: f32) -> f32 {
return clamp((fogEnd - depth) / (fogEnd - fogStart), 0.0, 1.0);
}
fn evaluateFogFactorExp(depth: f32, fogDensity: f32) -> f32 {
return clamp(exp(-depth * fogDensity), 0.0, 1.0);
}
fn evaluateFogFactorExp2(depth: f32, fogDensity: f32) -> f32 {
return clamp(exp(-depth * depth * fogDensity * fogDensity), 0.0, 1.0);
}
`;
export {
fogMath_default as default
};