diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-11-23 05:39:06 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-11-24 08:37:37 +0300 |
commit | 16a28021493d5a54efff5e6aade39f7b015366cd (patch) | |
tree | 8b9961ea28db41ede2afd66bdc115a33246916a4 /source/blender/nodes | |
parent | f3b384862df83dfca8b7fbad3dc6c5c07d0cecaf (diff) |
Eevee: SSS: Principled Shader: Add a workaround the lack of scale input
This is a hack to make the user control the SSS radius even though the profile is baked with the default radius values.
This is completly against UI principles since you cannot edit the profile radiuses while there is something plugged into the radius socket.
Better solution will be to either have a dedicated node value for RGB radiuses and a SSS scale socket only for eevee.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c index aa2b3bbfc32..b0ca4128d19 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c @@ -65,6 +65,7 @@ static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) { + GPUNodeLink *sss_scale; #if 0 /* Old 2.7 glsl viewport */ // normal if (!in[17].link) @@ -107,8 +108,16 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE GPU_material_sss_profile_create(mat, &socket_data->value[1], &profile, NULL); } + if (in[2].link) { + sss_scale = in[2].link; + } + else { + float one[3] = {1.0f, 1.0f, 1.0f}; + GPU_link(mat, "set_rgb", GPU_uniform((float *)one), &sss_scale); + } + return GPU_stack_link(mat, node, "node_bsdf_principled_clearcoat", in, out, GPU_builtin(GPU_VIEW_POSITION), - GPU_uniform(&node->ssr_id), GPU_uniform(&node->sss_id)); + GPU_uniform(&node->ssr_id), GPU_uniform(&node->sss_id), sss_scale); } static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node) |