aboutsummaryrefslogtreecommitdiffstats
path: root/src/runtimerender/res/effectlib/orderindependenttransparency.glsllib
blob: 5dd9a06a93b1fb13824282c0dfe5be70ede2efa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "../effectlib/oitcommon.glsllib"

#if QSSG_OIT_METHOD == QSSG_OIT_WEIGHTED_BLENDED

float qt_transparencyWeight(const float z, const float a, const float depthRange)
{
    const float colorResistance = 1.0;
    const float rangeAdjustment = 0.3;
    const float orderingRange = 4.0;
    return pow(a, colorResistance) * clamp(rangeAdjustment / (1e-5 + pow(z / depthRange, orderingRange)), 1e-2, 3e3);
}

#endif // QSSG_OIT_METHOD == QSSG_OIT_WEIGHTED_BLENDED