Trouble refreshing point cloud data generated from an greyscaled depth data video

hi, having a very hard time understanding why i cannot refresh frames within a video based point cloud scene i’m attempting to render.

im trying to build a point cloud according to a live greyscaled video feed im receiving with black being the furthest and white being the closest. Everything seems to be rendering well enough, i just CANNOT remove the previously rendered points each time i progress a frame.

Can anyone assist?
(the code , im sure could be more efficient, i suppose any suggestions regarding a better approach would be appreciated too)

VideoA3.html (7.0 KB)

me3|video

Solution:

moved line 127: var geometry = new THREE.BufferGeometry();
to line 40

added line 217: geometry.attributes.position.needsUpdate = true;

any advice gaining some efficiency would be appreciated still.

If you are updating your position attribute per frame, I suggest you define an appropriate usage pattern for the buffer data:

geometry.attributes.position.setUsage( THREE.DynamicDrawUsage );

THREE.DynamicDrawUsage hints the driver that the buffer data will frequently change. Defining this pattern will potentially enable buffer optimizations.

1 Like

i just remembered that i really wanted to credit the guy that had supplied most of this code im working within on the “reprojection” side of this data stream.

even though, im fairly familiar with the process, he put it in three.js terms for me.

now, “establishing a buffer data pattern”. hmm yes, I was thinking the some thing earlier. and as im working on the colors/positions portion as we speak i continue to see a smooth flow of frames and then a hiccup.

are you suggesting calling
geometry.attributes.position.setUsage( THREE.DynamicDrawUsage );

and then count the amount of points with z values > 0
and if they are < a pre determined amount i establish, to process “hidden” points until this array = the predetermined amount per frame?

for consistency’s sake?

edit:
ah yes. I understand now

lol.
I had JUST stumbled on this


and suddenly i remembered i owed both you,a thank you and gman some credit

and now i see we’re all on the same page

1 Like