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:
authorClément Foucault <foucault.clem@gmail.com>2018-11-08 21:17:41 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-08 21:20:40 +0300
commit4f114419137e76acde2d60d256d470c5a7a4232b (patch)
tree2ebba925659d9e4ece39cdcc5ff68f5908751e91 /source/blender/gpu
parent9d12a5aa9e20c33c49bd86e956d0b3d5fbf6fd46 (diff)
Eevee: Add partial support for the Light Path Node
This makes it possible to tweak indirect lighting in the shader. Only a subset of the outputs is supported and the ray depth has not exactly the same meaning: Is Camera : Supported. Is Shadow : Supported. Is Diffuse : Supported. Is Glossy : Supported. Is Singular : Not supported. Same as Is Glossy. Is Reflection : Not supported. Same as Is Glossy. Is Transmission : Not supported. Same as Is Glossy. Ray Length : Not supported. Defaults to 1.0. Ray Depth : Indicate the current bounce when baking the light cache. Diffuse Depth : Same as Ray Depth but only when baking diffuse light. Glossy Depth : Same as Ray Depth but only when baking specular light. Transparent Depth : Not supported. Defaults to 0. Transmission Depth : Not supported. Same as Glossy Depth. Caveat: Is Glossy does not work with Screen Space Reflections but does work with reflection planes (when used with SSR or not). We have to render the world twice for that to work.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl35
1 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 24115dbd9c4..e729034f617 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2896,27 +2896,22 @@ void node_light_path(
out float transparent_depth,
out float transmission_depth)
{
-#ifndef PROBE_CAPTURE
- is_camera_ray = 1.0;
- is_glossy_ray = 0.0;
- is_diffuse_ray = 0.0;
- is_reflection_ray = 0.0;
- is_transmission_ray = 0.0;
-#else
- is_camera_ray = 0.0;
- is_glossy_ray = 1.0;
- is_diffuse_ray = 1.0;
- is_reflection_ray = 1.0;
- is_transmission_ray = 1.0;
-#endif
- is_shadow_ray = 0.0;
- is_singular_ray = 0.0;
+ /* Supported. */
+ is_camera_ray = (rayType == EEVEE_RAY_CAMERA) ? 1.0 : 0.0;
+ is_shadow_ray = (rayType == EEVEE_RAY_SHADOW) ? 1.0 : 0.0;
+ is_diffuse_ray = (rayType == EEVEE_RAY_DIFFUSE) ? 1.0 : 0.0;
+ is_glossy_ray = (rayType == EEVEE_RAY_GLOSSY) ? 1.0 : 0.0;
+ /* Kind of supported. */
+ is_singular_ray = is_glossy_ray;
+ is_reflection_ray = is_glossy_ray;
+ is_transmission_ray = is_glossy_ray;
+ ray_depth = rayDepth;
+ diffuse_depth = (is_diffuse_ray == 1.0) ? rayDepth : 0.0;
+ glossy_depth = (is_glossy_ray == 1.0) ? rayDepth : 0.0;
+ transmission_depth = (is_transmission_ray == 1.0) ? glossy_depth : 0.0;
+ /* Not supported. */
ray_length = 1.0;
- ray_depth = 1.0;
- diffuse_depth = 1.0;
- glossy_depth = 1.0;
- transparent_depth = 1.0;
- transmission_depth = 1.0;
+ transparent_depth = 0.0;
}
void node_light_falloff(float strength, float tsmooth, out float quadratic, out float linear, out float constant)