diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-07-04 16:29:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-07-05 19:21:06 +0300 |
commit | f8aab24fb5166c9ba935cb8f479cfd24244e7136 (patch) | |
tree | 28c6c5f87320bfa632fbd707115b48cb7ba606eb | |
parent | d5448eac6caf05fb5e8db5128960304a88d33710 (diff) |
Eevee: Volumetrics: Add Volume Absorption node.
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 9 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_volume_absorption.c | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 5458eb91199..7e639717905 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -2955,6 +2955,15 @@ void node_volume_scatter(vec4 color, float density, float anisotropy, out Closur #endif } +void node_volume_absorption(vec4 color, float density, out Closure result) +{ +#ifdef VOLUMETRICS + result = Closure((1.0 - color.rgb) * density, vec3(0.0), vec3(0.0), 0.0); +#else + result = CLOSURE_DEFAULT; +#endif +} + /* closures */ void node_mix_shader(float fac, Closure shader1, Closure shader2, out Closure shader) diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c index 4861871e8d3..03264e0acb6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c @@ -40,9 +40,9 @@ static bNodeSocketTemplate sh_node_volume_absorption_out[] = { { -1, 0, "" } }; -static int node_shader_gpu_volume_absorption(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) +static int node_shader_gpu_volume_absorption(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { - return false; + return GPU_stack_link(mat, "node_volume_absorption", in, out); } /* node type definition */ |