C# Make geometry disappear in front of player if he gets too close? (VR)

Recommended Posts

I'm developing a game in Unity for the HTC Vive where I need to make 3D geometry disappear in front of the player if he gets too close so there isn't a weird moment where he is in front of a wall and then suddenly looking inside it. A transition of sorts.

But I also don't want the whole wall/object to disappear, rather just the part the player is moving through...

This is basically what I want to do, but in a different context. Does anyone have any idea how it's done?

Share this post


Link to post
Share on other sites

That game seems like it's probably using a shader that's reading depth (and possibly also incorporating distance from center of camera as well) and blending between (normal texture -> magical sparkly texture -> fully transparent) at different depth (or distance) thresholds.

Edited by Nypyren

Share this post


Link to post
Share on other sites

It seems like what we did in a prototype for our grass renderer. The grass faded out starting at certain distance to create a smooth vegetation effect using a simple shader and <PlayerPosition> to <VertexPosition> calculation. The result was clamped into certain range and then appended to the alpha channel.

Nypyren mentioned, this seems like a texture blend so the same approach as with out grass renderer would need just a little update to the textures color channel.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now