A few days ago I've started researching 2D perlin noise and I've finally got that down, but in the process I've learned of 3D perlin noise generation, and after eventually getting a working script I've found it's very ill optimized
Here is an image of my 3D perlin noise
My problem is that I'm not sure how to remove the parts that wouldn't normally be seen by the player. How do I remove the parts within and make a shell like structure so my generated object isn't tens of thousands of parts?
Edit:
https://i.imgur.com/hpO30Ax.jpg
Here is an image I found of someone who has gotten the shell like effect I want
Another Edit: Here is the script I'd like some help on, nothing super fancy or never seen before.
local resolution = 50 local frequency = 10 local power = 20 local Seed = math.random(1, 500) local MaxDensity = -1 local Block = Instance.new("Part") Block.Anchored = true Block.Size = Vector3.new(2,2,2) for x = 2, resolution do for y = 2, resolution do for z = 2, resolution do local X = math.noise((y/frequency),(z/frequency),Seed)*power local Y = math.noise((x/frequency),(z/frequency),Seed)*power local Z = math.noise((y/frequency),(x/frequency),Seed)*power local Density = X + Y + Z if Density < MaxDensity then local Blocka = Block:Clone() Blocka.Parent = game.Workspace Blocka.CFrame = CFrame.new(x*2,y*2,z*2) Blocka.Color = Color3.new(Blocka.Position.X*2,Blocka.Position.Y*2,Blocka.Position.Z*2) end end end end
Okay I figured it out with just a bit of testing, it is really quite simple.
First I added IntValues to all of the blocks. The IntValue reflected each block's density.
Then I went through lots of blocks until I found the density value of each block that would be visible to the normal player, the density's numbers ranged from the MaxDensity(-1) down to -7
After finding the lowest number visible to the player I went back into the script and added this:
if Density > -7 then local Blocka = Block:Clone() Blocka.Parent = game.Workspace Blocka.CFrame = CFrame.new(x*2,y*2,z*2) Blocka.Color = Color3.new(Blocka.Position.X*2,Blocka.Position.Y*2,Blocka.Position.Z*2) end
The end result was EXACTLY what I was looking for:
Thank you to anyone who commented on the question.