-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathopenpbr_resolved_inputs.h
More file actions
164 lines (139 loc) · 5.11 KB
/
openpbr_resolved_inputs.h
File metadata and controls
164 lines (139 loc) · 5.11 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/***************************************************************************
* Copyright 2026 Adobe
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
#ifndef OPENPBR_RESOLVED_INPUTS_H
#define OPENPBR_RESOLVED_INPUTS_H
#include "impl/openpbr_math.h"
#include "openpbr_basis.h"
// Fully-resolved, texture-free OpenPBR inputs matching the official
// OpenPBR parameter set with a few modifications (noted in comments).
// Subsystems may only fill/read the subset they need.
struct OpenPBR_ResolvedInputs
{
// Base layer
float base_weight;
vec3 base_color;
float base_diffuse_roughness;
float base_metalness;
// Subsurface
float subsurface_weight;
vec3 subsurface_color;
float subsurface_radius;
vec3 subsurface_radius_scale;
float subsurface_scatter_anisotropy;
// Specular
float specular_weight;
vec3 specular_color;
float specular_roughness;
float specular_roughness_anisotropy;
float specular_ior;
// Optional extension (Eclair): cosine and sine of the anisotropy rotation angle; set to (1, 0) if unused.
vec2 specular_anisotropy_rotation_cos_sin;
// Coat
float coat_weight;
vec3 coat_color;
float coat_roughness;
float coat_roughness_anisotropy;
float coat_ior;
float coat_darkening;
// Optional extension (Eclair): cosine and sine of the anisotropy rotation angle; set to (1, 0) if unused.
vec2 coat_anisotropy_rotation_cos_sin;
// Fuzz
float fuzz_weight;
vec3 fuzz_color;
float fuzz_roughness;
// Transmission / volume
float transmission_weight;
vec3 transmission_color;
float transmission_depth;
vec3 transmission_scatter;
float transmission_scatter_anisotropy;
float transmission_dispersion_scale;
float transmission_dispersion_abbe_number;
// Thin-film
float thin_film_weight;
float thin_film_thickness;
float thin_film_ior;
// Emission
float emission_luminance;
vec3 emission_color;
// Geometry
float geometry_opacity;
bool geometry_thin_walled;
// Precomputed geometry bases (must be provided). geometry_basis replaces
// geometry_normal/geometry_tangent, and geometry_coat_basis replaces
// geometry_coat_normal/geometry_coat_tangent. Caller must compute bitangents
// and handedness correctly.
OpenPBR_Basis geometry_basis;
OpenPBR_Basis geometry_coat_basis;
};
// Returns a fully initialized set of resolved inputs using the OpenPBR specification defaults.
OPENPBR_INLINE_FUNCTION OpenPBR_ResolvedInputs openpbr_make_default_resolved_inputs()
{
OpenPBR_ResolvedInputs inputs;
// Base layer
inputs.base_weight = 1.0f;
inputs.base_color = vec3(0.8f);
inputs.base_diffuse_roughness = 0.0f;
inputs.base_metalness = 0.0f;
// Subsurface
inputs.subsurface_weight = 0.0f;
inputs.subsurface_color = vec3(0.8f);
inputs.subsurface_radius = 1.0f;
inputs.subsurface_radius_scale = vec3(1.0f, 0.5f, 0.25f);
inputs.subsurface_scatter_anisotropy = 0.0f;
// Specular
inputs.specular_weight = 1.0f;
inputs.specular_color = vec3(1.0f);
inputs.specular_roughness = 0.3f;
inputs.specular_roughness_anisotropy = 0.0f;
inputs.specular_ior = 1.5f;
inputs.specular_anisotropy_rotation_cos_sin = vec2(1.0f, 0.0f);
// Coat
inputs.coat_weight = 0.0f;
inputs.coat_color = vec3(1.0f);
inputs.coat_roughness = 0.0f;
inputs.coat_roughness_anisotropy = 0.0f;
inputs.coat_ior = 1.6f;
inputs.coat_darkening = 1.0f;
inputs.coat_anisotropy_rotation_cos_sin = vec2(1.0f, 0.0f);
// Fuzz
inputs.fuzz_weight = 0.0f;
inputs.fuzz_color = vec3(1.0f);
inputs.fuzz_roughness = 0.5f;
// Transmission / volume
inputs.transmission_weight = 0.0f;
inputs.transmission_color = vec3(1.0f);
inputs.transmission_depth = 0.0f;
inputs.transmission_scatter = vec3(0.0f);
inputs.transmission_scatter_anisotropy = 0.0f;
inputs.transmission_dispersion_scale = 0.0f;
inputs.transmission_dispersion_abbe_number = 20.0f;
// Thin-film
inputs.thin_film_weight = 0.0f;
inputs.thin_film_thickness = 0.5f;
inputs.thin_film_ior = 1.4f;
// Emission
inputs.emission_luminance = 0.0f;
inputs.emission_color = vec3(1.0f);
// Geometry
inputs.geometry_opacity = 1.0f;
inputs.geometry_thin_walled = false;
// Bases
inputs.geometry_basis = OPENPBR_MAKE_STRUCT_3(OpenPBR_Basis, vec3(1.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f), vec3(0.0f, 0.0f, 1.0f));
inputs.geometry_coat_basis = inputs.geometry_basis;
return inputs;
}
#endif // OPENPBR_RESOLVED_INPUTS_H