Better transparency for concave shapes

If you put multiple semi-transparent parts next to each other and look at it from certain angles, you will notice that screen areas on which semi-transparent faces facing the camera overlap each other, the colors are added up.

Example ![c023f1d61191167b81ec9a5049591a70671f3fd8.png](upload://mat3rGiAkYXdFlsE1AVezqJOVA3.png)
For regular parts that system works perfectly fine because they are convex shapes. There are no angles at which multiple semi-transparent faces from the same BasePart facing the camera, share a same screen area. With meshes this is a different story though. Meshes can have complex shapes, so most meshes end up having a concave shape. This means that if you were to make those meshes semi-transparent, there will be angles at which certain faces from the same mesh facing the camera, share the same screen area. The current transparency rendering algorithm treats this overlap the same way as with multiple semi-transparent parts in a row. As a result, semi-transparent meshes will get rendered like this:

I truly dislike that result even though it might technically be correct. Because of the rendering algorithm, the areas with overlapping faces become darker, making the shape hard to read. It also makes it harder to distinguish individual semi-transparent BaseParts.

If possible, I would love it if this ‘additive’ rendering behavior could be disabled for semi-transparent faces from the same mesh. If it were to be disabled, the picture above would instead look something like this:

The latter result looks significantly better in my opinion, because it’s now easier to read the shape of the mesh. It also makes the screen look less chaotic.

What do you guys think?

Edit: As buildthomas pointed out, there are situations in which my suggestion might not be desired. Maybe an enum or boolean to toggle my suggested behavior per part would be better.

7 Likes

I think the way it’s done now only looks weird because you can’t see the inside edge of transparent shapes. So it seems like these weird dark spots come out of nowhere and have no origin, especially in places like this:

Edit: omg my cake day finally!!

Not sure I agree, I think this is situation/application-specific. Here’s somewhat of a counterexample:

846e3a7fd9c8162e0b5283a4be70c44be51da344.jpg

4ae7cf116c65b7b0faeac6434a8fe9087e7afda5.jpg

I think the first image makes it clearer that we’re dealing with a transparent red cylinder with a cylindrical hole, and the second seems like it could be a brown opaque part instead.

In your example mesh, you have the benefit that there are no faces being partially hidden that have the same surface normal to the contour that is hiding them. (i.e. the contour of the mesh is only against faces which have a different orientation)

6dc9e7802b3054b5346cfb2e39720535d070c0df.jpg

Additional explanation: the contour above of the mesh only hides the curvy bits of your “S”, so the transition is between a face that faces upward and a face that faces sideways. That’s why it looks good without the transparency artifacts in your example, but in my shape there is a transition between 2 faces with the same normal direction but displaced in depth.

So, there are examples where the shape/transparency is less clear to the viewer without additional scenery, if these “artifacts” would be removed.

2 Likes

Good points. I guess there are indeed situations in which the current behavior is more suitable.

Why not take the easy way out of this discussion and just have it be a boolean property?

As to the unhidden details in OP How to properly use Hide Details

Would it still be application-specific if transparent concave shapes ensured edges stuck out like this?

Can this be added as a boolean property to Models to have all parts inside render like this as a group?

Would be useful as it may fix a render error with my SWTOR import (maybe…?) where the shadow shows similar to that.

Take your current mesh, and duplicate it (within the same mesh) and flip the normals of all the copied tris. This might achieve something closer to the desired effect if I’m thinking about this right.

(Essentially making the tris “two sided”)

1 Like