Photon Engine
2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TMIS.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Core/LTA/enums.h
"
4
5
#include <Common/assertion.h>
6
#include <Common/primitive_type.h>
7
8
#include <string>
9
10
namespace
ph::lta
11
{
12
16
template
<EMISStyle STYLE>
17
class
TMIS
final
18
{
19
public
:
20
real
weight
(
const
real pdf0,
const
real pdf1)
const
21
{
22
PH_ASSERT_MSG(pdf0 >= 0.0_r && pdf1 >= 0.0_r && pdf0 + pdf1 != 0.0_r,
23
"pdf0 = "
+ std::to_string(pdf0) +
", "
24
"pdf1 = "
+ std::to_string(pdf1));
25
26
if
constexpr
(STYLE ==
EMISStyle::Balance
)
27
{
28
return
pdf0 / (pdf0 + pdf1);
29
}
30
31
// Power heuristic with beta = 2
32
if
constexpr
(STYLE ==
EMISStyle::Power
)
33
{
34
return
(pdf0 * pdf0) / (pdf0 * pdf0 + pdf1 * pdf1);
35
}
36
37
PH_ASSERT_UNREACHABLE_SECTION();
38
return
0.0_r;
39
}
40
};
41
42
}
// end namespace ph::lta
enums.h
ph::lta::TMIS
Static helper for Multiple Importance Sampling (MIS). See the paper by Veach et al....
Definition
TMIS.h:18
ph::lta::TMIS::weight
real weight(const real pdf0, const real pdf1) const
Definition
TMIS.h:20
ph::lta
Light transport algorithms.
Definition
enums.h:6
ph::lta::EMISStyle::Balance
@ Balance
ph::lta::EMISStyle::Power
@ Power
Source
Core
LTA
TMIS.h
Generated by
1.11.0