24 bsdf.sample_weight = 1.0f;
38 (ShaderClosure *)&bsdf,
60 bsdf.sample_weight = 1.0f;
74 (ShaderClosure *)&bsdf,
90 const float rough,
const float mu,
const float eta,
const float exponent,
const float3 rand)
94 bsdf.sample_weight = 1.0f;
117 (ShaderClosure *)&bsdf,
156 std::map<string, PrecomputeTerm> precompute_terms;
158 precompute_terms[
"ggx_E"] = {1 << 23,
162 [](
const float rough,
const float y,
float,
const float3 rand) {
167 precompute_terms[
"ggx_Eavg"] = {1 << 26,
171 [](
const float rough,
const float mu,
float,
const float3 rand) {
176 precompute_terms[
"ggx_glass_E"] = {
181 [](
const float rough,
const float y,
const float z,
const float3 rand) {
188 precompute_terms[
"ggx_glass_Eavg"] = {
193 [](
const float rough,
const float mu,
const float z,
const float3 rand) {
199 precompute_terms[
"ggx_glass_inv_E"] = {
204 [](
const float rough,
const float y,
const float z,
const float3 rand) {
211 precompute_terms[
"ggx_glass_inv_Eavg"] = {
216 [](
const float rough,
const float mu,
const float z,
const float3 rand) {
223 precompute_terms[
"ggx_gen_schlick_ior_s"] = {
228 [](
const float rough,
const float y,
const float z,
const float3 rand) {
236 precompute_terms[
"ggx_gen_schlick_s"] = {
241 [](
const float rough,
const float y,
const float z,
const float3 rand) {
243 const float exponent = 5.0f * ((1.0f -
z) /
z);
248 if (!precompute_terms.contains(name)) {
254 const int samples = term.
samples;
255 const int nz = term.
nz;
256 const int ny = term.
ny;
257 const int nx = term.
nx;
259 std::cout <<
"static const float table_" << name <<
"[" << nz * ny * nx <<
"] = {" << std::endl;
260 for (
int z = 0;
z < nz;
z++) {
262 parallel_for(0, nx * ny, [&](
int64_t i) {
263 const int y = i / nx;
264 const int x = i % nx;
270 const float rough = (nx == 1) ? 0.0f :
clamp(
float(
x) /
float(nx - 1), 1e-4f, 1.0f);
272 const float mu = (ny == 1) ? rand.
w :
clamp(
float(
y) /
float(ny - 1), 1e-2f, 1.0f);
273 const float ior = (nz == 1) ? 0.0f :
clamp(
float(
z) /
float(nz - 1), 1e-4f, 0.99f);
279 sum += (double)value;
281 data[
y * nx +
x] =
saturatef(
float(sum /
double(samples)));
285 for (
int y = 0;
y < ny;
y++) {
287 for (
int x = 0;
x < nx;
x++) {
288 std::cout << std::to_string(data[
y * nx +
x]);
293 else if (
y + 1 < ny ||
z + 1 < nz) {
302 std::cout << std::endl;
305 if (ny > 1 &&
z + 1 < nz) {
306 std::cout << std::endl;
309 std::cout <<
"};" << std::endl;
316int main(
const int argc,
const char **argv)
321 return ccl::cycles_precompute(argv[1]) ? 0 : 1;
ccl_device int bsdf_microfacet_ggx_glass_setup(ccl_private MicrofacetBsdf *bsdf)
ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness, ccl_private float *eta)
ccl_device int bsdf_microfacet_ggx_setup(ccl_private MicrofacetBsdf *bsdf)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
#define GGX_GLASS_E_RES_MU
#define GGX_GEN_SCHLICK_IOR_S_RES_IOR
#define GGX_GEN_SCHLICK_IOR_S_RES_MU
#define GGX_GEN_SCHLICK_S_RES_MU
#define GGX_GLASS_E_RES_ROUGH
#define GGX_GEN_SCHLICK_S_RES_ROUGH
#define GGX_GLASS_E_RES_IOR
#define GGX_GEN_SCHLICK_IOR_S_RES_ROUGH
#define GGX_GEN_SCHLICK_S_RES_IOR
static float precompute_ggx_glass_E(const float rough, const float mu, const float eta, const float3 rand)
float ior_parametrization(const float z)
static CCL_NAMESPACE_BEGIN float precompute_ggx_E(const float rough, const float mu, const float3 rand)
static bool cycles_precompute(std::string name)
float mu_parametrization(const float y)
static float precompute_ggx_gen_schlick_s(const float rough, const float mu, const float eta, const float exponent, const float3 rand)
#define CCL_NAMESPACE_END
uint hash_uint2(uint kx, uint ky)
constexpr T clamp(T, U, U) RET
float ior_from_F0(const float F0)
ccl_device_inline float3 one_float3()
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ccl_device float4 sobol_burley_sample_4D(uint index, const uint dimension_set, uint seed, const uint shuffled_index_mask)
ccl_private void * fresnel
std::function< float(float, float, float, float3)> evaluation