Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render PointCloud in Unity using SoftwareDevice #9588

Closed
ghost opened this issue Aug 9, 2021 · 7 comments
Closed

Render PointCloud in Unity using SoftwareDevice #9588

ghost opened this issue Aug 9, 2021 · 7 comments

Comments

@ghost
Copy link

ghost commented Aug 9, 2021


Required Info
Camera Model { L515 }
Firmware Version 01.05.05.00
Operating System & Version Win 10
Platform PC
SDK Version 2.47.0
Language Unity

I have setup a SoftwareDevice that receives raw depth and color frames over the network and uses a modified event system of the RealSense PointCloudColorAndDepth sample provided as part of the RealSense package. I'm able to receive the frames and render the pointcloud but the color texture does not get applied on to the pointcloud. The UV map field of the PointCloudGeom shader does not update (is black). Can someone please point me in the right direction?

Image attached for reference :

image

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 9, 2021

Hi @abhijaysingh In the link below, a RealSense Unity user also had a problem with getting the point cloud to display correctly on an adaptation of the PointCloudDepthAndColor sample scene. They found that changing the selected shader on PointCloudMat from 'Custom/PointCloudGeom' to the Custom/Pointcloud shader resolved the problem.

#4155 (comment)

image

@ghost
Copy link
Author

ghost commented Aug 9, 2021

Hi @MartyG-RealSense Thanks for the swift response. I had tried changing the shader earlier as well but the issue persists. The UV Map field is black even with the shader set to Custom/PointCloud. Is it something related to loading the raw texture data from Points (https://github.com/IntelRealSense/librealsense/blob/master/wrappers/csharp/Intel.RealSense/Frames/Points.cs)?

@MartyG-RealSense
Copy link
Collaborator

In the RealSense Unity wrapper, camera data is converted into a mat so that it can be rendered. I can see in the PointCloudMat panel of the Inspector that a color image is being received.

I find that in Unity, if a texture will not display correctly then simply selecting Unity's default Standard shader from the shader list will often render it. Have you tried Standard, please?

@ghost
Copy link
Author

ghost commented Aug 9, 2021

Thank you, @MartyG-RealSense! It worked but the texture has a blue tint to it and the texture coordinates are not right.

I require exact depth to texture mapping for the application and the Standard shader doesn't map the UV to texture coords.

image

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 9, 2021

Are you able to achieve depth-color alignment if you add an RsAlign component to your point cloud project if you are not using one already, like in the recent RealSense Unity wrapper pointcloud align project in the link below?

#9263 (comment)

image

@ghost
Copy link
Author

ghost commented Aug 9, 2021

It's working!

Thanks a lot @MartyG-RealSense!!

@ghost ghost closed this as completed Aug 9, 2021
@MartyG-RealSense
Copy link
Collaborator

That's great news @abhijaysingh - you are very welcome :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant