As a Roblox developer, it’s currently difficult to use textures, decals, particles, SurfaceGUIs, and similar images, as well as transparent geometry, because transparent objects do not stack correctly.
Partially transparent solids are difficult to render, because a “depth test” cannot be used, since distant objects must remain visible behind closer, transparent objects. To solve this, you can apply the “painter’s algorithm” and render objects from back to front. Roblox currently attempts to do this with transparent objects – including all decals, SurfaceGUIs, textures, and particles.
However, this approach doesn’t always work, because it’s hard (impossible, in general) to predict which objects need to be drawn in front. As a result, Roblox gets it wrong sometimes:
However, the difficult case only happens when the materials are partially transparent. For example, in the above image, we could just render the opaque part of the texture using the normal depth-test, and not rely on sorting the objects in the correct order.
I propose the addition of a new property to the objects that currently suffer from this (transparent BaseParts, Decals, Textures, SurfaceGuis, ParticleEmitters, etc), TransparencyMode
.
The most essential modes would be
-
Standard
, which is the current behavior and supports alpha values that aren’t 0 or 1. -
Binary
, which treats all pixels that are not opaque as invisible. This would be the setting used to solve the above gif, since the bush texture doesn’t (meaningfully) use partially transparent pieces.
In addition, it would be nice to (eventually) have a more powerful middle-ground choice:
-
Dither
, which would use a Bayer matrix (or halftoning or similar) to determine whether or not a pixel of a given alpha value should be present or absent. This would be useful for fixing the ordering of transparent geometry (though it has some kind of artifact which won’t be suitable for all cases). It may be necessary to have multiple Dithered options, so that different layers of geometry that should stack don’t correlate too much. It would also work for providing partially transparent textures at a much higher quality than can be gotten from doing the dithering in the texture itself (since as the texture got closer to the screen the matrix’ pixels would not get bigger).
My understanding is that most games nowadays use dithered transparency for most of the transparent geometry in them. It would be great if Roblox could support this too so that it becomes possible to use transparent textures.