Obi Official Forum

Full Version: Question about calculating lambda
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Question about calculating lambda
According to the formula in PBD, we just use the sum of the square of gradient to calculate the lambda, but in the code of CalculateLambdasJob in BurstDensityConstraint, it adds the square of the sum of gradient(data[2] * data [2]) too. Is there some reason to add this term ?
Code:
// self particle contribution to density and gradient:
data += new float4(densityKernel.W(0, radii[i]), 0, grad, grad * grad + data[2] * data[2]);
(09-05-2022, 02:32 AM)littleaa Wrote: [ -> ]Question about calculating lambda
According to the formula in PBD, we just use the sum of the square of gradient to calculate the lambda, but in the code of CalculateLambdasJob in BurstDensityConstraint, it adds the square of the sum of gradient(data[2] * data [2]) too. Is there some reason to add this term ?
Code:
// self particle contribution to density and gradient:
data += new float4(densityKernel.W(0, radii[i]), 0, grad, grad * grad + data[2] * data[2]);

For position-based fluids, the gradient takes a slightly different form depending on whether the particle is a neighbor or not. Check equation 8) here:
https://mmacklin.com/pbf_sig_preprint.pdf

the square of the sum of the gradients accounts for the case where k == i.

kind regards,