Ye i know. All the modules i got here from roblox forum to mesh it with triangles had math operations that just broken all the wedges CFrames. Using EditableMesh was way faster and easier than trying to fix them, also idk if it runs smooth meshing even low triangle counts like 20k.
I dont really care about the rendereing part i just wanna do the faster possible loading & smallest possible size with serializing externally and deserializing the model internally fr.
You aren’t wrong… And I am sure most NSFW artists will take the hard path because those people are determined to put their filth everywhere they go. They are like slugs that leave a trail wherever they go.
To OP’s responses:
Then there is nothing better than using editable meshes. They are easy, reliable, and performant.
Thats the roblox script, but a version that uses a crappy base64 module so it gets really slow compared to just doing an http-get on github with the serialized model(no base64 encoding).
local Base64 = require(script.Parent.Base64)
local positionFormat = "fff"
local verticesFormat = "III"
local verticeCountFormat = "I"
local dataLenghtFormat = "I2"
local function UnserializeModel(
model: string,
processVertice: (number, number, number) -> (),
processFace: (number, number, number) -> ()
)
model = Base64.base64Decode(model)
local verticeCountHeaderLenght = string.byte(model:sub(1,1))
local verticeCountHeaderEnd = 2 + verticeCountHeaderLenght
local verticeCount = string.unpack(verticeCountFormat, model:sub(2, verticeCountHeaderEnd))
local i = verticeCountHeaderEnd
local stepCount = 0
local verticeDataEnd = verticeCountHeaderEnd + verticeCount
repeat
local valueLenght = string.byte(model:sub(i, i))
i += 1
local valueEnd = i + valueLenght
processVertice(string.unpack(positionFormat, model:sub(i, valueEnd)))
i = valueEnd
stepCount += 1
until stepCount >= verticeCount
repeat
local valueLenght = string.byte(model:sub(i, i))
i += 1
local valueEnd = i + valueLenght
processFace(string.unpack(verticesFormat, model:sub(i, valueEnd)))
i = valueEnd
until i >= #model
end
local AssetService = game:GetService("AssetService")
local editableMesh = AssetService:CreateEditableMesh()
local vertices: {Vector3} = {}
local vertexMap = {}
UnserializeModel(
require(script.Parent.Teddy),
function(x, y, z)
vertexMap[#vertexMap + 1] = editableMesh:AddVertex(Vector3.new(x, y, z))
end,
function(a, b, c)
editableMesh:AddTriangle(
vertexMap[a],
vertexMap[b],
vertexMap[c]
)
end
)
-- Creating MeshPart linked to our EditableMesh
local meshPart = AssetService:CreateMeshPartAsync(Content.fromObject(editableMesh), {
CollisionFidelity = Enum.CollisionFidelity.Box,
RenderFidelity = Enum.RenderFidelity.Precise
})
meshPart.Material = Enum.Material.SmoothPlastic
meshPart.Anchored = true
meshPart.Parent = workspace
The Teddy bear serialized & encoded model: Hastebin