Items with no label
3335 Discussions

Unity Pointcloud Point Size

MDops
Novice
3,623 Views

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

0 Kudos
1 Solution
MDops
Novice
2,163 Views

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 https://github.com/ajingu/RealSense 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).

View solution in original post

3 Replies
idata
Employee
2,163 Views

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
0 Kudos
MDops
Novice
2,163 Views

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?

0 Kudos
MDops
Novice
2,164 Views

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 https://github.com/ajingu/RealSense 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).

Reply