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;
118 (ShaderClosure *)&bsdf,
150 std::map<string, PrecomputeTerm> precompute_terms;
152 precompute_terms[
"ggx_E"] = {
153 1 << 23, 32, 32, 1, [](
const float rough,
const float mu,
float,
const float3 rand) {
157 precompute_terms[
"ggx_Eavg"] = {
158 1 << 26, 32, 1, 1, [](
const float rough,
const float mu,
float,
const float3 rand) {
163 precompute_terms[
"ggx_glass_E"] = {
168 [](
const float rough,
const float mu,
const float z,
const float3 rand) {
174 precompute_terms[
"ggx_glass_Eavg"] = {
175 1 << 26, 16, 1, 16, [](
const float rough,
const float mu,
const float z,
const float3 rand) {
181 precompute_terms[
"ggx_glass_inv_E"] = {
186 [](
const float rough,
const float mu,
const float z,
const float3 rand) {
192 precompute_terms[
"ggx_glass_inv_Eavg"] = {
193 1 << 26, 16, 1, 16, [](
const float rough,
const float mu,
const float z,
const float3 rand) {
200 precompute_terms[
"ggx_gen_schlick_ior_s"] = {
205 [](
const float rough,
const float mu,
const float z,
const float3 rand) {
212 precompute_terms[
"ggx_gen_schlick_s"] = {
217 [](
const float rough,
const float mu,
const float z,
const float3 rand) {
219 const float exponent = 5.0f * ((1.0f -
z) /
z);
223 if (precompute_terms.count(
name) == 0) {
229 const int samples = term.
samples;
230 const int nz = term.
nz;
231 const int ny = term.
ny;
232 const int nx = term.
nx;
234 std::cout <<
"static const float table_" <<
name <<
"[" << nz * ny * nx <<
"] = {" << std::endl;
235 for (
int z = 0;
z < nz;
z++) {
237 parallel_for(0, nx * ny, [&](
int64_t i) {
238 const int y =
i / nx;
239 const int x =
i % nx;
245 const float rough = (nx == 1) ? 0.0f :
clamp(
float(
x) /
float(nx - 1), 1e-4f, 1.0f);
246 const float mu = (ny == 1) ? rand.
w :
clamp(
float(
y) /
float(ny - 1), 1e-4f, 1.0f);
247 const float ior = (nz == 1) ? 0.0f :
clamp(
float(
z) /
float(nz - 1), 1e-4f, 0.99f);
253 sum += (double)value;
259 for (
int y = 0;
y < ny;
y++) {
261 for (
int x = 0;
x < nx;
x++) {
262 std::cout << std::to_string(
data[
y * nx +
x]);
267 else if (
y + 1 < ny ||
z + 1 < nz) {
276 std::cout << std::endl;
279 if (ny > 1 &&
z + 1 < nz) {
280 std::cout << std::endl;
283 std::cout <<
"};" << std::endl;
290int main(
const int argc,
const char **argv)
295 return ccl::cycles_precompute(argv[1]) ? 0 : 1;
BMesh const char void * data
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)
ccl_device float ior_from_F0(const float f0)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
static T sum(const btAlignedObjectArray< T > &items)
static unsigned long seed
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)
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
constexpr T clamp(T, U, U) RET
ccl_device_inline uint hash_uint2(const uint kx, const uint ky)
ccl_device_inline float3 one_float3()
ccl_device float4 sobol_burley_sample_4D(uint index, const uint dimension_set, uint seed, const uint shuffled_index_mask)
Spectrum transmission_tint
ccl_private void * fresnel
std::function< float(float, float, float, float3)> evaluation