blender/intern/cycles/kernel/shaders
Lukas Stockner eacdcb2dd8 Cycles: Add new Sky Texture method including direct sunlight
This commit adds a new model to the Sky Texture node, which is based on a
method by Nishita et al. and works by basically simulating volumetric
scattering in the atmosphere.

By making some approximations (such as only considering single scattering),
we get a fairly simple and fast simulation code that takes into account
Rayleigh and Mie scattering as well as Ozone absorption.

This code is used to precompute a 512x128 texture which is then looked up
during render time, and is fast enough to allow real-time tweaking in the
viewport.

Due to the nature of the simulation, it exposes several parameters that
allow for lots of flexibility in choosing the look and matching real-world
conditions (such as Air/Dust/Ozone density and altitude).

Additionally, the same volumetric approach can be used to compute absorption
of the direct sunlight, so the model also supports adding direct sunlight.
This makes it significantly easier to set up Sun+Sky illumination where
the direction, intensity and color of the sun actually matches the sky.

In order to support properly sampling the direct sun component, the commit
also adds logic for sampling a specific area to the kernel light sampling
code. This is combined with portal and background map sampling using MIS.

This sampling logic works for the common case of having one Sky texture
going into the Background shader, but if a custom input to the Vector
node is used or if there are multiple Sky textures, it falls back to using
only background map sampling (while automatically setting the resolution to
4096x2048 if auto resolution is used).

More infos and preview can be found here:
https://docs.google.com/document/d/1gQta0ygFWXTrl5Pmvl_nZRgUw0mWg0FJeRuNKS36m08/view

Underlying model, implementation and documentation by Marco (@nacioss).
Improvements, cleanup and sun sampling by @lukasstockner.

Differential Revision: https://developer.blender.org/D7896
2020-06-17 21:06:41 +02:00
..
CMakeLists.txt Fix: T73830 OSL not finding stdosl.h on linux 2020-02-17 10:28:12 -07:00
node_absorption_volume.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_add_closure.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_ambient_occlusion.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_anisotropic_bsdf.osl Cleanup: clang-format 2020-02-12 18:19:01 +11:00
node_attribute.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_background.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_bevel.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_blackbody.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_brick_texture.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_brightness.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_bump.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_camera.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_checker_texture.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_clamp.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_color.h ClangFormat: apply to source, most of intern 2019-04-17 06:21:24 +02:00
node_combine_hsv.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_combine_rgb.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_combine_xyz.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_color.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_float.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_int.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_normal.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_point.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_string.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_convert_from_vector.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_diffuse_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_displacement.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_emission.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_environment_texture.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_fresnel.h ClangFormat: apply to source, most of intern 2019-04-17 06:21:24 +02:00
node_fresnel.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_gamma.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_geometry.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_glass_bsdf.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_glossy_bsdf.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_gradient_texture.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_hair_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_hair_info.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_hash.h Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_holdout.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_hsv.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_ies_light.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_image_texture.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_invert.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_layer_weight.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_light_falloff.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_light_path.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_magic_texture.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_map_range.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_mapping.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_math.h Cycles: Vector Rotate Node using Axis and Angle method 2020-02-17 15:43:18 +00:00
node_math.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_mix_closure.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_mix.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_musgrave_texture.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_noise_texture.osl Shading: add Roughness input to Noise and Wave texture nodes 2020-04-09 21:48:03 +02:00
node_noise.h Shading: add Roughness input to Noise and Wave texture nodes 2020-04-09 21:48:03 +02:00
node_normal_map.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_normal.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_object_info.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_output_displacement.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_output_surface.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_output_volume.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_particle_info.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_principled_bsdf.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_principled_hair_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_principled_volume.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_ramp_util.h ClangFormat: apply to source, most of intern 2019-04-17 06:21:24 +02:00
node_refraction_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_rgb_curves.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_rgb_ramp.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_rgb_to_bw.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_scatter_volume.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_separate_hsv.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_separate_rgb.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_separate_xyz.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_set_normal.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_sky_texture.osl Cycles: Add new Sky Texture method including direct sunlight 2020-06-17 21:06:41 +02:00
node_subsurface_scattering.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_tangent.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_texture_coordinate.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_toon_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_translucent_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_transparent_bsdf.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_uv_map.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_value.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_vector_curves.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_vector_displacement.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_vector_math.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_vector_rotate.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_vector_transform.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_velvet_bsdf.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_vertex_color.osl Fix T73938: Cycles Vertex Color wrong if no layer is specified 2020-02-19 12:10:33 +01:00
node_voronoi_texture.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_voxel_texture.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_wave_texture.osl Shading: add Roughness input to Noise and Wave texture nodes 2020-04-09 21:48:03 +02:00
node_wavelength.osl Cleanup: Fix build warnings from OSL shader compilation 2020-02-11 21:40:23 -07:00
node_white_noise_texture.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
node_wireframe.osl Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
stdcycles.h Cleanup: clang-format 2020-02-12 18:19:01 +11:00