blender/intern/cycles/kernel/shaders
Lukas Stockner 65b25df801 Cycles: Overhaul ensure_valid_reflection to fix issues with normal- and bumpmapping
This function is supposed to prevent the black artifacts caused by strong normal- or bumpmapping, but failed in some cases.

Now the code correctly handles all test files and previous issues I am aware of and also has extensive comments describing
the algorithm and the math behind it.

Basically, the main problem was that there can be multiple valid solutions that fulfil the reflection angle criterium,
but I had assumed that only one would exist and therefore simply picked the first solution with a positive term in srqt().
Now, the code uses additional validity checks and a simple heuristic to pick the best valid solution.

Additionally, the code messed up very shallow reflections even if the normal map strength was zero due to the constant
limit for the outgoing ray angle, which caused shallow incoming rays to fail the initial test even when reflected directly
on Ng. Now, the code accounts for this by reducing the threshold in the case of a shallow incoming ray, ensuring that at
least N=Ng is always a valid solution.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D3816
2018-10-25 14:50:48 +02:00
..
CMakeLists.txt Cycles: add Principled Hair BSDF. 2018-07-18 13:59:06 +02:00
node_absorption_volume.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_add_closure.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_ambient_occlusion.osl Cycles: change AO node default to 16 samples and only local off. 2018-06-29 15:43:55 +02:00
node_anisotropic_bsdf.osl Cycles: switch to squared roughness convention for all nodes. 2018-03-10 18:05:01 +01:00
node_attribute.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_background.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_bevel.osl Fix T54107: bevel shader + normal map gives wrong result. 2018-02-21 17:56:26 +01:00
node_blackbody.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_brick_texture.osl Cycles: Fix OSL brick node after recent fix 2017-11-21 04:30:12 -05:00
node_brightness.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_bump.osl Cycles: Add reflection fix to Bump and Normal Map nodes 2018-07-26 17:00:31 +02:00
node_camera.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_checker_texture.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_color.h Cleanup: strip trailing space for cycles 2018-07-06 10:17:58 +02:00
node_combine_hsv.osl Revert "Fix T42888: Separate and Combine HSV distorts the hue value" 2014-12-29 18:14:08 +05:00
node_combine_rgb.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_combine_xyz.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_convert_from_color.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_convert_from_float.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_convert_from_int.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_convert_from_normal.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_convert_from_point.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_convert_from_string.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_convert_from_vector.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_diffuse_bsdf.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_displacement.osl Cycles: add Vector Displacement node and extend Displacement node. 2018-02-03 12:20:26 +01:00
node_emission.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_environment_texture.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_fresnel.h Cleanup: strip trailing space for cycles 2018-07-06 10:17:58 +02:00
node_fresnel.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_gamma.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_geometry.osl Fix T43651: New pointiness attribute doesn't work with displacement 2015-02-20 17:20:24 +05:00
node_glass_bsdf.osl Cycles: switch to squared roughness convention for all nodes. 2018-03-10 18:05:01 +01:00
node_glossy_bsdf.osl Cycles: switch to squared roughness convention for all nodes. 2018-03-10 18:05:01 +01:00
node_gradient_texture.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_hair_bsdf.osl Fix Cycles OSL hair BSDF inconsistencies with SVM. 2016-07-29 03:29:05 +02:00
node_hair_info.osl Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range. 2018-02-14 14:55:46 +01:00
node_holdout.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_hsv.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_ies_light.osl Cycles: Add Support for IES files as textures for light strength 2018-05-27 01:24:57 +02:00
node_image_texture.osl Fix T48783: OSL render errors after recent refactoring. 2016-07-03 13:08:21 +02:00
node_invert.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_layer_weight.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_light_falloff.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_light_path.osl Cycles: Expose diffuse and glossy depth to Light Path node 2017-01-19 15:09:58 +01:00
node_magic_texture.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_mapping.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_math.osl Nodes: add sqrt, ceil, floor and fract to math nodes. 2018-07-13 11:00:10 +02:00
node_mix_closure.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_mix.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_musgrave_texture.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_noise_texture.osl Cleanup: Remove unused Noise Basis texture code. 2015-05-28 01:07:37 +02:00
node_normal_map.osl Cycles: Add reflection fix to Bump and Normal Map nodes 2018-07-26 17:00:31 +02:00
node_normal.osl Code refactor: add separate RGB to BW node and rename some sockets. 2016-05-29 20:30:16 +02:00
node_object_info.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_output_displacement.osl Cycles: change material output displacement to vector. 2018-01-23 12:49:35 +01:00
node_output_surface.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_output_volume.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_particle_info.osl Cycles: restore Particle Info Index for now, keep it next to Random. 2018-02-14 21:45:57 +01:00
node_principled_bsdf.osl Fix random walk SSS issues with different base and subsurface color. 2018-02-12 21:08:59 +01:00
node_principled_hair_bsdf.osl Cycles: add Principled Hair BSDF. 2018-07-18 13:59:06 +02:00
node_principled_volume.osl Cycles: principled absorption color now has more effect at lower values. 2018-02-28 20:11:53 +01:00
node_ramp_util.h Cleanup: strip trailing space for cycles 2018-07-06 10:17:58 +02:00
node_refraction_bsdf.osl Cycles: switch to squared roughness convention for all nodes. 2018-03-10 18:05:01 +01:00
node_rgb_curves.osl Fix T49327: Cycles OSL Mode: RGB Curves node only outputs gray scale images 2016-09-12 16:14:40 +02:00
node_rgb_ramp.osl Fix T49071: Cycles OSL build problem with oslc compilers that can't find their own stdosl.h. 2016-08-12 01:01:09 +02:00
node_rgb_to_bw.osl Fix T48783: OSL render errors after recent refactoring. 2016-07-03 13:08:21 +02:00
node_scatter_volume.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_separate_hsv.osl Revert "Fix T42888: Separate and Combine HSV distorts the hue value" 2014-12-29 18:14:08 +05:00
node_separate_rgb.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_separate_xyz.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_set_normal.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_sky_texture.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_subsurface_scattering.osl Cycles: random walk subsurface scattering. 2018-02-09 19:58:33 +01:00
node_tangent.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_texture_coordinate.osl Cycles: Support texture coordinate from another object 2015-01-27 13:36:30 +05:00
node_texture.h Cleanup: strip trailing space for cycles 2018-07-06 10:17:58 +02:00
node_toon_bsdf.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_translucent_bsdf.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_transparent_bsdf.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_uv_map.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_value.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_vector_curves.osl Fix T49071: Cycles OSL build problem with oslc compilers that can't find their own stdosl.h. 2016-08-12 01:01:09 +02:00
node_vector_displacement.osl Cycles: add Vector Displacement node and extend Displacement node. 2018-02-03 12:20:26 +01:00
node_vector_math.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_vector_transform.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_velvet_bsdf.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_voronoi_texture.osl Cycles: add voronoi features and distance settings from Blender. 2018-07-15 00:45:42 +02:00
node_voxel_texture.osl Cleanup: OSL style 2016-02-17 21:39:23 +11:00
node_wave_texture.osl Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
node_wavelength.osl Cleanup: Fix Cycles Apache header. 2014-12-25 02:50:24 +01:00
node_wireframe.osl Cycles: Add note about autodiff in OSL wireframe shader 2015-02-21 17:31:41 +05:00
oslutil.h Code refactor: use dynamic shader node array lengths now that OSL supports them. 2016-05-17 21:39:16 +02:00
stdosl.h Cycles: Overhaul ensure_valid_reflection to fix issues with normal- and bumpmapping 2018-10-25 14:50:48 +02:00