MaterialService supporting Alpha on Textures

There is a limitation on MaterialService materials where it doesn’t allow the albedo texture to have any form of transparency. This means specific see-through materials like glass, gates, wire fences, etc… Can’t use MaterialVariants.

Now it is possible to use a SurfaceAppearance as a workaround, but that requires specific UVs to be baked in for every specific mesh using it.

The other option would be using a Texture instance, which has its own limitations: such as only really working on a flat surface and also does not allow PBR materials to work with it.

Image of a poor wire fence that cannot get the full range of PBR textures

32 Likes

It would be better to have another map called Opacity Map added to both Surface Appearance and Material Variants.

2 Likes

I’d argue against this since SurfaceAppearance already supports Alpha in the ColorMap as mentioned by the OP. It should remain connected to the ColorMap

1 Like

And you have to make ColorMaps transparent using OpacityMaps if they aren’t already.

4 Likes

Images typically come with 4 channels: RGB and Alpha. This is already embedded by default in all PNG images uploaded to Roblox. Using a separate image with … another 4 channels, just to encompass the Alpha channel is quite simply nonsense. It would just be processed away and encoded differently. Using the A in RGBA is functionally the same and more friendly for content authoring. An approach similar to SurfaceAppearance with different opacity modes would be fine.

3 Likes

PNG takes up more space with Transparency. Instead of using PNG for ColorMap you can use JPG for all of them and import a larger ColorMap file. A higher resolution Color Map even thought Roblox’s Limit is 2048 is then Down Sampled creating even more detail. Its like watching a 4k video on a 1080p monitor, you still get more detail. JPG Opacity Map is easier than adding transparency by using the eraser and also saves import time.

I think you’re making a lot of bad assumptions, sorry. A whole extra JPG is a lot larger than just using the alpha bytes currently unused in the colormap PNG, and it wouldn’t be stored that way behind the scenes anyway. The only use case for a user-facing opacity map is to have the two at different resolutions to save on some memory when you have opacity requirements that can be reasonably met at low resolution (e.g. all the same value, borders, sharp grid-aligned edges, etc.), but this is quite niche, and the majority use-cases can probably be automated behind the scenes with a compression algorithm.

Also want to mention, the format you upload images in on Roblox does not matter, It’s converted and stored behind the scenes in the CDN as PNG. You can confirm this yourself by using the assetdelivery API.

Also, SurfaceAppearance already does its own compression, and can likely make much smarter assumptions about how it can compress than by using a nasty lossy image format. SurfaceAppearance uploads its own unique asset type every time you change the image fields in Studio with this compressed content.

This is a no brainer. SurfaceAppearance is already doing it properly.

Also, if making an image with transparency is too hard for you, you need to figure out your tooling. This has been a solved problem for decades.

3 Likes

SurfaceAppearance is incredibly limited, as it does not allow a Color3 value on textures.

I thought I should point this out, as it’s a much-needed feature.

2 Likes

This is not relevant. That is a separate feature request.

The problem is that Roblox removes transparency on uploaded PNG and JPG files (as far as I know) when applied to a part. This is why you can’t set the maps to local files since they have alpha bits. However, Roblox can actually satisfy this feature as meshes do support textures with alpha bits on local files.

In addition to this, SurfaceAppearance does not allow for proper refraction.

Going to revive this with the hopes it sees some attention. Material Variants really should not treat White as Alpha. Not only is this inconsistent with any other texture type that supports alpha channels, but it also causes all our material variants to be darker than we intend.

Additionally, if your material variant is just white with an alpha background (like if I wanted to add a dusting of snow or something), it results in a blank material which is functionally useless?

Bumping this again because all the other solutions have stupid drawbacks (SurfaceAppearance doesnt have tiling, textures dont have pbr, etc).

It’s stupid that I have to manually tile things with a surface appearance if I want transparency.

bumping, this completely destroyed my only intended use case.
(replacing transparent textures on baseparts with a materialvariant, as having 340,931 texture instances is too expensive)

EDIT: I found out it works if you lerp between white and the albedo’s color :man_facepalming:

EDIT2: now i found out that it depends on graphics quality, and on low graphics its not transparent at all :no_mouth: