Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-09-22 21:03:24 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-09-27 16:56:28 +0300
commit6d19da0b2d468f099e0c1f56392ab8a1750d114f (patch)
tree7309b5ef31d5e42dca4e26e13b74bd6f223cba41 /intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
parentbd249eb4f37e65b2f4b3deef775bb136a2c234d1 (diff)
Cycles: BSDF eval refactor to remove separate reflection/refraction methods
Simplifies code overall to do it inside the eval function, most of the BSDFs already compute the dot product. The refactoring in bsdf_principled_hair_eval() was needed to avoid a HIP compiler bug. Cause is unclear, just changing the implementation enough is meant to sidestep it. Ref T92571, D15286
Diffstat (limited to 'intern/cycles/kernel/closure/bsdf_diffuse_ramp.h')
-rw-r--r--intern/cycles/kernel/closure/bsdf_diffuse_ramp.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h b/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
index d7faf5c9e9a..e955ed00b92 100644
--- a/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
+++ b/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
@@ -47,25 +47,23 @@ ccl_device void bsdf_diffuse_ramp_blur(ccl_private ShaderClosure *sc, float roug
{
}
-ccl_device Spectrum bsdf_diffuse_ramp_eval_reflect(ccl_private const ShaderClosure *sc,
- const float3 I,
- const float3 omega_in,
- ccl_private float *pdf)
+ccl_device Spectrum bsdf_diffuse_ramp_eval(ccl_private const ShaderClosure *sc,
+ const float3 I,
+ const float3 omega_in,
+ ccl_private float *pdf)
{
const DiffuseRampBsdf *bsdf = (const DiffuseRampBsdf *)sc;
float3 N = bsdf->N;
float cos_pi = fmaxf(dot(N, omega_in), 0.0f);
- *pdf = cos_pi * M_1_PI_F;
- return rgb_to_spectrum(bsdf_diffuse_ramp_get_color(bsdf->colors, cos_pi) * M_1_PI_F);
-}
-
-ccl_device Spectrum bsdf_diffuse_ramp_eval_transmit(ccl_private const ShaderClosure *sc,
- const float3 I,
- const float3 omega_in,
- ccl_private float *pdf)
-{
- return zero_spectrum();
+ if (cos_pi >= 0.0f) {
+ *pdf = cos_pi * M_1_PI_F;
+ return rgb_to_spectrum(bsdf_diffuse_ramp_get_color(bsdf->colors, cos_pi) * M_1_PI_F);
+ }
+ else {
+ *pdf = 0.0f;
+ return zero_spectrum();
+ }
}
ccl_device int bsdf_diffuse_ramp_sample(ccl_private const ShaderClosure *sc,