Support per-vertex transparency in MeshParts

As a Roblox developer it is currently impossible to blend repeating textures together with arbitrary seams unless the texture is pre-baked as such onto the MeshPart.

I’ve been working for the past month on a tool that can port Source engine levels into Roblox. While it works pretty well so far, one shortcoming it has is that I can’t easily emulate Source’s texture blending.

Source’s texture blending works by defining an alpha value for each vertex of their triangle terrain, essentially creating a bilinear mask for mixing the two textures together.

image

Roblox isn’t quite prepared to support such a feature, as it would require a lot of feature designing and engineering work to create a proper system for mixing textures together arbitrarily like this.

This got me thinking though, perhaps this effect could be emulated if I could utilize the existing RGBA vertex coloring in MeshParts to create a transparent layer on top of an underlying opaque layer.

This wouldn’t be the most ideal solution to this problem, but it would be one that could be implemented relatively faster since it wouldn’t require a lot of API design. It’d just be a simple quality of life enhancement to the existing vertex color feature, which could facilitate use cases like this.

If this could work with SurfaceAppearances then I’d be set. I don’t normally make feature requests like this unless I feel like I’m completely stumped working outside the box, and this project has certainly been one where I’ve been doing such.

I hope this’ll be considered and added in the near future if it all sounds reasonable!

70 Likes

I would have so… Many… Use cases for this…

Like I can think of at least 15 off the top of my head, but I would find so many little things to do with this once added. This feature would be incredibly powerful, and would lead to some incredible works. Not only that, but it would add another layer of modernization to the Roblox engine that it desperately needs.

11 Likes

Saying that you have many use-cases is not at all useful to Roblox if you don’t actually explain any of them. They need to hear use-cases to understand the scale of need for this feature, and decide how to prioritize.

19 Likes

(Bumping this and adding on since I cannot make feature requests as a member):

I was actually just in the bath thinking about how useful it would be if we could have a VertexColor paint tool to paint and assign values to individual vertices for Terrain and other BaseParts.

Transparency would definitely be the cherry on the cake as well. This would even fix the issue of TerrainColors being universal and not adjustable per-area.

If we wanted to get real creative, I would suggest that we have separate sliders for hue, brightness, (possibly) saturation, and maybe even transparency!!

Here’s my idea for how I think it should work:

  • Hue would take from the hue of the pre-existing Color property and adjust it on a slider of some sort
  • Brightness as a number from either [-1 - 1] starting at ‘0’, or from [0 - 1] starting at ‘0.5’-- would multiply the brightness of the pre-existing Color property
  • Saturation would act the same way Brightness does, but, of course y’know, for saturation…
  • (and finally) Transparency as a number from [0 - 1] would be used to multiply the pre-existing Transparency property

Also, as a first sidenote: I’m not sure it would be doable to have it scriptable in-game, and knowing Roblox, if they ever added a feature like this-- which they likely never will, (please prove me wrong)-- it wouldn’t be scriptable because it would take too much effort.

1 Like

Vertex colors can be changed for meshparts, if you enable the beta.

What beta, im intrigued? 30Ch@rs

This one.

2 Likes

More precisely, use CreateEditableMeshAsync with the MeshPart’s asset id, modify the vertices in question with SetVertexColor(vertexid, color3) to change the color and parent it to the original MeshPart to apply the changes. You can also use SetVertexColorAlpha to achieve this post’s original request.

2 Likes

WHAT!!! Oh my I could not thank you enough for this information :pray:

1 Like

Not exactly. Vertex color alpha just blends the vertex color with the underlying color of the MeshPart. It has no effect on texture colors or blending.

1 Like

You can do this by setting the transparency property of the mesh to a small value which is larger than some arbitrary internal cutoff value (0.0111 works).

But this feature would be better supported if it were a rendering property similar to DoubleSided.