Optimized EditableMesh Ocean Project

Ah by the way did you use Planes or Cubes? because for some absurd reason when I try to animate Planes chaos emerges and everything dies. If you are using planes, please tell me so that I may also use them.

I probably did not recalculate normals haha.

planes. i could do cubes but that would add another layer of complexity and a bit useless for oceans unless roblox gave us alpha blending for editablemeshes.

for y = 0, scaledHeight do
	local row = {}
	for x = 0, scaledWidth do
		
		local xPos = (x / scaledWidth) * (width * 2) - (width)
		local yPos = (y / scaledHeight) * (height * 2) - (height)

		
		local vertexId = editablemesh:AddVertex(Vector3.new(xPos, 0, yPos))
		row[x] = vertexId

		
		verticepos[vertexId] = Vector3.new(xPos, 0, yPos)

		
		local colorId = editablemesh:AddColor(Color3.new(1, 1, 1), 1)
		vertexColors[vertexId] = colorId
	end
	vertices[y] = row
end

scaledWidth/scaledHeight being the width and height divided by a scalable resolution variable.
this is something I made just when editablemesh came out. it’s super bare bones (not to mention prone to bugs) but i don’t feel like changing it much unless you have some feedback

does it not already do this automatically as of the new api update anyways?

if you have anything to help with the seams it would be insanely appreciated :pray:

no but it is. the planes scale perfectly fine.
it’s just the fact that the gerstner wave height lookup function is being inputted completely different variables (e,g., -150 and 150 on tile edges) which won’t match up at seams if that makes sense.

i just need to rework the system a bit to be compatible with tiles.

FINALLY I DID IT


See what I’m talking about
I think I’m gonna subdivide some more wait.

1 Like


There that’s better.
Here’s the Blender file btw.
LOD.obj (313.7 KB)

I suck at blender so this took FOREVER to make…

And I’m getting this, with ANY plane I use…

chat in the dms i sent you.

Wait why are you not using AddTriangle on this? You are simply adding Vertices… Why?

I know there are godrays, only problem is I don’t think you can change their source to my knowledge they would all originate from the sun, it needs to be spread out over the waters surface otherwise it doesn’t look right.

1 Like

I was having this same problem. Turns out it’s a Studio bug that happens when creating the mesh from scratch. If the y-position of the vertices are all the same when you create the triangle, it ends up being invisible.

Since I’m also making an ocean system, I decided it wouldn’t matter if I gave a height to each vertex when I created them because they would end being manipulated by my wave formula anyway. So that’s what I did, I applied my wave formula to the y-position of each vertex right as I create them, eliminating the problem of invisible triangles.

Hopefully Roblox fixes the major bugs related to editable meshes and images soon, especially since the APIs have officially been released at the time I’m writing this lol…

That looks cool. Ive been trying to make something like that to add my bioluminescence system, but roblox just made their id verification update.