Hi all
I’ve been working on getting the ZED camera point cloud into Unity’s VFX Graph by feeding it data via Graphics.Blit()
from the ZED SDK’s GPU textures (XYZ, Color, and Confidence). The textures are copied into intermediate RenderTexture
s and passed to the graph as exposed Texture2D
properties like this:
in the ZEDPointCloudManager component provided by Stereolabs i do
public RenderTexture XYZTextureCopy;
vfx.SetTexture("XYZTex", pointCloudManager.XYZTextureCopy);
then I trigger the texture copy in LateUpdate()
like this:
if (XYZTexture != null && XYZTextureCopy != null)
{
Graphics.Blit(XYZTexture, XYZTextureCopy);
}
This is my VFX Graph
Output
this is the original pointcloud as reference and the VFX Graph pointcloud layed on top
Setup Details
- Unity 6000.0.44f1
- ZED SDK 5.0.3
- CUDA 12.0
What Works
- The pipeline technically works: I see particles in the VFX Graph positioned via
ParticleID → UV → Sample XYZTex
- Color and Confidence sampling also works when wired into the graph
- I verified the XYZ values with a manual
ReadPixels()
readback — data seems valid when read
What’s Not Working
- I get severe flickering in the point cloud in VFX Graph
- Large portions of the cloud randomly disappear
- Meanwhile, the native rendering using the same texture directly with
Graphics.DrawProceduralNow()
inOnRenderObject()
is totally stable
My Main Questions
-
Is it possible that
Graphics.Blit()
copies the texture while ZED is still writing to it?- Could this cause the VFX Graph to sample from an incomplete or zeroed region?
-
What’s the right way to safely duplicate a ZED GPU texture for use in VFX Graph?
- Should I be double-buffering? Using
CommandBuffer
? OrAsyncGPUReadback
?
- Should I be double-buffering? Using
-
Why is
DrawProceduralNow()
stable, while the VFX Graph version flickers — even though both use the same texture source? -
Is there any kind of GPU synchronization mechanism I’m missing?
If anyone has successfully brought ZED point clouds into VFX Graph without this kind of visual instability, I’d love to hear how you managed it. Could really use insight on how to safely hand off those textures across frames.
Thanks a lot in advance!
Sebastian