How does editable mesh work?

I have read through this document, but it makes zero sense. Some of the stuff in there doesn’t cover with what they do.

I’ve seen past explanation on this topic, but because editable mesh has be changed the old topics are out of date.

-- //Services
local AssetService = game:GetService("AssetService")

-- //
local meshPart = script.Parent

local editableMesh = AssetService:CreateEditableMeshAsync(meshPart.MeshContent)
local editableMeshAsync = AssetService:CreateMeshPartAsync(Content.fromObject(editableMesh))

-- //
for _, vertexId in editableMesh:GetVertices() do
	local pos = editableMesh:GetPosition(vertexId)

	editableMesh:SetPosition(
		vertexId,
		pos + Vector3.new(0, 1, 0)
	)
end

-- //
meshPart:ApplyMesh(editableMeshAsync)

Editablemeshes can deform vertices and triangles, which you can use to morph or carve meshparts.

the methods and functions explained in roblox documentation editable mesh there makes absolutely no sense, maybe suggest us a community tutorial or guide?

Maybe this yt tutorial could help. https://youtu.be/xy5JFv5f7ps?si=nMiGh5noE-aLlhRI

this works for me:

  • local script
  • experience is published
  • the API is enabled
--!strict

local AssetService = game:GetService("AssetService")
local RunService = game:GetService("RunService")

local meshPart = workspace:WaitForChild("twisted_torus"):WaitForChild("default")

local editableMesh = AssetService:CreateEditableMeshAsync(meshPart.MeshContent)

local success, newMeshPart = pcall(AssetService.CreateMeshPartAsync, AssetService, Content.fromObject(editableMesh), nil)

assert(newMeshPart)

meshPart:ApplyMesh(newMeshPart)

local r = Random.new()

local vertexPosition: { [any]: Vector3 } = {}

local vertices = editableMesh:GetVertices()

for _, vertexId in vertices do
	vertexPosition[vertexId] = editableMesh:GetPosition(vertexId)
end

RunService.Heartbeat:Connect(function()

	for vertexId, originalPosition in vertexPosition do
		editableMesh:SetPosition(
			vertexId,
			originalPosition + r:NextUnitVector()
		)
	end

end)

so basically what you need to do is ApplyMesh before changing EditableMesh instance

1 Like

thanks, this does help - i didnt know you needed it to be in a local script. I thought it was a server one.
im focusing on a cloud noise for a sphere like this, is there a certain type of geometry i need to aim for to aquire this?

like a a high poly sphere, medium or low (not too low of course), as well as the edges for a better topology

i can do the coding, just found the document for editable mesh all over the place :joy:

that looks interesting.

Seems it is a high poly mesh, indeed, because:

  • it’s puffy like normal clouds
  • we can see how it wraps around objects

It seems that:

  • it even wraps around cube also, but at very close distance, because it’s not noticeable how cloud mesh intersects with the cube
  • they have same “aligned” textures for coloring and for displacement: that creates that cloud look and dark areas in “deeper” places
  • to simulate wind they update UV coordinates
  • the clouds most likely have surface only, because video does not show what’s inside it, so most likely it’s not a volumetric thingy
  • maybe the mesh has top layer semitransparent layer, that creates transparent look on edges

Interesting how that runs on a potato phone.

1 Like

its in unity but, i thought if i could use editable image and editable meshs to simulate a cloud and also leverage a image for cloud “shadow” depth detail that wraps around on the edges, like cloud density but darker

Its hard to go by because the noise is random but the fequency and bump of it doesnt look doable for a standard high poly mesh of a sphere?

it should be a procedural 3d noise, that is, when it starts at any position with the same seed it produces same values for the same offset from the position, so you get same offset for vertex displacement or color for texture at any point in space.

yeah, you might need to increase mesh density in bumped areas to avoid sharp edges and generate even noise at the areas.

1 Like