09-05-2022, 02:32 AM
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 ?
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]);