Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of 3D points that I need to "blend" between. Lets say I have points [A,B,C] and I have the amount I want to blend each as [0.5, 0.2, 0.8], how can I blend between these points with the amount I need?

Obviously if I just had 2 points I could use the vector math (A + (B - A) * ratio).

Method 1: I'm currently using a weighted average, which I suppose gives me the weighted center, but I need to try different blending styles to see visually which looks best.

Method 2 What If I did this:

  1. Calculated a difference vector, each 3D point against the default point (I do have a default point)

    A - Default

  2. Then multiplied this difference with the blend amount

    (A - Default) * Amount

  3. And added these up, would that work? What result would I get?

    (A - Default) * A_Amount + (B - Default) * B_Amount + (C - Default) * C_Amount

share|improve this question
What do you mean by blending here? Do you want the weighted center of these points? If you just want to blend three points A to three other points B you could use your formula with three different sets of A, B, and ratio. – danijar Dec 24 '12 at 9:43
I need to try different types of blending to see visually which works best. I'm currently using a weighted average, which I suppose gives me the weighted center. Are there other types? See edit; – Harsh Gupta Dec 24 '12 at 9:47
up vote 5 down vote accepted

It is called a barycentre. Here your point is:

P = (A * A_ratio + B * B_ratio + C * C_ratio) / (A_ratio + B_ratio + C_ratio)

Badly, Wikipedia have no dedicaced page for this, so you'll have to understand the explanation of center of mass, which is just a generalization of barycentres applied to physics.

EDIT: your second method is equal to:

P - default


((A - def) * A_r + (B - def) * B_r + (C - def) * C_r) / (A_r + B_r + C_r)
= (A * A_r + B * B_r + C * C_r) / (A_r + B_r + C_r) - def * (A_r + B_r + C_r) / (A_r + B_r + C_r)
= P - def
share|improve this answer
What would the ratios be if I wanted a perfectly centralized point? 0.5 for all? Or 1 for all? – Harsh Gupta Dec 24 '12 at 9:54
It is called an isobarycenter, and is equal to the average of all points – Synxis Dec 24 '12 at 9:55
Synxis you are really good in math, but I cannot understand your "P - default" statement or its proof, in simple terms what do you mean? – Harsh Gupta Dec 24 '12 at 10:04
P - default: P is the barycenter defined at the top of my answer, and default is the point you've named Default'. In a nushell, your second method is just a 'wrong' version of your first, because the result will be translated by -1 * Default` – Synxis Dec 24 '12 at 11:32
No. You cannot set all ratios to 0, because you have to divide by the sum of all ratios, which has to be non-null. – Synxis Dec 24 '12 at 13:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.