Announcement

Collapse
No announcement yet.

How to place single GPU particles at specified locations?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Interesting.
    So let me get this straight for the other philistines of the forum:

    1. You take your point cloud (pcl)
    2. You sample it to fit the pixel count of a square texture (in this case 128x128 so 16384 points as you pointed out)
    3. You convert each x,y,z position to a 0-255 scale
    4. You convert your "xyz" csv into a texture for which each raw equal to a pixel with its rgb values
    5. You "extract" those rgb values inside UE4 so that it reads it as a coordinate system for a 256x256x256 cube
    6. You can "beef up" this cube density with a greater image depth which allow you to save rgb values with extended decimals

    That seems quite a complicated system to import a point cloud and it comes with a lot of limitations.
    How many points can you expect to load before it critically impact the performance ?

    Maybe pursuing the integration of the pcl library inside UE would be a more productive way to toy around with pcl inside this engine (https://forums.unrealengine.com/show...Library-in-UE4) ?
    To be honest I wanted to do it, but my C++ skill are not that good and I was not able to move forward on this project.

    Also, I was impressed by the gpu particle system you can see in https://www.youtube.com/watch?v=nfhEULONgs8.

    Comment


      #17
      [MENTION=34027]as3ef2th1[/MENTION] - Yes, you have understood and explained this technique very well!

      I suspect that even [MENTION=27525]xnihil0zer0[/MENTION] would admit that it is a bit of a kludge, but as kludges go I have to say it is a fairly magnificent one. :-)

      How it scales up to a large number of points remains to be seen. For my use case I may need something on the order of a million points.

      I mentioned experimenting with an EXR texture to increase the precision. I looked through the engine code, and unfortunately when you use an EXR texture it uses 16-bit floats internally, even if the source EXR had 32-bit floats. (I'd initially misinterpreted the information the Editor displayed about the texture - wishful thinking on my part!) I'm not sure if a 16-bit float is enough precision to render a good-looking point cloud - my guess is it isn't, but I could be mistaken.

      Regarding my idea of using multiple textures to increase precision, now I think I would probably use a single texture instead, either with adjacent pixels containing the bit slices for each point, or by having the first block be the low-order 8 bits, a second block with the next-higher-order 8 bits, etc. This would end up being a non-square texture, but that's OK on desktop platforms like I'm targeting. Mobile platforms would be another story - I read that at least some iOS devices only accept square textures, but that doesn't matter for my project which will only run on a very high-end desktop.

      Integrating PCL into Unreal is a very interesting idea - thanks for mentioning it. I will have to look into that a bit. I was planning on using it for some preprocessing of the incoming point cloud data (I need to load in point cloud data from a LIDAR scanner in real-time) - but hadn't thought of using it for the rendering.

      Comment


        #18
        Well, I am also working with LIDAR data, both terrestrial and aerial one.
        I was also expecting at some point to be able to load point cloud data inside the engine so that my fellow researchers can look around the dataset with the Oculus/Vive. This way, people could have a better understanding of the data scale, quality and hopefully be more effective with classification.

        Not only the PCL library would allow us to grab LIDAR data more easily inside the engine, it also comes with specific perks related to pcl visualization such as real time octree decimation (not the right term but you get the idea). I have a potree example here : http://vritage.nazg.org/Besancon/Besancon.html You will never have more than 1 000 000 points at a time depending on your "location" inside or outside the cloud, which comes pretty handy to spare processing power.

        It seems that it's possible to have this kind of behavior directly inside the engine as MrBushido pointed out on reddit at some point : https://www.reddit.com/r/unrealengin..._cloud/csm9rl2

        Right now I'm still writing a matlab script to transform my lidar data into a 16bits png !

        Comment


          #19
          Ok, I finally got it to work with some of my .las file.
          For some reason (meta data about scale or something like that) I have to convert the .las into a .ply and then into a .csv before processing it with matlab. If I go straight with .las to .csv this will not work.

          The matlab script is pretty straightforward, anyway :


          filename = 'yourfile.dat'; %I'm used to rename my file.csv to file.dat before using matlab but it's still csv data anyway
          A = csvread(filename);

          A = A - min(A( : )); %useless spaces for ( : ) because it's converted to a...smiley
          A = A/max(A( : ));
          A = round(A, 6); %not really useful but...

          A = reshape(A,128,128,3); %reshape your data so that it's a 128x128 image with 3x[0-1] values for colors
          image(A); %preview
          imwrite((A), 'D:\PROJETS\UnrealCloud\sample.png', 'png') %saving as a 16 bits .png


          Click image for larger version

Name:	HighresScreenshot00000.jpg
Views:	1
Size:	184.9 KB
ID:	1111732

          Comment


            #20
            In kludging together a way to position GPU particles as OP requested, I forgot to ask, why use particles at all? They have lots of unnecessary overhead if the particles are gonna sit still most of the time. It's possible to treat a static mesh composed of a stack of disjointed polygons the same way. I haven't fully tested the new system, but with 1 million particles, I was getting a dozen or so misplaced, and noticeable flickering. For some reason, moving the system further than 48576 units was causing my particles to disappear, so I had to reduce the spacing between them. I believe using a static mesh solves that problem.

            Tonight, I tested constructing images in Mathematica, and loading them into UE4 with DownloadImageFromURL to update a texture. I'll hook it up to the static point cloud tomorrow and put up an example project.

            Comment


              #21
              Didn't get as much done today as I'd hoped, but here's a big chunk of San Francisco.
              Click image for larger version

Name:	MillionsElev.jpg
Views:	1
Size:	469.7 KB
ID:	1111817
              Attached Files
              Last edited by xnihil0zer0; 07-11-2016, 01:05 AM.

              Comment


                #22
                Impressive result xnihil0zer0 !

                I see you also have color (heatmap by height ?), do you think it's possible to hook-up something to get rgb data ? Like one picture as a table with coordinates and another as a table with rgb values by point ?

                Comment


                  #23
                  Yep.
                  Click image for larger version

Name:	GoldenGateColored.jpg
Views:	1
Size:	548.5 KB
ID:	1111871
                  Click image for larger version

Name:	besancon.jpg
Views:	1
Size:	308.0 KB
ID:	1111886
                  Last edited by xnihil0zer0; 07-11-2016, 06:58 PM.

                  Comment


                    #24
                    Aha, this is looking very good. And you have 80 fps with this kind of point cloud.

                    I don't know if it's the lightening (or the absence of it ?) but it looks cartoonish.

                    Comment


                      #25
                      Hi

                      After 8 days of research, i see your Thread, and it can save me.

                      I am working on the same project than you. That's a very good work and i would to do the same.

                      In first way, i am not english, so sorry to my bad english, and i am only a graphist who code in blueprint

                      I use a .las and i open it in Cloud compare. Then i save in .csv.
                      Il my folder the .csv is a .txt. That's a problem, because i would use A-vekt https://www.avekt.com/Software/ImageCSV to convert in bmp.

                      do you have a solution to convert to bitmap ?

                      I like the city. Verywonderful


                      Thancks to help and sorry to my bad English again

                      Comment


                        #26
                        It seems awfully painfull to produce the picture you need with this software since you don't have any control on the output.

                        Anyway, you can export directly as .csv with CloudCompare, juste switch the extension from .txt to .csv when you save it.
                        And you can also change directly the extension of any preexisting textfile.
                        A .csv file is nothing more than a textfile with values seperated by a coma.

                        I didn't find a good online/free conversion tool to do this stuff. It may be possible to do it with R and a some image processing packages (I checked quickly and did not found it, but it has to exist somewhere in the CRAN repository) or maybe with ImageJ/FijiJ which is also a very good image processing tool.
                        I am doing it with Matlab and xnihil0zer0 is doing it with Wolfram Mathematica.


                        As soon as xnihil0zer0 can provide some explanations about his latest results I will do a step by step tutorial on youtube, from .las file to unreal engine.

                        Comment


                          #27
                          Okay thanks. I will test this, and i return my feed back

                          Comment


                            #28
                            I am trying to use Matlab to convert csv to bitmap, but i don't understand the process.

                            Comment


                              #29
                              as3ef2th1 i used your code example of Matlab, but i have two questions.

                              My data is big and matlab create a smaller selection. That's good ?

                              I don't know if my code it's good to run it, or it's not complet ?






                              thank you

                              Comment


                                #30
                                How many points do you have in your .las file ?

                                You should read more closely this post.

                                You need to decimate your point cloud such as the point count can fit a square texture:
                                - 16 384 points for a 128x128 texture (this is from my code snippet)
                                - 262 144 points for a 512x512 texture and so on...

                                Anyway it's useless to go beyond 200 000 points with the first example from the topic, since even with 24bits textures you can't have double big enough to store precise coordinates informations.
                                This is why your data will be likely to have line artefacts like the ones from Michael Geary's picture some post above.

                                At this point I would suggest you to wait for xnihil0zer0 explanation and update, it seems he has improved a lot this little "trick" for point cloud visualization.
                                Until then, I think it would be a waste of time to try to 'bruteforce' your data inside UE4.

                                By the way, I am also french (juste guessing from "point of cloud" !) so I will be able to explain this in french at some point if you want.

                                Comment

                                Working...
                                X