Shading: Add More Features To The Voronoi Node. This patch allows the Voronoi node to operate in 1D, 2D, and 4D space. It also adds a Randomness input to control the randomness of the texture. Additionally, it adds three new modes of operation: - Smooth F1: A smooth version of F1 Voronoi with no discontinuities. - Distance To Edge: Returns the distance to the edges of the cells. - N-Sphere Radius: Returns the radius of the n-sphere inscribed in the cells. In other words, it is half the distance between the closest feature point and the feature point closest to it. And it removes the following three modes of operation: - F3. - F4. - Cracks. The Distance metric is now called Euclidean, and it computes the actual euclidean distance as opposed to the old method of computing the squared euclidean distance. This breaks backward compatibility in many ways, including the base case. Reviewers: brecht, JacquesLucke Differential Revision: https://developer.blender.org/D5743

- [D] intern/cycles/util/util_math_float3.h

Fix T69044: OpenCL fail due to bad fract function. The fract function in OpenCL does more than just return the fraction. It also writes the floor to the second argument. Which wasn't put in consideration. Instead, we use a simple `a - floor(a)` like the Math node. Reviewers: brecht Differential Revision: https://developer.blender.org/D5553

- [D] intern/cycles/util/util_math_float3.h

Shading: Add more operators to Vector Math node. Add Multiply, Divide, Project, Reflect, Distance, Length, Scale, Snap, Floor, Ceil, Modulo, Fraction, Absolute, Minimum, and Maximum operators to the Vector Math node. The Value output has been removed from operators whose output is a vector, and the other way around. All of those removals has been handled properly in versioning code. The patch doesn't include tests for the new operators. Tests will be added in a later patch. Reviewers: brecht, JacquesLucke Differential Revision: https://developer.blender.org/D5523

- [D] intern/cycles/util/util_math_float3.h

Cycles Denoising: Get rid of halos around bright edges Previously, bright edges (e.g. caused by rim lighting) would sometimes get halos around them after denoising. This change introduces a log(1+x) highlight compression step that is performed before denoising and reversed afterwards. That way, the denoising algorithm itself operates in the compressed space and therefore bright edges cause less numerical issues.

- [D] intern/cycles/util/util_math_float3.h

ClangFormat: apply to source, most of intern Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat

- [D] intern/cycles/util/util_math_float3.h

Cycles: Cleanup, spacing after preprocessor It is supposed to be two spaces before comment stating which if else/endif statements corresponds to. Was mainly violated in the header guards.

- [D] intern/cycles/util/util_math_float3.h

Fix T54455, T56053, T55564: Cycles OpenCL build error after recent changes.

- [D] intern/cycles/util/util_math_float3.h

Cycles: add Principled Hair BSDF. This is a physically-based, easy-to-use shader for rendering hair and fur, with controls for melanin, roughness and randomization. Based on the paper "A Practical and Controllable Hair and Fur Model for Production Path Tracing". Implemented by Leonardo E. Segovia and Lukas Stockner, part of Google Summer of Code 2018.

- [D] intern/cycles/util/util_math_float3.h

Cycles: add voronoi features and distance settings from Blender. Features to get the 2nd, 3rd, 4th closest point instead of the closest, and various distance metrics. No viewport/Eevee support yet. Patch by Michel Anders, Charlie Jolly and Brecht Van Lommel. Differential Revision: https://developer.blender.org/D3503

- [D] intern/cycles/util/util_math_float3.h

Cleanup: use float3 SSE instead of ssef for voronoi texture.

- [D] intern/cycles/util/util_math_float3.h

Cycles: Cleanup: Remove double semicolons

- [D] intern/cycles/util/util_math_float3.h

Cycles: principled absorption color now has more effect at lower values.

- [D] intern/cycles/util/util_math_float3.h

Cycles: random walk subsurface scattering. It is basically brute force volume scattering within the mesh, but part of the SSS code for faster performance. The main difference with actual volume scattering is that we assume the boundaries are diffuse and that all lighting is coming through this boundary from outside the volume. This gives much more accurate results for thin features and low density. Some challenges remain however: * Significantly more noisy than BSSRDF. Adding Dwivedi sampling may help here, but it's unclear still how much it helps in real world cases. * Due to this being a volumetric method, geometry like eyes or mouth can darken the skin on the outside. We may be able to reduce this effect, or users can compensate for it by reducing the scattering radius in such areas. * Sharp corners are quite bright. This matches actual volume rendering and results in some other renderers, but maybe not so much real world objects. Differential Revision: https://developer.blender.org/D3054

- [D] intern/cycles/util/util_math_float3.h

Code refactor: add, remove, optimize various SSE functions. * Remove some unnecessary SSE emulation defines. * Use full precision float division so we can enable it. * Add sqrt(), sqr(), fabs(), shuffle variations, mask(). * Optimize reduce_add(), select(). Differential Revision: https://developer.blender.org/D2764

- [D] intern/cycles/util/util_math_float3.h

Cycles: Use float constants instead of double

- [D] intern/cycles/util/util_math_float3.h

Fix T51560: Black pixels on a denoising render Once again, numerical instabilities causing the Cholesky decomposition to fail. However, further increasing the diagonal correction just because of a few pixels in very specific scenes and settings seems unjustified. Therefore, this commit simply falls back to the basic NLM-filtered pixel if the more advanced model fails.

- [D] intern/cycles/util/util_math_float3.h

Cycles: Implement denoising option for reducing noise in the rendered image This commit contains the first part of the new Cycles denoising option, which filters the resulting image using information gathered during rendering to get rid of noise while preserving visual features as well as possible. To use the option, enable it in the render layer options. The default settings fit a wide range of scenes, but the user can tweak individual settings to control the tradeoff between a noise-free image, image details, and calculation time. Note that the denoiser may still change in the future and that some features are not implemented yet. The most important missing feature is animation denoising, which uses information from multiple frames at once to produce a flicker-free and smoother result. These features will be added in the future. Finally, thanks to all the people who supported this project: - Google (through the GSoC) and Theory Studios for sponsoring the development - The authors of the papers I used for implementing the denoiser (more details on them will be included in the technical docs) - The other Cycles devs for feedback on the code, especially Sergey for mentoring the GSoC project and Brecht for the code review! - And of course the users who helped with testing, reported bugs and things that could and/or should work better!

- [D] intern/cycles/util/util_math_float3.h

Cycles: Split vectorized math utilities to a dedicated files This file was even a bigger mess than vectorized types header, cleaning it up to make it easier to maintain this files and extend further.

- [D] intern/cycles/util/util_math_float3.h