diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2018-07-26 17:48:15 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2018-07-26 18:00:31 +0300 |
commit | d6e769d32e7939e3bbd1986cdc4abd2b13135eab (patch) | |
tree | 394509448476044962a264b77b075b0ed3bae789 /intern/cycles/kernel/svm/svm_displace.h | |
parent | 1c41dbb079e391a1d684a7dedf40728025ef8839 (diff) |
Cycles: Add reflection fix to Bump and Normal Map nodes
While changing the shading normal is a great way to add additional detail to a model, there are some problems with it.
One of them is that at grazing angles and/or strong changes to the normal, the reflected ray can end up pointing into the actual geometry, which results in a black spot.
This patch helps avoid this by automatically reducing the strength of the bump/normal map if the reflected direction would end up too shallow or inside the geometry.
Differential Revision: https://developer.blender.org/D2574
Diffstat (limited to 'intern/cycles/kernel/svm/svm_displace.h')
-rw-r--r-- | intern/cycles/kernel/svm/svm_displace.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm_displace.h b/intern/cycles/kernel/svm/svm_displace.h index b85eb9c0458..0f5b3abef87 100644 --- a/intern/cycles/kernel/svm/svm_displace.h +++ b/intern/cycles/kernel/svm/svm_displace.h @@ -75,6 +75,8 @@ ccl_device void svm_node_set_bump(KernelGlobals *kg, ShaderData *sd, float *stac object_normal_transform(kg, sd, &normal_out); } + normal_out = ensure_valid_reflection(sd->Ng, sd->I, normal_out); + stack_store_float3(stack, node.w, normal_out); #endif } |