Invisible material that blocks (masks) whatever is behind it ?

In Doom 3, there is a “nodraw” material. Any part of the static/skeletal mesh that has such material will not be rendered (so if you have 100k tris mesh, and 90k tris have that material, only 10k tris will be rendered).

Is it possible to have such material in UE4, but also have it mask anything behind it? (for example, if you have a cube with such material between player’s or cinematic camera and a sphere, you would see sphere with cube “cut out” from it)

It should be mobile friendly (no post processing?) :slight_smile:

How would I be able to achieve such effect? Thanks.

You could do this by using “render in custom depth pass” on your object and then reading the custom depth in other materials to mask them. Unfortunately it will only work for translucent materials and it will not actually save any performance; in fact, it will make performance worse since masked materials are most expensive where the mask makes them see through.

Oh, that’s not good :frowning:

The idea was to have backgrounds pre-rendered, and also have invisible copy of the level-background in the scene (although low-poly). So in mobile VR, we’d have stereo skybox, invisible masking static mesh of the level and effects/characters. So effects and characters would be masked by the static mesh and it would look as if the characters and effects existed in the actual highly detailed map. Something like what old school games like Alone in the Dark did back in the days. This approach would work with phasing locomotion only and would require stereo skybox for each location where player would teleport.

Is there any solution for my task or should I just go with conventional level design for mobile VR ?

I think there is a way to do what you want, but I don’t yet understand why you are trying to do this. What advantage does rendering what seems to be an oldschool skybox in a secondary location have?

is your lowpoly background geometry just used for depth compositing purposes or something, so you can bake more expensive detail into your baked backgrounds and then blend them using a proxy?

If so, I would probably instead of masking the characters, I would simply bake your background images and place them in front of your characters. Then you can use your depth only low poly scene to render the custom depth and look up custom depth in the ‘background’ materials. Then make them invisible where they are behind the characters (either using translucency alpha or pixel depth offset). Basically doing the same thing just in reverse.

The old school skybox can be stereo, which will make it look like actual geometry and not flat skybox. So I could make environment with millions of polygons, render it into stereo skybox and player would end thinking (s)he is at actual location and not in an empty scene surrounded by the stereo skybox :slight_smile: (stereo effect will break when they tilt their head left or right, but when playing a game that breakage is ignored; unless it’s another developer/journalist looking to expose flaws of the product :rolleyes: )

The budge of Gear VR is 100k tris and ~60 drawcalls. Having 100k tris for characters alone is a good thing, while environments can be rendered to the skybox. That’s the whole purpose of this approach.

The tricky part is how to make characters go behind columns or into doors, when those architectural elements are rendered and don’t actually exists. That’s where invisible low poly copy of the architecture that was rendered to skybox come to play.

I could probably render a short video in Blender explaining it better, if only this approach yield better or equal performance to regular approach with conventional art (everything is a geometry within set poly/drawcall budget).

ok. I think my last suggestion will still work rendering the skybox on top of the characters and masking where they need to be visible.

But I am still not seeing what advantage compositing this as a skybox has at all. You could simply bake your super detailed background onto your lowpoly geometry and then actually have the geometry be in the same physical space as your characters and it will be stereo an as optimized as your lowpoly assets. But do whatever works for you.

Well, if there was no tight drawcalls/polybudget, I could. But you can only do so much with 100k total tris count. And in VR, you can’t make it look good using normal maps for medium to larger details, not to mention vegetation.

In other words, you can’t have Kite-like environment in VR using conventional approach. However, you can (theoretically for now :slight_smile: ) with the approach I am thinking about, as long as this approach doesn’t result in using post processing and massive amount of drawcalls.

Are there any tutorials/docs about rendering skybox/skysphere in front of the scene and masking it?

I think you are missing one of the points I was trying to make with baking stuff. We are both talking about baking your skybox to simple geo with proxy geometry. I am simply talking about physically placing the proxy geometry in front of your characters rather than behind. There is no difference in perf for what I am suggesting.

Then I am also making the further point that if the skybox is baked to simply proxy geometry, it doesn’t really matter if you composite it in using tricks (which means both your original idea of having it behind and my suggestion of having it in front, both are the same so far other than implementation) or simply have the proxy geometry exist in the same physical space as the character. You can still do the same level of baking that you were talking about doing. I am just not seeing what benefit if any the compositing stage has here. Its the same proxy geo, same baking, just a matter of how its placed in the scene.

I don’t know of any pre existing tutorials for exactly this. But you can easily find some tutorials on custom depth.http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/

Ohh, you lost me there :frowning: What is proxy geometry and how would you bake rich in details environment to that proxy geometry so it doesn’t look like a low poly mesh with baked on texture ?

Here is what I made (stereo panoramas): StereoVR - Google Drive

and here is how it would look in UE4 (disregard selected static mesh): ss2 dev stream - YouTube

I glanced at that article you linked and this is exactly what I had in mind: http://i0.wp.com/www.tomlooman.com/wp-content/uploads/2014/09/showingoverlappingissue.jpg?w=640 (figure on the background on the left side of the image). Except I’d like for the front blocking figure to be completely invisible and potentially not add to polybudget in the scene (if that’s possible at all).

proxy geometry is just any low poly geometry that you map your baked images onto. You mentioned this yourself here:

“and also have invisible copy of the level-background in the scene (although low-poly).”

if these are stereo panoramas, that means you already have one rendered from each perspective right? If so maybe you don’t need the lowpoly geo at all. Perhaps you can simply render out panoramas that contain depth and then use a simple sphere for your cubemap and use the depth texture to sort.

You can make the background translucent and use a material option called “disable depth test” so that it renders on top if everything and you have to sort it manually using opacity. I think this may be your easiest option. if you have a way to swap cubemaps for each eye you can do the same for the depths to avoid needing geo and then there will be less approximation in your depth comparison.