-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbssrdf.h
More file actions
37 lines (32 loc) · 701 Bytes
/
bssrdf.h
File metadata and controls
37 lines (32 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "color.h"
struct Bssrdf
{
public:
// diffuse params
float specluar;
Color diffuse;
// translucent params
Color scatter;
Color absorb;
float eta;
float g;
// computed
Color sigt;
Color sigsp;
Color sigtp;
Color sigtr;
float zr;
float fdr;
float zv;
void UpdateParams()
{
sigt = scatter + absorb;
sigsp = (1 - g) * scatter;
sigtp = sigsp + absorb;
sigtr = (3 * absorb * sigtp).sqrt();
zr = 1.0f / sigtp.meanValue();
fdr = -1.440f / (eta * eta) + 0.710f / eta + 0.668f + 0.0636f * eta;
zv = zr * (1 + 4 / 3.0f * (1 + fdr) / (1 - fdr));
}
};