Draw 2D pointcloud on HUD

Hi everyone,
probably a basic question, but I’m getting a little confused here among HUDs, Widgets, Slates and so on.
So, I am developing an autonomous driving simulator and I have to simulate laser scans, which basically give a map of the environment. I have already done that, but I would like to show a simplified output while I am playing. What I did was this:

See that black box in the top left? I did that by using HUD class. Each white point is rendered with DrawRect. Now, I wanted to pass the laser data with blueprint events, and I think I understood that HUD is not really thought to share data like this. So, the question is, what do you think is the best (and computationally efficient) way to do this?

NB. The point cloud itself is pretty large, like 10k points at 25 Hz, so I do not want a precise representation, I can heavily subsample it in the HUD, up to like 100- 200 points. I would also like the HUD (or whatever) to draw the data as soon as available (i.e. receiving an event from the player)

Thank you!

It’s supposed to be real-time. So yes, I clear and update the whole thing

When you draw this, is the data supposed to be persistent? Or do you clear and update the whole thing every frame?

Also, you have it working, it seems. So what’s the issue? You need to push the data from the HUD class to another blueprint?

I mean, for something as simple as 2d top down view, the HUD class is not a bad choice, lots of tiny widgets would be less efficient, most likely.

I think you could get decent results with a Render Target - drawing blips / dots on the material is quite efficient.
Check my post here. There’s a short vid attached. There’s a generic tutorial linked at the top of the thread.

The data you have is just a bunch of vectors, right?

But do tell if you can’t get it going.

Also, for something more complex, consider checking this one out:


Still very much alive.

Yes it’s just a vector of coordinates. That’s great! I am definitely going to try out the Render Target approach, probably don’t need something much more complex! Thank you very much, I’ll let you know in a couple of days how that went, also for other people that might end up with similar issues in the future.

I gave it a quick go out of sheer curiosity, it does work:

Image from Gyazo

This is shooting 360 linetraces around the character and draws hits to the render target every frame. Not particularly performant but it does work. Not so sure whether this is a good method but can be optimised.

Drawing rects in HUD is an order of magnitude faster, though.

Image from Gyazo

If you do not need anything flashy, stick with the HUD.

Thank you very much for trying it out. Just for curiosity, how many FPS was it running in the two cases?

I don’t have the exact numbers but depending on the number of line trace hits (since it’s not always 360 and I only draw the ones that did hit an obstacle), the material would half my FPS after around 200 hits… This is probably a bad method for something like this if you need performance, the biggest hit comes from the size of the RenderTarget (512 in this case). With it being much smaller (like in your example), the impact should be much smaller.

The HUD does not care about such things. Drawing rectangles had no visible impact so it was sitting around 120 pretty much all the time.

But again, not an expert on this, consider asking in the forums, you may get a more informed advice how to do it more efficiently in BPs.