Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text

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!

Product Version: UE 4.19
more ▼

asked Oct 27 '18 at 05:24 PM in Using UE4

avatar image

1 1 1

avatar image Everynone Oct 27 '18 at 05:53 PM

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?

avatar image freddy91 Oct 27 '18 at 05:54 PM

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

avatar image Everynone Oct 27 '18 at 06:07 PM

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.

avatar image freddy91 Oct 28 '18 at 12:36 AM

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. Cheers!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Oct 28 '18 at 12:15 PM

avatar image

14.8k 77 25 62

avatar image freddy91 Oct 29 '18 at 09:38 AM

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

avatar image Everynone Oct 29 '18 at 10:25 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question