Sign in to follow this  
Kiel368

Unity Transparency problem in voxel terrain!

Recommended Posts

Kiel368    239

Hi!

I'm working in unity3D and trying to make glass in my voxel engine. I enabled alpha blending, but it resulted in voxels with solid textures also being transparent!
How to make transparent textures properly? Can one mesh be transparent and solid at once or I have to create a dedicated mesh for transparent materials? (World is divided in regions, each one has its terrain mesh) confused.pngconfused.pngconfused.png

 

Thanks for your help.

Share this post


Link to post
Share on other sites
cr88192    1570

not sure about the specifics of Unity 3D, but in general:

draw solid geometry first;

then draw transparent geometry in back-to-front order.

 

generally, yes, solid geometry and transparent geometry are kept separate.

 

 

in my engine, the chunks with transparent geometry are essentially sorted by their distance from the camera, then transparent geometry is drawn with the furthest chunks drawn first.

this seems to mostly work.

 

a few things are also drawn with depth-writes disabled, which also has sometimes "interesting" side-effects, but is needed to help reduce problems with intersecting geometry causing ugly self-clipping artifacts. if transparent geometry is drawn in-general this way, rather than out-of-order drawing resulting in things being not-drawn, it will result in blending issues. usually, the blending issues are slightly less ugly though.

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

Sign in to follow this