Hi,
For my landscape (with a very high x- and y-scaling factor of 3000) the grass node spawns grass at the wrong locations as seen in the following screenshots:
The grass sometimes spawns below the landscape and sometimes in the air.
I have investigated a bit and found the following code in the [LandscapeGrass.cpp][3] file:
OutLocation->Z = DrawScale.Z * FMath::Lerp(
FMath::Lerp(Sample11, Sample21, LerpX),
FMath::Lerp(Sample12, Sample22, LerpX),
LerpY);
which is responsible for spawning the grass. I think bilinear interpolation is the wrong way to compute the z coordinates within arbitrary four vertices.
I changed it to the following code:
FVector P11 = { (float)X1, (float)Y1, Sample11 };
FVector P12 = { (float)X1, (float)Y2, Sample12 };
FVector P21 = { (float)X2, (float)Y1, Sample21 };
FVector P22 = { (float)X2, (float)Y2, Sample22 };
float Z;
if (LerpX > LerpY)
{
FVector N = FVector::CrossProduct(P22 - P21, P11 - P21);
Z = P21.Z - ((TestX - P21.X) * N.X + (TestY - P21.Y) * N.Y) / N.Z;
}
else
{
FVector N = FVector::CrossProduct(P22 - P12, P11 - P12);
Z = P12.Z - ((TestX - P12.X) * N.X + (TestY - P12.Y) * N.Y) / N.Z;
}
which fixes the positions of the spawned grass. I think this needs to be fixed?
Cheers