Point Cloud Rendering / Efficient way of changing UPaperGroupedSprite Instances

Hey guys!

I’m now working for a while on a personal project which is sort of a point cloud renderer and I’m afraid I need your help right now ^^

So far I’m using UPaperGroupedSprites which gave me very good performance because of the instancing approach.
Now I have the following problem: I want to update the rotations and sizes of the individual instances in a efficient manner; the problem is that I, in the end, want to have streaming point clouds, so I have to update the whole dataset (up to millions of instances) basically every frame. So the performance of the scaling/rotating is really crucial.

Now I saw these functions:

SpriteComponent->UpdateInstanceTransform(idx, NewTransform);
SpriteComponent->ApplyWorldOffset(vec, false);

Unfortunately, all of them throw exceptions and I don’t know why. Can someone maybe explain the usage? I can of course provide you the full source code as well.

One last thing: I also thought about doing the scaling/rotating directly in the sprite shader (because its probably the fastest way) - do you guys think thats possible?

Thanks for your time ! :slight_smile:

does noone has some ideas? I would be happy about some simple hints as well. :slight_smile:

I can pretty much promise you straight away, that calling those functions for millions of objects will probably ruin your performance regardless. Hell just updating transforms for a few hundred objects is expensive enough as it is. When you start talking about millions of objects, even function call overhead starts to become an issue. Unreal doesn’t scale to that kind of component count (and it’s not designed to).

Scaling and Rotating in the material will most likely be faster, but you still have to pass that information to the material somehow and sending parameters isn’t that cheap either. You’ll be better off doing something on the GPU and in the renderer directly, with heavy use of instancing.

Thank you very much for your help, TheJamsh ! Do you maybe still have an idea why the update-functions above throw errors?

I would imagine that the SpriteComponent pointer is probably invalid or null, have you actually created the SpriteComponent object?

Hmm, I have created the Component using

SpriteComponent = CreateDefaultSubobject<UPaperGroupedSpriteComponent>(TEXT("PointCloudSpriteRenderer"));

nothing more. The other function calls on the Component, such as SpriteComponent->AddInstanceWithMaterial(…) etc. work. Thanks again for your help, I really appreciate it! Please let me know if you have some other ideas cause I’m quite desperate right now! :smiley::confused:

the log file produces:

how is that possible? Do you have any idea? Thank you very much in advance!