Page MenuHome

Geometry Nodes: Port shader gradient texture node
ClosedPublic

Authored by Charlie Jolly (charlie) on Sep 30 2021, 8:00 PM.

Diff Detail

Repository
rB Blender

Event Timeline

Charlie Jolly (charlie) requested review of this revision.Sep 30 2021, 8:00 PM
Charlie Jolly (charlie) created this revision.
Hans Goudey (HooglyBoogly) requested changes to this revision.Sep 30 2021, 8:08 PM

Thanks for the patch. I think the node should be able to avoid calculating the color output if it's not required. That can use uninitialized_single_output_if_required, which returns an empty span if the output is not needed.

This revision now requires changes to proceed.Sep 30 2021, 8:08 PM

Avoid calculating the color output if it's not required.

Charlie Jolly (charlie) updated this revision to Diff 42815.EditedOct 2 2021, 4:57 PM

Add automatic input.

Honestly it feels weird for this node to output a color if it's just the same on value on every channel, implicit conversion should make that unnecessary. But that's not something to change in this patch.

It's also odd how it sometimes only uses one element from the vector, but still has a vector input-- that's a bad practice IMO. But that's also out of scope here. I made a task so we don't forget to look into that: T91907

Assuming you've verified the output is the same as the shader nodes, the code looks fine to me.

source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
100–108

Declare intermediate variables const wherever possible.

Yes, I think this code has travelled from Blender Internal > Cycles and now GN/FN. The color output certainly doesn't make any sense.

Jacques Lucke (JacquesLucke) requested changes to this revision.Oct 14 2021, 3:59 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
100–108

This comment hasn't been addressed yet.

127

Is there a comment anywhere explaining why this is not just 1?

This revision now requires changes to proceed.Oct 14 2021, 3:59 PM
Charlie Jolly (charlie) marked 3 inline comments as done.Oct 14 2021, 8:33 PM
Charlie Jolly (charlie) updated this revision to Diff 43324.EditedOct 14 2021, 8:52 PM

Address comments

This revision is now accepted and ready to land.Oct 15 2021, 12:49 PM