Textures Seemingly Randomly Defy Transparency

I have a fairly simple system involving covering all faces of all parts of a model in a flat texture to accomplish a highlighting and damage flashing system by making them slightly translucent as needed. Most of the time this works fine, however, seemingly randomly, this system breaks on random parts either displaying a fully visible texture when its transparency is still set to 1, or obeying when transparency is 1 and being transparent but becoming fully visible once its set to any number below. Here’s an example of what I mean:

As you can see, the textures are rendering as fully visible despite the transparency being set to .75. This problem can even occur with a transparency of 1, but seemingly randomly doesn’t in this case. That one typically happens on the heads of NPCs.

This initially seemed like perhaps a bug with how textures render on certain parts in general, however when taking the very same model and applying the same textures to the same parts with any transparency in studio, the problem isn’t present.

I first encountered this problem on NPC heads where a texture would be cloned in with a transparency of 1 but would always be visible still. I’m assuming this is some sort of engine bug, however seeing as I can’t reliably figure out the specific cause nor can I post in that section, I figured I’d post here and see if anyone has encountered this problem and found ways to work around it in the meantime.

If the specific implementation matters, I’m essentially calling a function whenever a ServerNPC tagged instance is added to create the NPC on a client by client basis. When it’s created, the six selection/damage textures are cloned onto each basepart of the model with their transparencies already set at 1. For the damage flash this is tweened to .5 and back, and for selection it’s simply set to I believe .75.

In the last two examples you mentioned new instances and cloning. Have you checked to see if it’s a client/server replication problem? Or perhaps you are adjusting the transparency of the original, not the clone?

There’s no client/server replication (atleast in the traditional let roblox handle it however sort of way) being done as the NPC instances are created on the Client, the server only holds a representation of them holding the true data about it such as its health, location, etc whereas each client has their own representative model of its cosmetic features. It’s also definitely modifying the actual transparency of the target texture, as shown in the first image its property is set correctly to the .75 transparency, however despite that it renders it as though it was a transparency of 0.

I have run across the bug where a running render doesn’t operate the same as studio. But not on transparency. I report those bugs!

Here’s what I see: You have multiple textures. Presumably white is default, and you reduce transparency to reveal yellow underneath?

Maybe I reproduced the error? 2 textures, all at partial transparency works fine. Turning one of them all the way to 1 or 0 produces unpredictable effects if I don’t set a zindex (higher number on top).

I recommend trying setting white to zindex 1, transparency 0. Leave it alone because you don’t want the whole model invisible. Mess with yellow instead. Zindex 2 or higher, and reduce transparency from 1 to 0.5 (making it partially visible instead of partially invisible). Seems like the safer programming route.

I’ll definitely be reporting this one via messaging them but sadly can’t create a topic on it or anything and now I’m not so sure that this isn’t simply intended behavior. You’re mostly correct in the idea of the setup being to have a transparent texture who is made slightly visible as needed to layer the color on top. It just uses the brick color or meshtexture underneath to overlay on top of however giving a sort of white highlight effect to the model, so there’s only ever one texture on one face being displayed.

I’ve figured out how to reliably reproduce the issue though and it’s cause was quite obvious but leads to more questions than answers. It happens only on meshparts or parts containing a mesh where it seemingly always ignores texture transparency unless it’s a one. The odd part to me is it’s fairly regular practice to use transparent textures on mesh parts, however this only works if they’re set up in studio at runtime like that. Applying the same textures with the same transparency to the same meshes through code won’t support transparency like it would from studio. Furthermore, setting the mesh’s transparency itself to a non 0 value will suddenly make the textures begin obeying their transparency.

1 Like