- Home /
Kinect Usermap Display Performance Problem
Hi, currently i am developing a dancing game using Unity and OpenNI and what i want in gameplay is to show player's silhouette.
I use Marshal.Copy to copy LabelMap to array and apply it to texture:
Marshal.Copy(metadata.LabelMapPtr, rawUserMap, 0, rawUserMap.Length);
then check every pixel on rawUserMap whether it's user body or background (i need to copy the data to additional Color[] array as final texture)
finally i apply the final texture on Texture2D
tex2D.SetPixel32(finalTexture);
tex2D.Apply();
This approach is too slow, for 320x280 depth map the FPS is stable on around 50-55 FPS but when i use 640X480 depth map it slows down to 11-13 FPS
640x480 resolution means 307,200 pixels and i need to copy every of them to Color[] array (in every Update cycle, of course) but this massive data and large array copying is not the actual problem (they're fast on my laptop though) so the real problem is on tex2D.SetPixel32(finalTexture); and tex2D.Apply(); which are slow as hell.
Others said there's a trick to render this directly on GPU but i still don't know how to do it and i need to do some more research.
Hi, I dont have the answer but I want to do same thing. I need to display usermap on screen using kinect....can you share with me the solution....I have a very tight deadline and I am new to unity. I would be very grateful to you as fellow programmer.