Function node support for blackbody shader node #114768
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114768
Loading…
Reference in New Issue
No description provided.
Delete Branch "KenzieMac130/blender:main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Added function nodes support for blackbody shader node. This can be used to bake lava flow into vertex colors for vertex animation caches in games, to convert temperature to color in vdb volumes.
This patch also refactors IMB_colormanagement in order to add a single output blackbody function to better support the needs of this node (and possibly other areas like improved color select, python stuff, in the future), a similar treatment has been given to wavelength to rgb function for code consistency.
Function node support for blackbody shader nodeto WIP: Function node support for blackbody shader nodeWIP: Function node support for blackbody shader nodeto Function node support for blackbody shader nodeGenerally looks fine, just got some minor comments.
@ -35,6 +35,7 @@ class NODE_MT_geometry_node_GEO_COLOR(Menu):
layout = self.layout
node_add_menu.add_node_type(layout, "ShaderNodeValToRGB")
node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve")
node_add_menu.add_node_type(layout, "ShaderNodeBlackbody")
Order this to the beginning the respect alphabetical ordering.
@ -534,10 +534,12 @@ enum {
/** \name Rendering Tables
* \{ */
void IMB_colormanagement_blackbody_temperature_to_rgb(float *r_dest, float value);
It's not clear whether to pass a
float[3]
orfloat[4]
here, better be more specific.Also, just to consistency, if that function is not works with alpha directly, alpha should be filled as
1.0
in function node itself.I changed it to a more explicit c array reference similar to the copy_v3_v3 code. The original code set alpha to zero using
r_table[i * 4 + 3] = 0.0f;
this just replicates current behavior. Honestly this should probably be changed to set it to one but I was reluctant to make any changes. IMB_colormanagement_blackbody_temperature_to_rgb_table assumes a vec4 array (which goes unmarked) and alpha is seemingly unused but the padding seems necessary to fit the color ramp format.Geometry nodes should fill alpha by
1.0
, changes in image function is not necessary.I feel like a good course of action would be to correct the naming of the
IMB_colormanagement_blackbody_temperature_to_rgb_table
(and single/wavelength functions) to "rgba" and possibly discuss setting the default for its outgoing alpha (which seems to be unused in shader nodes since alpha is often treated separately) to 1.0? For now I just keep existing behavior.@ -4333,6 +4333,19 @@ static void blackbody_temperature_to_rec709(float rec709[3], float t)
}
}
void IMB_colormanagement_blackbody_temperature_to_rgb(float r_dest[4], float value)
It is a vec4, this is the format that IMB_colormanagement_wavelength_to_rgb_table already assumes. The naming of the original function seems misleading.
Oh, yeah, i see\
@ -31,6 +36,39 @@ static int node_shader_gpu_blackbody(GPUMaterial *mat,
return GPU_stack_link(mat, node, "node_blackbody", in, out, ramp_texture, GPU_constant(&layer));
}
class BlackbodyFunction : public mf::MultiFunction {
Just noticed, since this is a very simple function with a single input and output, you can also just use the
mf::build::SI1_SO
utility to make the code simpler.I went ahead and updated the alpha in the color management generation of blackbody/wavelength to 1.0 after checking existing references of the functions and determining that alpha was previously unused in all instances. My visual testing of it also shows that no functionality changed. The alpha channel was previously just padding but since geometry nodes colors include an alpha channel setting the alpha value to 1.0 was necessary to give the user sensible results. Hopefully this is an acceptable change. (image showing functionality still working after the change)
@blender-bot build