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:
authorMikhail Matrosov <ktdfly>2021-06-28 14:54:18 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-06-28 15:05:22 +0300
commit9c6a382f9540c8e334a16b7740b5ba6bb294fca9 (patch)
treef8b4d0f1c557e7ef70c0f417fd22d9abf1912f74 /intern/cycles/kernel/closure/bsdf.h
parentce25b5812b4ad2f9c6d29bf254374235bc7100f7 (diff)
Cycles: reduce shadow terminator artifacts
Offset rays from the flat surface to match where they would be for a smooth surface as specified by the normals. In the shading panel there is now a Shading Offset (existing option) and Geometry Offset (new). The Geometry Offset works as follows: * 0: disabled * 0.001: only terminated triangles (normal points to the light, geometry doesn't) are affected * 0.1 (default): triangles at grazing angles are affected, and the effect fades out * 1: all triangles are affected Limitations: * The artifact is still visible in some cases, it could be that some quads require to be treated specifically as quads. * Inconsistent normals cause artifacts. * If small objects cast shadows to a big low poly surface, the shadows can appear to be in a wrong place - because the surface moved slightly above the geometry. This can be noticed only at grazing angles to light. * Approximated surfaces of two non-intersecting low-poly objects can overlap that causes off-the-wall shadows. Generally, using one or a few levels of subdivision can get rid of artifacts faster than before. Differential Revision: https://developer.blender.org/D11065
Diffstat (limited to 'intern/cycles/kernel/closure/bsdf.h')
-rw-r--r--intern/cycles/kernel/closure/bsdf.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h
index 6070fd983f5..6f2f2ebb202 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -462,7 +462,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
else {
/* Shadow terminator offset. */
const float frequency_multiplier =
- kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
+ kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
if (frequency_multiplier > 1.0f) {
*eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
}
@@ -488,12 +488,9 @@ ccl_device_inline
const float3 omega_in,
float *pdf)
{
- /* For curves use the smooth normal, particularly for ribbons the geometric
- * normal gives too much darkening otherwise. */
- const float3 Ng = (sd->type & PRIMITIVE_ALL_CURVE) ? sd->N : sd->Ng;
float3 eval;
- if (dot(Ng, omega_in) >= 0.0f) {
+ if (dot(sd->N, omega_in) >= 0.0f) {
switch (sc->type) {
case CLOSURE_BSDF_DIFFUSE_ID:
case CLOSURE_BSDF_BSSRDF_ID:
@@ -589,7 +586,7 @@ ccl_device_inline
}
/* Shadow terminator offset. */
const float frequency_multiplier =
- kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
+ kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
if (frequency_multiplier > 1.0f) {
eval *= shift_cos_in(dot(omega_in, sc->N), frequency_multiplier);
}