diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-23 06:55:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-23 21:10:24 +0300 |
commit | 77062e8bbb09049ac76d210bacb9b0945bad783e (patch) | |
tree | 20fa849fd2ce204bcfec853f024214a4e5f2499f /source/blender/nodes/shader | |
parent | 57609993d051dacc35794682ed6c24d6552e65a6 (diff) |
Eevee: add blackbody shader node support.
This replaces the blackbody to RGB code with the simpler and faster one from
Cycles. It's a little different but the other placing using this is the legacy
volume drawing, so no need to stay compatible with that.
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_blackbody.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.c b/source/blender/nodes/shader/nodes/node_shader_blackbody.c index af89a959554..28019651926 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.c +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.c @@ -38,6 +38,16 @@ static bNodeSocketTemplate sh_node_blackbody_out[] = { { -1, 0, "" } }; +static int node_shader_gpu_blackbody(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) +{ + const int size = 256; + float *data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture"); + + blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f); + + return GPU_stack_link(mat, node, "node_blackbody", in, out, GPU_texture(size, data)); +} + /* node type definition */ void register_node_type_sh_blackbody(void) { @@ -49,6 +59,7 @@ void register_node_type_sh_blackbody(void) node_type_socket_templates(&ntype, sh_node_blackbody_in, sh_node_blackbody_out); node_type_init(&ntype, NULL); node_type_storage(&ntype, "", NULL, NULL); + node_type_gpu(&ntype, node_shader_gpu_blackbody); nodeRegisterType(&ntype); } |