I’m trying to hide 3D objects using a texture. I want only few pixels ( segmented pixels) to occlude the 3D behind it.
For example in below image I have a black and white texture where I’d want the white part of the texture to occlude any 3D behind it. Black and white colors are just for representation . In reality, the white pixels would be transparent but will hide anything behind it (occlusion) whereas the black pixels would also be transparent but will not hide anything behind it, i.e., it won’t render anything.
I have used occlusion shaders in the past on 3D objects which works just fine but in this case i want to use occlusion using only certain pixels of a texture.
I have looked into stencil buffers and assuming my understanding is right, it involves setting the stencil buffer on the objects that needs to be occluded( cube). However, I have no control over the 3D objects since they are AR assets that are downloaded dynamically. So I cannot edit the shader code running on those objects.
I’m also very new into shader programming.
