27 sd->closure_transparent_extinction += weight;
31 sd->closure_transparent_extinction = weight;
44 "HenyeyGreensteinVolume is too large!");
51 return ((1.0f - g * g) /
safe_powf(1.0f + g * g - 2.0f * g * cos_theta, 1.5f)) *
70 return (volume_a->
g == volume_b->
g);
82 if (
fabsf(g) < 1e-3f) {
86 float cos_theta =
dot(-
I, omega_in);
98 bool isotropic =
fabsf(g) < 1e-3f;
101 cos_theta = (1.0f - 2.0f * randu);
107 float k = (1.0f - g * g) / (1.0f - g + 2.0f * g * randu);
108 cos_theta = (1.0f + g * g - k * k) / (2.0f * g);
114 float sin_theta =
safe_sqrtf(1.0f - cos_theta * cos_theta);
120 dir = dir.
x *
T + dir.
y *
B + dir.
z *
D;
144 #ifdef __RAY_DIFFERENTIALS__
MINLINE float signf(float f)
MINLINE float safe_sqrtf(float a)
MINLINE float safe_powf(float base, float exponent)
ccl_addr_space struct HenyeyGreensteinVolume HenyeyGreensteinVolume
ccl_device int volume_phase_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, differential3 *domega_in, float *pdf)
CCL_NAMESPACE_BEGIN ccl_device void volume_extinction_setup(ShaderData *sd, float3 weight)
ccl_device float3 volume_phase_eval(const ShaderData *sd, const ShaderClosure *sc, float3 omega_in, float *pdf)
ccl_device int volume_henyey_greenstein_sample(const ShaderClosure *sc, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
ccl_device float3 volume_henyey_greenstein_eval_phase(const ShaderClosure *sc, const float3 I, float3 omega_in, float *pdf)
ccl_device int volume_henyey_greenstein_setup(HenyeyGreensteinVolume *volume)
ccl_device bool volume_henyey_greenstein_merge(const ShaderClosure *a, const ShaderClosure *b)
ccl_device float3 henyey_greenstrein_sample(float3 D, float g, float randu, float randv, float *pdf)
ccl_device float single_peaked_henyey_greenstein(float cos_theta, float g)
#define kernel_assert(cond)
#define CCL_NAMESPACE_END
#define make_float3(x, y, z)
@ CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID
ccl_device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b)
ccl_device_inline float dot(const float2 &a, const float2 &b)
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)