Page MenuHome

Geometry Nodes: Add Average to Vector Math
AbandonedPublic

Authored by Hallam Roberts (MysteryPancake) on Jan 8 2022, 4:47 PM.

Details

Reviewers
None
Group Reviewers
Geometry Nodes
Summary

This Vector Math mode gets the average of two vectors as expected, (A + B) / 2.

Average was previously removed due to confusing behavior. It used to add A + B then normalize the result. This did not result in an expected result.
This version calculates the average as users would expected. It adds A + B, then multiplies the result by 0.5 to divide it.

Many users would like the Average mode back in Vector Math:
https://www.reddit.com/r/blender/comments/kzy00s/
https://www.reddit.com/r/blender/comments/fatn9l/
https://blender.stackexchange.com/questions/187440/

It could be renamed to "Mean" to avoid confusion with the removed "Average" mode, since both calculate a different thing.

Diff Detail

Repository
rB Blender
Branch
temp-vector-math-average (branched from master)
Build Status
Buildable 19843
Build 19843: arc lint + arc unit

Event Timeline

Hallam Roberts (MysteryPancake) requested review of this revision.Jan 8 2022, 4:47 PM
Hallam Roberts (MysteryPancake) created this revision.
Hallam Roberts (MysteryPancake) retitled this revision from Geometry Nodes: Added Average to Vector Math to Geometry Nodes: Add Average to Vector Math.Jan 8 2022, 4:51 PM
Hallam Roberts (MysteryPancake) edited the summary of this revision. (Show Details)
Hallam Roberts (MysteryPancake) edited the summary of this revision. (Show Details)

@Hallam Roberts (MysteryPancake) I have a patch that also contains average but instead it is called midpoint.

This is included in a wider ranging patch to provide parity between standard Math and Vector Math nodes.

D13550: Nodes: Expand Math and Vector Math functions

static float3 midpoint(const float3 &a, const float3 &b)
  {
    return (a + b) * 0.5f;
  }

@Hallam Roberts (MysteryPancake) I have a patch that also contains average but instead it is called midpoint.

This is included in a wider ranging patch to provide parity between standard Math and Vector Math nodes.

D13550: Nodes: Expand Math and Vector Math functions

static float3 midpoint(const float3 &a, const float3 &b)
  {
    return (a + b) * 0.5f;
  }

Thank you, I did not see this! Your patch is much better, especially since it allows X/Y/Z average as well as two vector average.

Added by Charlie Jolly, refer to this instead https://developer.blender.org/D13550