31 bsdf.sample_weight = 1.0f;
41 float pdf = 0.0f, sampled_eta;
62 bsdf.sample_weight = 1.0f;
72 float pdf = 0.0f, sampled_eta;
90 float rough,
float mu,
float eta,
float exponent,
float3 rand)
94 bsdf.sample_weight = 1.0f;
107 fresnel.exponent = exponent;
114 float pdf = 0.0f, sampled_eta;
148 std::map<string, PrecomputeTerm> precompute_terms;
150 precompute_terms[
"ggx_E"] = {1 << 23, 32, 32, 1, [](
float rough,
float mu,
float,
float3 rand) {
154 precompute_terms[
"ggx_Eavg"] = {
155 1 << 26, 32, 1, 1, [](
float rough,
float mu,
float,
float3 rand) {
160 precompute_terms[
"ggx_glass_E"] = {
161 1 << 23, 16, 16, 16, [](
float rough,
float mu,
float z,
float3 rand) {
167 precompute_terms[
"ggx_glass_Eavg"] = {
168 1 << 26, 16, 1, 16, [](
float rough,
float mu,
float z,
float3 rand) {
174 precompute_terms[
"ggx_glass_inv_E"] = {
175 1 << 23, 16, 16, 16, [](
float rough,
float mu,
float z,
float3 rand) {
181 precompute_terms[
"ggx_glass_inv_Eavg"] = {
182 1 << 26, 16, 1, 16, [](
float rough,
float mu,
float z,
float3 rand) {
189 precompute_terms[
"ggx_gen_schlick_ior_s"] = {
190 1 << 20, 16, 16, 16, [](
float rough,
float mu,
float z,
float3 rand) {
197 precompute_terms[
"ggx_gen_schlick_s"] = {
198 1 << 20, 16, 16, 16, [](
float rough,
float mu,
float z,
float3 rand) {
200 float exponent = 5.0f * ((1.0f -
z) /
z);
204 if (precompute_terms.count(name) == 0) {
210 const int samples = term.
samples;
211 const int nz = term.
nz, ny = term.
ny, nx = term.
nx;
213 std::cout <<
"static const float table_" << name <<
"[" << nz * ny * nx <<
"] = {" << std::endl;
214 for (
int z = 0;
z < nz;
z++) {
216 parallel_for(0, nx * ny, [&](
int64_t i) {
217 int y = i / nx, x = i % nx;
223 float rough = (nx == 1) ? 0.0f :
clamp(
float(x) /
float(nx - 1), 1e-4f, 1.0f);
224 float mu = (ny == 1) ? rand.w :
clamp(
float(y) /
float(ny - 1), 1e-4f, 1.0f);
225 float ior = (nz == 1) ? 0.0f :
clamp(
float(
z) /
float(nz - 1), 1e-4f, 0.99f);
237 for (
int y = 0; y < ny; y++) {
239 for (
int x = 0; x < nx; x++) {
240 std::cout << std::to_string(data[y * nx + x]);
245 else if (y + 1 < ny ||
z + 1 < nz) {
254 std::cout << std::endl;
257 if (ny > 1 &&
z + 1 < nz) {
258 std::cout << std::endl;
261 std::cout <<
"};" << std::endl;
268int main(
int argc,
const char **argv)
273 return ccl::cycles_precompute(argv[1]) ? 0 : 1;
typedef double(DMatrix)[4][4]
ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg, ccl_private const ShaderClosure *sc, float3 Ng, 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_glass_setup(ccl_private MicrofacetBsdf *bsdf)
ccl_device int bsdf_microfacet_ggx_setup(ccl_private MicrofacetBsdf *bsdf)
ccl_device float ior_from_F0(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 bool cycles_precompute(std::string name)
static CCL_NAMESPACE_BEGIN float precompute_ggx_E(float rough, float mu, float3 rand)
float ior_parametrization(float z)
static float precompute_ggx_glass_E(float rough, float mu, float eta, float3 rand)
static float precompute_ggx_gen_schlick_s(float rough, float mu, float eta, float exponent, float3 rand)
#define CCL_NAMESPACE_END
draw_view in_light_buf[] float
ccl_device_inline uint hash_uint2(uint kx, uint ky)
ccl_device_inline float average(const float2 a)
ccl_device_inline float3 one_float3()
ccl_device float4 sobol_burley_sample_4D(uint index, const uint dimension_set, uint seed, uint shuffled_index_mask)
ccl_private void * fresnel
std::function< float(float, float, float, float3)> evaluation
SPECTRUM_DATA_TYPE Spectrum
ccl_device_inline float sqr(float a)
ccl_device_inline float3 float4_to_float3(const float4 a)
ccl_device_inline int clamp(int a, int mn, int mx)