January 2023, 4.27.2
Thought I’d reply to this to say that in 4.27.2 I don’t have the issue.
Setting up a test in a new project appears to work fine.
This .gif (sorry about the quality here) shows a HISM with 1 million cube instances, each with their PerInstanceCustomData value set to the instance’s index. So the first instance has a custom value of 0.0, the next has 1.0, etc., up to 1 million.
Culling distances are 0 and 3000.
I created the HISM in C++ however, not in a blueprint.
I didn’t need to use BuildTreeIfOutdated() at all, as I’ve seen some other searches mention.
I do find an issue with the precision of my PerInstanceCustomData values getting worse as they get larger. I found this occurs in 2 places:
- in the VertexInterpolator node output
- and in the inner workings of the DebugFloat3Values node
I used Floor(myValue + 0.3f)
on the VertexInterpolator output to deal with most of the imprecision, but did nothing to whatever Debug3FloatValues is doing with its input. So as you can see, imprecision is still a thing in the example (as those decimal values climb higher), but I believe this isn’t connected to the HISM custom data/thread topic.
void ABasicDMIDisplayer::AddManyInstances()
{
float xSpace = 200.0f; // Spacing between cubes
float ySpace = 125.0f; // Spacing between cubes
float zHeight = 125.0f; // Height above the HISM's origin
float toSubtract = InstanceDimension * ySpace / 2.0f; // Start the cube rows far to the left
for (int32 x = 0; x < InstanceDimension; ++x) // InstanceDimension set to 1000
{ // thus giving 1 million instances.
for (int32 y = 0; y < InstanceDimension; ++y)
{
FTransform transform = FTransform(FRotator(0.0f), FVector(x * xSpace, (y * ySpace) - toSubtract, zHeight));
HISMComponent->AddInstance(transform);
HISMComponent->SetCustomDataValue(x * InstanceDimension + y, 0, x * InstanceDimension + y);
}
}
//HISMComponent->BuildTreeIfOutdated(true, false); // Didn't need to use this.
HISMComponent->MarkRenderStateDirty();
}