Translucent subtexture hiding parts of the same mesh

Hello,



I’ve run into an interesting render problem in my cube-based map editor (or voxel-based, if you prefer…)

I use a single mesh for the map geometry (All of which will be static outside the editor) and I map the textures from a texture atlas, whose sub-textures have varying translucency, with only two variants for now: Fully opaque and 75% opaque.



The things behind transparent blocks seem to be hidden from certain angles, and are visible from others.

Here is a screenshot looking towards the negative coordinates on all axes:

https://dl.dropbox.com/u/37297132/Showoff/BlockEd_3.png

Everything looks as I intend here.



Now here is another screenshot from the opposite side, looking towards the positive coordinates on the X and Z axes:

https://dl.dropbox.com/u/37297132/Showoff/BlockEd_4.png

As can be seen, all map geometry behind the transparent parts are invisible except for those closest few tiles directly below the lowest translucent blocks.



Here is another peculiar screenshot from a different angle without bloom so it’s easier to see:

https://dl.dropbox.com/u/37297132/Showoff/BlockEd_5.png



I’m using BlendMode.PremultAlpha on the material, but BlendMode.Alpha acts the same. Additive modes have the side effect of adding together fully opaque faces, which is probably because it’s one big mesh.

Whether I use Bucket.Transparent on the mesh or not, doesn’t seem to make a difference.



I reckon putting all the translucent blocks into a different mesh would solve part of the problem, but they would still obscure eachother from those angles.

I must be missing something here…

Can anyone enlighten me please?

You should not use the same mesh for opaque and semi transparent objects. They should each be in a geometry of their own, and those geometries should use different queue buckets. There’s info in the materials tutorial.

I finally got around to try what you suggested, but it didn’t work.

I’ve created a seperate mesh, seperate geometry and seperate material for the semi-transparent stuff, cancelled setting the opaque geometry to the blendmode of premultalpha and kept it for the transparent one, moved the transparent geometry to transparent bucket, and the opaque one to its own.



I tried disabling my optimizations to see if it was causing the issue, but no.

I’ve temporarily removed the opaque geometry and everything else besides the semi-transparent one, the issue still exists, it’s the transparent mesh/geometry that seems to block itself… very weird.

I’ve been running into a similar problem (partially transparent object blocking itself) - you need to turn off depth writing in the transparent objects to get it all to render - but that then causes more problems. I’ve not come up with a solution I like yet so anything you come up with I’d be interested to hear :slight_smile:

Semitransparent in that some pixels are opaque and some are transparent… or semitransparent meaning alpha is 50%? The second one has no general purpose solution if the objects cannot be sorted properly.

I meant the latter, so pixels with varied alpha levels. Well, luckily in my case, I can live without the textures being semi-transparent (translucent?).

Is there a way to change the opacity of a spatial by code by the way?

@dancso said:
I meant the latter, so pixels with varied alpha levels. Well, luckily in my case, I can live without the textures being semi-transparent (translucent?).
Is there a way to change the opacity of a spatial by code by the way?


It's entirely up to the material. Different materials will have different ways of adjusting this (if at all).