I am working with Google’s Project Tango for my Bachelor Thesis. Now I want to use the point clouds it produces to update a Z-Buffer dynamically. Thereby I hope to occlude digital objects with real objects for better depth perception in Augmented Reality. After days of nearly giving up I managed to transform the point clouds correctly so they are displayed in JME3. My problem is, I don’t even know how to get started with that z-buffer thing. I guess it is not a good idea to use Open GL methods directly from JME3.
What I try to do is:
create new z-buffer
load z-buffer with z-values, calculated from distance of cloud point and camera plane
occlude 3d objects with z-buffer
Hope someone can help me, or at least, point me in the right direction.
Just render the point cloud with depth and it will fill the z buffer. Use points sprites if you want the points to have a larger size. You may also want to sort them back to front but for square point sprites it shouldn’t matter. (Or you can set the point size larger I guess… never tried it.)
Thanks, that sounds good. I just changed the point size to 5 and will try if it’s enough.
But I can’t figure out how to make the point cloud invisible after filling the z buffer. Somehow I must get noticed, when rendering to the z buffer is finished and then remove it from the scene and add it in the next render cycle again, or not? How can I do this. Can’t find anything in the wiki or somewhere else. Your help is very appreciated.
His issue is not hiding the render… it’s getting the points to render bigger. So it has nothing to do with setColorWrite(false).
Using the point cloud material requires more setup because it expects other buffers, I guess. Size and so on. You may have to dig into the particle emitter to see what other material parameters it sets. I’ve done it but I don’t remember exactly what I did.
The nice thing about point sprites is that you can make them bigger as they get closer to the eye (up to a point)… but there is more setup involved.
There was a test point cloud example that renders a cloud of smoke blobs. You could trace down through the code to see what it sets up on the mesh and material. I also remember some magic “Quadratic” float that controls how the particles shrink/grow with distance.