For some reason each of the IDs (Vertex, Triangle, Normals) have different starting positions, I got this number just by subtracting that offset. Thereâs also a version without the hard coded values which has to index a table each time it wants to get the relevant ID. This was primarily a slight performance decision, itâs a lot better to just add N rather than indexing a table with N.
Potentially? Iâm unsure of the cause of the issue you have but the UV coordinate of the vertices might be the issues. I donât actually use UV coordinates here, since the color is based on the vertex.
Iâm talking about the ID, which is an integer, you can just do this by keeping count of the number of UV IDs and then subtract the ID that returns from :SetFaceUVs with that number, giving you a constant number.
The problem youâre facing is probably because of an incorrect vertex ID. You can compare it with my implementation if the values arenât the same:
for X = 1, FOURIER_SIZE-2 do
for Y = 1, FOURIER_SIZE-2 do
local Vertex1 = X * FOURIER_SIZE + Y
local Vertex2 = Vertex1 + 1
local Vertex3 = (X + 1) * FOURIER_SIZE + Y
local Vertex4 = Vertex3 + 1
local Face = OCEAN_MESH:AddTriangle(4294967296+Vertex1, 4294967296+Vertex2, 4294967296+Vertex3)
OCEAN_MESH:SetFaceColors(Face, {12884901888+Vertex1, 12884901888+Vertex2, 12884901888+Vertex3})
OCEAN_MESH:SetFaceNormals(Face, {8589934592+Vertex1, 8589934592+Vertex2, 8589934592+Vertex3})
local Face = OCEAN_MESH:AddTriangle(4294967296+Vertex2, 4294967296+Vertex4, 4294967296+Vertex3)
OCEAN_MESH:SetFaceColors(Face, {12884901888+Vertex2, 12884901888+Vertex4, 12884901888+Vertex3})
OCEAN_MESH:SetFaceNormals(Face, {8589934592+Vertex2, 8589934592+Vertex4, 8589934592+Vertex3})
end
end