Blender V5.0
mis.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2010 Sony Pictures Imageworks Inc., et al. All Rights Reserved.
2 * SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Adapted code from Open Shading Language. */
7
8#pragma once
9
10#include "util/defines.h"
11
13
14/* Multiple importance sampling utilities. */
15
16ccl_device float balance_heuristic(const float a, const float b)
17{
18 return (a) / (a + b);
19}
20
21ccl_device float balance_heuristic_3(const float a, const float b, float c)
22{
23 return (a) / (a + b + c);
24}
25
26ccl_device float power_heuristic(const float a, const float b)
27{
28 return (a * a) / (a * a + b * b);
29}
30
31ccl_device float power_heuristic_3(const float a, const float b, float c)
32{
33 return (a * a) / (a * a + b * b + c * c);
34}
35
36ccl_device float max_heuristic(const float a, const float b)
37{
38 return (a > b) ? 1.0f : 0.0f;
39}
40
#define CCL_NAMESPACE_END
CCL_NAMESPACE_BEGIN ccl_device float balance_heuristic(const float a, const float b)
Definition mis.h:16
ccl_device float power_heuristic(const float a, const float b)
Definition mis.h:26
ccl_device float power_heuristic_3(const float a, const float b, float c)
Definition mis.h:31
ccl_device float balance_heuristic_3(const float a, const float b, float c)
Definition mis.h:21
ccl_device float max_heuristic(const float a, const float b)
Definition mis.h:36
#define ccl_device