librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Bad performance with RealSense rendering PointClouds in Unity

Open nachoreimat opened this issue 8 years ago • 9 comments

Required Info
Camera Model D415
Firmware Version 05.09.11.0.0
Operating System & Version {Win 10
Platform PC, i7, gtx1070
SDK Version 2.12.0
Language C#/unity

Issue Description

Bad performance with RealSense rendering PointClouds in Unity. Lag is very high and frames per second falls when increasing resolution.

Dear all, I have been doing some tests of rendering PointClouds in Unity using the Unity wrapper code that comes with the RealSense SDK. My purpose is to do a high quality photo-realistic and real-time rendering for a VR application, so the lag should be close to 10ms and a high frame-rate.

Those tests gave me very bad performance in terms of Lag and Fps. Let me show you:

Resolution FPS LAG(ms)
640x480 19 241
848x480 14 326
1280x720 4 545
1920x1080(RGB) 2 983

(I was setting the stream to be 30fps in all of the tests.)

I don't know where is the bottle neck. Is it in the align step? maybe in the Particle System used to render it?

Anyone achieved highest quality with good performance? I would appreciate any hint/help.

Thanks in advance

nachoreimat avatar Jun 26 '18 10:06 nachoreimat

I believe this is due to using particle-system for pointcloud rendering. We are planning to add mesh-based solution with the geometry being modified in a shader.

dorodnic avatar Jun 26 '18 15:06 dorodnic

Good, I am also trying to render it with another technique. I will report my findings Please keep me updated.

Thanks

nachoreimat avatar Jun 26 '18 15:06 nachoreimat

[Realsense Customer Engineering Team Comment] Hi @nachoreimat,

I am interested if you have any findings so far?

I had a similar issue a while back using the Kinect and rendering depth information. I had much better performance by using the depth texture as an input to a vertex shader and manipulating a mesh that way. Essentially a dynamic height map. Went from 7fps in the kinect sample to 80fps. You could do the same thing with this. I had custom built the height map mesh in script so there was one vert per pixel.

jaredgaul avatar Jul 10 '18 19:07 jaredgaul

A mesh-based solution is available on release 2.14.0

matkatz avatar Jul 24 '18 12:07 matkatz

[Realsense Customer Engineering Team Comment] Hi @nachoreimat,

As @matkatz1 mentioned, please check librealsense 2.14.0 to see how it improves the performance.

[Realsense Customer Engineering Team Comment] Hi @nachoreimat,

any update?

[Realsense Customer Engineering Team Comment] Since the performance should be improved, will close this. If any further question, you still can re-open or create another ticket.

Hi all, Sorry for the delayed answer, I've been busy and then some holidays.

Yes, we implemented a solution based on the geometry shader and the performance increased. Our current solution is very close to the mesh based solution you uploaded on the version 2.14.0 so we can say we both are in the good direction. Your new mesh based solution works really good and it keeps constant at 60fps. Good job! Thanks

nachoreimat avatar Aug 06 '18 11:08 nachoreimat