Hi all,
Is it possible to define a material/object somehow so that the object itself is not visible, but it still occludes other objects that are behind it?
Reason: I have a lovely BoxMap, the bottom of which is a flat ocean surface. I want objects to move up and down into the ocean, with the “submerged” parts being invisible. Currently I have a large plane that sort-of duplicates the bottom of the ocean, but I’m having trouble making the texture of the plane line up seamlessly with the bottom of the boxmap. Ideally I’d just like the plane to occlude objects behind it, but not render any surface of its own, so that the bottom of the boxmap is always visible. Does that make sense? Oh well…
As always, thanks in advance for any hints.
Jon
I dont understand?
You want a invisible transparent object, that makes sure nothing behind gets shown, so far so good, but at the bottom part I lost what you try to archive
Haha, sorry! I just re-read my post and I don’t blame you!
Here…
http://i1047.photobucket.com/albums/b480/CookieJonathan/test2.jpg
I’d like to occlude parts of objects below “sea-level”. I’m achieving that at the moment with a plane (dark blue), but I’d like the background of my SkyBox (light blue) to display through so that I don’t have to replicate the texture of the SkyBox sea on the plane that I’m using to hide the “submerged” parts of objects.
Ideally, I’d like the plane to occlude objects like the cylinder, but still show the skybox background behind it.
Does that make more sense?
You can do it with some trickery.
You just have to make sure your plane is always the first thing drawn. The simplest way might be to leave it in the opaque bucket but register your own GeometryComparator that always sorts your object to be drawn first.
Then set it to a transparent color and set the blend mode to alpha. If it’s the first thing drawn then it will appropriately fill the Z buffer with the right depth but won’t actually draw anything.
Ah hah… I thought it might involve “trickery”
I’ll give your suggestion a whirl, and let you know. Thanks!
Note: you might also be able to do it by rendering your water in a pre-viewport and making sure that the main viewports don’t clear.
I thought the geometry comparator approach might be less magic-like, though.
Just to make sure you are not trying to reinvent the wheel, you know about simplewater and just don’t want to use it? If not and you just search for a simple way to get a water effect its probably a better choice.
Yeah thanks EmpirePhoenix…
I checked out the SimpleWater demo, but as I’m going for a “cartoony” look, and as it’s destined for Android (well… that’s the plan!) I think water with reflections & ripples might be pushing it a bit.
Cheers,
Jon.
pspeed wrote:
You just have to make sure your plane is always the first thing drawn.
The simplest way might be to leave it in the opaque bucket but register
your own GeometryComparator that always sorts your object to be drawn
first.
Then set it to a transparent color and set the
blend mode to alpha. If it’s the first thing drawn then it will
appropriately fill the Z buffer with the right depth but won’t actually
draw anything.
Hi pspeed, I know this is quite old, but it is what I am looking for. Could you please explain your answer? I don’t know where to start. I too need to occlude objects with invisible objects (using a point cloud for occlusion).
Do I understand this right? I sort my object to be rendered first and let it opaque, than (after it filled the z buffer) make it transparent and repeat for every new render loop? But where do I have to do this?
Every help is very apreciated,
thanks for your time
Greetings,
Gem
What is the effect you are actually trying to achieve?
thanks for your quick reply. I have a point cloud from the Google Tango. And I want to use it to occlude digital objects with the depth information of real objects (e.g. for AR). First I thought I should mesh the points together, but that would be bad for a real time app. Second thought was to build a heightmap from the point cloud and use it as the z buffer (i have opened another thread for this), third was using a shader.
But I guess the most simple procedure would be to place boxes where the points are, so objects behind them are occluded, but make the point cloud boxes invisible. Hope it is understandable, what I mean (english is not my native lang. ^^")
looking forward to hear what you think.
Thanks,
Gem
Sounds like you could just render points (or point sprites) with depth write turned on.
Bringing this to a conclusion in this thread - thanks everyone! How to create a custom dynamic z buffer