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:
authorBrecht Van Lommel <brecht@blender.org>2022-05-23 21:54:09 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-05-23 23:09:44 +0300
commitbdab538b3019406cfbd53d99bc40c4dbae27393c (patch)
treeb99f06195bdbd647c275e15f72095c8c4af28eae /source/blender/gpu/shaders
parenta22ad7fbd391acc65b99336eae0df5c2a49553d9 (diff)
Fix Eevee blackbody wrong with non-default scene linear color space
* Port over new code tables from Cycles * Convert Rec.709 to scene linear for lookup table. * Move code for wavelength and blackbody to IMB so they can access the required transforms, which are not in blenlib. * Remove clamping from blackbody shader to bypass the texture read. Since it's variable now easiest to just always read from the texture than pass additional parameters. * Fold XYZ to RGB conversion into the wavelength table. Ref T68926
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_blackbody.glsl12
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl12
2 files changed, 4 insertions, 20 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_blackbody.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_blackbody.glsl
index d0111aa3839..e257483f364 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_blackbody.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_blackbody.glsl
@@ -1,13 +1,5 @@
void node_blackbody(float temperature, sampler1DArray spectrummap, float layer, 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, layer)).rgb, 1.0);
- }
+ float t = (temperature - 800.0) / (12000.0 - 800.0);
+ color = vec4(texture(spectrummap, vec2(t, layer)).rgb, 1.0);
}
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl
index 2c5d38eabbe..48d627dcd0b 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl
@@ -1,15 +1,7 @@
-void node_wavelength(float wavelength,
- sampler1DArray spectrummap,
- float layer,
- vec3 xyz_to_r,
- vec3 xyz_to_g,
- vec3 xyz_to_b,
- out vec4 color)
+void node_wavelength(float wavelength, sampler1DArray spectrummap, float layer, out vec4 color)
{
- mat3 xyz_to_rgb = mat3(xyz_to_r, xyz_to_g, xyz_to_b);
float t = (wavelength - 380.0) / (780.0 - 380.0);
- vec3 xyz = texture(spectrummap, vec2(t, layer)).rgb;
- vec3 rgb = xyz * xyz_to_rgb;
+ vec3 rgb = texture(spectrummap, vec2(t, layer)).rgb;
rgb *= 1.0 / 2.52; /* Empirical scale from lg to make all comps <= 1. */
color = vec4(clamp(rgb, 0.0, 1.0), 1.0);
}