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/gpu | |
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/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 71333149634..8d120ae8984 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -3075,6 +3075,20 @@ void node_volume_absorption(vec4 color, float density, out Closure result) #endif } +void node_blackbody(float temperature, sampler2D spectrummap, out vec4 color) +{ + if(temperature >= 12000.0) { + color = vec4(0.826270103, 0.994478524, 1.56626022, 1.0); + } + else if(temperature < 965.0) { + color = vec4(4.70366907, 0.0, 0.0, 1.0); + } + else { + float t = (temperature - 965.0) / (12000.0 - 965.0); + color = vec4(texture(spectrummap, vec2(t, 0.0)).rgb, 1.0); + } +} + /* closures */ void node_mix_shader(float fac, Closure shader1, Closure shader2, out Closure shader) |