[Studio Beta] Major updates to in-experience Mesh & Image APIs

@TheGamer101 Hey, would like to report a bug that’s been affecting workflow and limiting us.

Sometimes, creating 2 or more EditableImages will sometimes cause one not to render. I doubt this is a memory limit issue as I have 32gb of memory. it even happens on small EditableImage sizes (such as 52x52)

Notice how the ImageLabel layer with the cursor re-appears after I remove the EditableImage from a different ImageLabel

ngl the FastCluster glitch be trippin’

the meshes are no longer rendered inside a humanoid … again.

I’ll wait, not bothering the editableMesh devs cause I think they be doing crazy work😭

Would you be able to DM me this place file, and I can take a look?

I’m currently working on a fix to that issue, but as a temporary workaround, you can offset one of the vertices of your mesh by a small amount, like 0.001.

The problem is that when we’re converting from an EditableMesh to a MeshPart, we compute physics information, which doesn’t work well when the mesh has zero volume.

1 Like

Re-enabling this is a good idea, I think we should be able to do this.

I got my code working again thanks to the workaround provided, however I’m noticing two issues. For reference I’m using two EditableMeshes to create a line of sight system. Let me know if you would like me to send you the place file.

  1. The MeshPart blinks each time I update it. Before, when the system used Instances instead of Objects, it did not do this and rendered immediately when the EditableMesh was parented to the MeshPart. Since the change, the mesh glitches out when updated at a high rate. Lowering the update frequency does not fix this as the blink is still visible.
    Watch 2024-11-19 18-30-06 | Streamable

  2. The MeshPart is centered and all vertices are based off of the size and position of the MeshPart, however the triangles are offset. Focus on the red mesh, before the update it would always be 100% aligned with the blue mesh but now it’s not. It’s easier to see what I mean when I create triangles on opposite sides of the circle. All of the vertices created from the yellow parts never move and are always in the same position, but they get offset by new triangles being created.
    Watch 2024-11-19 18-28-29 | Streamable

Switching from Wedges to an EditableMesh has increased performance for my line of sight system substantially, I’m excited for when this officially gets released. One request I have is a way to reset all of the vertices and triangles in an EditableMesh back to an empty mesh. What I have to do right now is create a new EditableMesh and apply it to the MeshPart each time the Update function is called, however it would be nice to be able to just clear and rewrite to the same EditableMesh since it will automatically update and eliminates the need to create new Objects.

Thanks for the bug reports.

We’ve had a few people ask for an EditableMesh:Clear method, and with the changes to how preview works for EditableMesh, it seems more useful.

In the meantime, you can clear an EditableMesh using:

for _,fid in emesh:GetFaces() do
    emesh:RemoveFace(fid)
end
emesh:RemoveUnused()

This will remove all faces, vertices, normals, UVs, and colors.

1 Like

the memory limits changed and now i can barely make more than 5 editable meshes, is there anything i can do? (they’re like 120 studs big and only have 72 tris so i dont know why im reaching the limit so easily)

also occlusion culling isn’t working right when there’s other objects on top it but the bounding boxes look fine i think. im not changing the position or size of the meshpart after calling CreateMeshPartAsync or using a pre-existing mesh like a plane



without anything ontop

3 Likes

Bumping this question as the issue hasn’t been solved or been replied to.
Would it be possible to allow Editable api to access assets uploaded by a user that has studio access in a group.

1 Like

For anyone struggling with procedurally generated EditableMeshes which may or may not be perfectly flat (In my case, for voxel-based meshes), I’ve written a helper function to automate the workaround for the zero-volume physics bug.

The function uses EditableMesh:GetSize() function, which I believe is equivalent to the computeExtents function referenced in the original post:

It works by checking if any axis has zero size. If so, it offsets a vertex by 0.001 studs along that axis to ensure the mesh has non-zero volume.

Feel free to use it in your projects!

-- Ensures the EditableMesh has non-zero extents by slightly offsetting a vertex if needed.
-- This workaround addresses cases where perfectly flat meshes (zero extents along an axis) 
-- fail due to physics computation issues.
--
-- Returns:
-- boolean (success) - True if adjustments were made, False if no adjustments were possible.
local function ensureMeshVolume(eMesh: EditableMesh): boolean
	local vertIds = eMesh:GetVertices()
	local vertId = vertIds[2] -- Select the second vertex (if it exists)
	if not vertId then return false end -- Give up if there are less than two vertices.

	local offsets = {
		Vector3.xAxis,
		Vector3.yAxis,
		Vector3.zAxis
	}

	local extents = eMesh:GetSize()
	
	-- Check each axis for zero size
	for i, axis in ipairs({"X", "Y", "Z"}) do
		if extents[axis] == 0 then
			-- Add a small offset along this axis to create volume
			local position = eMesh:GetPosition(vertId)
			local delta = offsets[i]*0.001
			eMesh:SetPosition(vertId, position+delta)
		end
	end
	
	return true
end

Note: From my testing, this glitch doesn’t occur for all meshes with zero volume. It specifically affects meshes with an axis-aligned bounding box that has zero volume. For example, a perfectly flat plane rotated such that its bounding box has non-zero size along all axes does not seem to cause issues. As a result, this function only modifies the mesh based on its extents size.

I’m having the same problem, and Roblox seems to cull the mesh whenever this (incorrect) bounding box is offscreen. Does anyone have a workaround for this?

Edit: It seems like the bounding box is always offset by a value equal to EditableMesh:GetCenter().
For example, if an editable mesh has one corner at the origin (in local coordinates), the bounding box will be centered at the opposite corner instead of the actual center of the mesh.
In the example above, my mesh has one corner near the origin, and you can see that the bounding box is indeed centered within a few studs of the opposite corner of the whole mesh.

Feel free to use this quick workaround I wrote that re-centers the mesh by moving all vertices by the negative value of EditableMesh:GetCenter(). This makes the bounding box align correctly with the mesh.

local function correctBoundingBox(eMesh: EditableMesh)
	local center = eMesh:GetCenter()
	local deltaPos = -center
	
    -- Shift all vertices by the negative center offset
	for _, vertId in ipairs(eMesh:GetVertices()) do
		eMesh:SetPosition(vertId, eMesh:GetPosition(vertId) + deltaPos)
	end
end

Keep in mind that this is a pretty quick and dirty workaround. If you add or move vertices in the mesh after applying this function, you’ll need to adjust their positions manually to maintain proper alignment.

Im getting a simular problem, no matter how many verticies are in my EditableMeshes, it only allows me to make 8 before reaching the limit.

looks like the beta has finally become public!! they haven’t made a post yet, though

edit: they just made the post!!! awesome :DD

2 Likes

EditableMesh and EditableImage APIs moved to Client Beta and are now available in published experiences.

Please take a look at the following post to learn more and provide feedback:

1 Like

Wow, this place looks amazing!

Since unfixed EditableMesh can currently allocate and deallocate vertices and triangles, we can’t predict the exact memory usage. We’re currently taking a conservative approach and assuming the worst-case scenario based on the potential size of an editable mesh. In the future, we plan to provide options for creators to define the max number of triangles an unfixed EM may use, allowing for better memory estimation and management. In the meantime, you can merge multiple EMs into a single larger one and use Destroy() on the previous EMs to reclaim memory. Alternatively, you can use createEditableMeshAsync with FixedSize = false.

Please refer to the latest post ([Client Beta] In-experience Mesh & Image APIs now available in published experiences) for the best practices regarding the Create API, and we’ll keep iterating on the memory budget system to make it more dynamic.

1 Like