Page MenuHome

Geometry Nodes: Add LERP to Vector Math Node
AbandonedPublic

Authored by Johnny Matthews (guitargeek) on May 27 2021, 9:42 PM.

Details

Summary

This patch adds the LERP A+(B-A)*fac to the vector math nodes.

Diff Detail

Repository
rB Blender

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.May 27 2021, 9:42 PM
Johnny Matthews (guitargeek) created this revision.
Hans Goudey (HooglyBoogly) requested changes to this revision.May 27 2021, 9:47 PM

Nice! I don't think I want to decide whether we should have this myself, but it seems quite reasonable.

source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl
158

Looks like this should have a newline at the end.

source/blender/nodes/NOD_math_functions.hh
386

You can use float3::interpolate

source/blender/nodes/geometry/nodes/node_geo_attribute_vector_math.cc
63

This line looks a bit long, have you looked at https://wiki.blender.org/wiki/Tools/ClangFormat ?

97

Use the ELEM macro here so it's more extendible if we add another operation that uses float for C

source/blender/nodes/shader/nodes/node_shader_vector_math.cc
174

I think "Fac" is outdated, currently in the UI we try to avoid abbreviations like that. (There are still leftover places that break this rule).

This revision now requires changes to proceed.May 27 2021, 9:47 PM

I made the suggested changes and also ran 'make format' before creating the diff.

Managed to delete a quotation mark in the last patch file

Johnny Matthews (guitargeek) retitled this revision from Add LERP to Vector Math Node to Geometry Nodes: Add LERP to Vector Math Node.May 28 2021, 4:24 PM
Evan Wilson (EAW) added inline comments.
source/blender/nodes/shader/nodes/node_shader_vector_math.cc
174

@Johnny Matthews (guitargeek) I am pretty certain that @Hans Goudey (HooglyBoogly) meant that "Fac" shouldn't be abbreviated, but should be spelled out as "Factor" as seen in the geometry node on the right. The Color MixRGB node on the left is an example of a node that has yet to be updated.

Change 'position' label to 'factor'

Functionality like this will probably be added to a vector mode for the map range node rather than in vector math.