Blender V4.3
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
11
12/* Multiple importance sampling utilities. */
13
14ccl_device float balance_heuristic(float a, float b)
15{
16 return (a) / (a + b);
17}
18
19ccl_device float balance_heuristic_3(float a, float b, float c)
20{
21 return (a) / (a + b + c);
22}
23
24ccl_device float power_heuristic(float a, float b)
25{
26 return (a * a) / (a * a + b * b);
27}
28
29ccl_device float power_heuristic_3(float a, float b, float c)
30{
31 return (a * a) / (a * a + b * b + c * c);
32}
33
34ccl_device float max_heuristic(float a, float b)
35{
36 return (a > b) ? 1.0f : 0.0f;
37}
38
local_group_size(16, 16) .push_constant(Type b
#define ccl_device
#define CCL_NAMESPACE_END
ccl_device float power_heuristic_3(float a, float b, float c)
Definition mis.h:29
ccl_device float max_heuristic(float a, float b)
Definition mis.h:34
ccl_device float balance_heuristic_3(float a, float b, float c)
Definition mis.h:19
CCL_NAMESPACE_BEGIN ccl_device float balance_heuristic(float a, float b)
Definition mis.h:14
ccl_device float power_heuristic(float a, float b)
Definition mis.h:24