Can i use noise on meshes using editable mesh?

I am wanting to make a planet generation script but using a spherical mesh, then applying noise to it, like how ive done it in blender (its noise on a uv sphere with a different sphere with no noise for water).

i have no idea where to start and how to approach this. so is there anyway on how to do this and how would you approach it? thank you!

1 Like

There are great tutorials on yt for this kind of stuff. I believe Sebastian Lague does a good tutorial however it is written in c# so you will need to convert the code

2 Likes

any idea why this script wont work?

local size = 10
local amplitude = 0.5
local sphere = game.Workspace.Sphere
local as = game:GetService(“AssetService”)
local editableMesh = as:CreateEditableMeshFromPartAsync(sphere)
local vertices = editableMesh:GetVertices()
for i, vert in pairs(vertices) do
local pos = editableMesh:GetPosition(vert)
local normal = editableMesh:GetVertexNormal(vert)
local noise = math.noise(pos.Xsize,pos.Ysize,pos.Zsize)
editableMesh:SetPosition(vert,pos-(normal
noise))
print(noise)
end

it is indented btw
image

what do you mean by not working? Does it just do nothing or have some weird result?

it does absolutely nothing, the noise prints but nothing happens on the sphere

Are you sure the values are strong enough it could just be that you need to multiply them. Try putting it in a while loop and seeing what happens?

ill try and update you shortly

theres still nothing happening :man_shrugging:

The code sample provided doesn’t parent the EditableMesh to anything, so it won’t show up anywhere, but also the amplitude variable is not being used anywhere. It should be used in this line:

editableMesh:SetPosition(vert, pos - normal * (noise * amplitude))
2 Likes

thank you! it worked, it looks a little weird but im gonna try fix that. i appreciate the help : )

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.