Page MenuHome

Eevee Wavelength Node Support
ClosedPublic

Authored by Iyad Ahmed (iyadahmed2001) on May 20 2021, 1:36 PM.

Details

Summary

This patch adds wavelength node support to Eevee,
similar to how Eevee Blackbody node works, thus it is a little off from Cycles

Diff Detail

Repository
rB Blender

Event Timeline

Iyad Ahmed (iyadahmed2001) requested review of this revision.May 20 2021, 1:36 PM
Iyad Ahmed (iyadahmed2001) created this revision.
Iyad Ahmed (iyadahmed2001) edited the summary of this revision. (Show Details)
Iyad Ahmed (iyadahmed2001) edited the summary of this revision. (Show Details)
Clément Foucault (fclem) requested changes to this revision.May 20 2021, 2:03 PM

I like the straightforwardness of the implementation. Not much to change before I accept this into master.

First I was going to suggest to bake everything inside the texture but realize that would slowdown shader updates.

source/blender/blenlib/intern/math_color.c
718

Comment style.

751

Comment style. (i know it's copied code but still)

source/blender/gpu/shaders/material/gpu_shader_material_color_util.glsl
115–117 ↗(On Diff #37308)

Use a mat3 multiplication. This might help the compiler to optimize.

source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl
8
8

How was the fitting done? Eye balled? Is is fitting the whole range?

What is lg?

9

if output is never above 1.0 you can use clamp(rgb, 0.0, 1.0) which is better on some architecture.

This revision now requires changes to proceed.May 20 2021, 2:03 PM
Brecht Van Lommel (brecht) added inline comments.
source/blender/blenlib/intern/math_color.c
718

Don't reference the Cycles code, if there is anything to be explained write it here.

source/blender/gpu/shaders/material/gpu_shader_material_color_util.glsl
115–118 ↗(On Diff #37308)

Don't hardcode XYZ to RGB conversion, use the appropriate matrix depending on the OpenColorIO config like the sky texture node does.

Iyad Ahmed (iyadahmed2001) marked 8 inline comments as done.
  • Fix comment style
  • Copy comment from Cycles code
  • Use mat3 multiplication for XYZ to RGB
  • Use IMB_colormangement_get_xyz_to_rgb
Iyad Ahmed (iyadahmed2001) retitled this revision from Eevee Wavelngth Node Support to Eevee Wavelength Node Support.May 20 2021, 5:29 PM
source/blender/gpu/shaders/material/gpu_shader_material_wavelength.glsl
8

I copied it from Cycles, also the comment exactly as is, not sure what lg is, same comment in original OSL code
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/1435e3a202a8648ede87c9baf73847acd9793b33/src/liboslexec/opcolor.cpp#L796

Alright patch updated, I'm not sure about moving get_XYZ_to_RGB_for_gpu to node_shader_util, was it a good move?

Greenlight from me.

This revision is now accepted and ready to land.May 20 2021, 5:53 PM
This revision was automatically updated to reflect the committed changes.