3 Replies Latest reply on Aug 14, 2018 2:15 PM by mcdopsa

    Unity Pointcloud Point Size

    mcdopsa

      This may be a Unity issue more than a Realsense SDK 2.0 issue, but I have not found any way to increase the size of each point in the editor / viewer.

       

      Is this possible in Unity like it is in Meshlab?

      I know each point is a single x,y,z and may not inherently have it's own 'size,' but for example when zooming closer to that location, the points become so small and dispersed that it is no longer possible to distinguish an image.

       

      I've tried looking into Unity's settings, the script, Material shader, etc with no success.

       

      Using:

      W10

      Unity 2018

      RS D415

       

       

      Thanks!

      Mike

        • 1. Re: Unity Pointcloud Point Size
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Mike,

          Thank you for your interest in Intel® RealSense™ Technology.

          For this question, we recommend you to use Unity forums because it is more relevant to Unity than to the Intel® RealSense™ Technology.

          Best regards,
          George

          • 2. Re: Unity Pointcloud Point Size
            mcdopsa

            Hi George,

             

            The current versions of Intel's Realsense SDK for Unity contains all of it's own parameters within the C# scripts, and does not rely on an external Unity Event System or Particle Generator in the editor. It is wholly self-contained.

             

            By your statement you are effectively stating that there are no correlated methods, values, objects or lines of code in the Realsense SDK 2.0's Unity wrapper, that have an impact on the point cloud generation, it's size, or the ability to tweak the attributes of the point cloud. Can you please confirm this?

             

            If confirmed, that would mean the script PointCloudGenerator.cs is relying on some point cloud system built into Unity or another dependency. Can you please let me know what system within Unity the SDK is relying on?

            • 3. Re: Unity Pointcloud Point Size
              mcdopsa

              I have resolved this issue, as expected it was capable to modify point size from within the RealSense SDK scripts itself, and was not inherently a Unity issue.

               

              For the curious:

              A recent update to the Realsense 2.0 SDK included a new point cloud shader, with a public variable 'Point size' defaulted to 4. This is only functional by changing Graphics API to GL, by going to Edit > Project Settings> Player. For me, I had to disable 'Auto API,' and remove the DX11/12, to replace it with OpenGL Core.

               

              My project is using a derivative of the Realsense SDK (called Extended Realsense), which includes an older point cloud shader that does not allow point size change. Many of the component and method names are different in 'Extended Realsense' so importing the new shader AS-IS would not be compatible. Thankfully, the two shaders share a very similar structure, so it simply required carrying a few lines of code over to make it work.

               

              In Properties, I added:

              _PointSize("Point Size (GL only)", Float) = 4.0
              

               

              in 'struct v2f' I added:

              float size : PSIZE;
              

               

              After 'struct v2f' and before 'v2f getVertexOut()' I added:

              float _PointSize;
              

               

              Finally in 'v2f getVertexOut() ...' I added:

              o.size = _PointSize;
              

               

              That's it! Now I can select point size on my point cloud shader (even works at runtime).

              pcbad (2).pngpcgood (2).png

              1 of 1 people found this helpful