MeshVox V1.1 - A powerful 3D mesh-terrain converter

The plugin seems pretty cool. I may be doing something wrong, but the orientation of the generated terrain seems to be off, by 90 to 180 degrees when trying to generate terrain from mesh. I am not sure why this is. It is also creating terrain hills where there was no incline whatsoever, perhaps I have an issue with my mesh?

1 Like

This plugin is a life saver!

Had problems with heightmap generations and came out extremely blocky + had took weeks to optimize my terrain using the PartToTerrain plugin. I converted my heightmap to an obj file and optimized it in blender, only for this plugin to save me time and not crash studio.

2 Likes

Just updated this, fixed an issue where jpgs uploaded by your PC were erroring and also fixed some generation errors

1 Like

Can this be used during runtime? I have a procedural world generator and would like to dynamically generate terrain using meshes.

1 Like

It doesn’t have this but it wouldn’t be too hard to fork to do this yourself, you can dm me if you need help with that

2 Likes

Is there any way to reduce the amount of terracing you get?

1 Like

Not really, I think that’s just an artifact of smooth terrain on slopes because voxels.

Roblox said that they were planning on addressing it soon at the latest RDC, not sure what the progress is on that

5 Likes

The link doesn’t take me to the plugin page. How do I find it?

1 Like

There was a false moderation action against my account that was causing my creator store links to break

It should be fixed now

2 Likes

Added this update recently

  • April 19th, 2024
    • For those who want to just generate terrain from meshparts instantly without loading them and choosing different stamper parts, I added a new button to the bottom
      image

      • Select meshparts and click this to instantly start generating, the custom texturing stuff doesn’t work with this , it will just use your chosen fill/surface materials. It will generate all of the selected mesh parts.

      • You can turn “Concurrent” off to stop it from generating it all at once in parallel. This might be helpful if you have intersecting meshes and want the results from one to affect the other in a specific order

3 Likes

Was wondering how to simply call the terrain generation api on a meshpart using code for use in procedural world generation engine. I’m doing a new project using something I wrote to generate different types of terrain using model libraries.
I tried figuring i out before but it is a bit cryptic. I’m going to attempt again.

1 Like

MeshvoxRuntimeExample.rbxm (25.9 KB)

3 Likes

I don’t see a water material here, was that intentional?

1 Like

Thank you soo much great work! It incredibly great!
I just edited it so that it can take optional variables as parameters for the terrain material. Thanks for the starter code! I will do a lot with this template!

1 Like

Here’s is a 3-D model of Stonehenge

https://create.roblox.com/store/asset/17365370978

local Debris=game:GetService("Debris")
local console=script.Parent.Parent.Terrain
--local materialrules={""}
local chance=0
local materialorder=script.Materials:GetChildren()
	--[1]=script.Water,[2]=script.Rock,[3]=script.Basalt,[4]=script.Grass}

local GenerateMesh = require(script.MeshvoxRuntime)

for _,v in console:GetDescendants() do
	if v:IsA("BasePart") then
for _,mat in materialorder do
if mat.Value~=nil then
				if v.Color==mat.Value.Color then	
					if v:IsA("MeshPart") then
						GenerateMesh({v},Enum.Material[mat.Name],Enum.Material[mat.Name])
					else 
						
					end	
            end
			Debris:AddItem(v,5)
end
		end
	end
end


Due to the way the script is set up it’s easy to modify it color codes the materials and you use a source object as a reference color so you can do things like this where we just replace the grass mesh with material to increase fidelity,

very easy to modify


Game changing code! Thank you so much, been waiting for something like this :slight_smile:

2 Likes

I’ve been building a library of objects formatted for this software and would like to share the code results of many iterations after going through several map objects.
image
This setup uses the MeshVox module very efficiently by only requiring it once and passing all calls through a BindableFunction object. It also maps a lot of different materials and allows for easy customization and provides an example object pictured above and a template.
MeshVox Executable - Creator Store (roblox.com)
The TerrainModel places itself inside the terrain as its environment and the scripts waitforchild(“”)

local Debris=game:GetService("Debris")
local console=script.Parent.Parent.Terrain
--local materialrules={""}
local chance=0
local materialorder=script.Materials:GetChildren()
	--[1]=script.Water,[2]=script.Rock,[3]=script.Basalt,[4]=script.Grass}

local GenerateMesh = workspace.Terrain:WaitForChild("TerrainModel").MeshVox
local function examine(console)
for _,v in console:GetDescendants() do
	if v:IsA("BasePart") then
for _,mat in materialorder do
if mat.Value~=nil then
				if v.Color==mat.Value.Color then	
					if v:IsA("MeshPart") then
						local submat= mat:FindFirstChildOfClass("ObjectValue")
						if submat~=nil and submat.Value~=nil  then
						--	mat:FindFirstChildOfClass("ObjectValue")
							GenerateMesh:Invoke({{v},Enum.Material[mat.Name],Enum.Material[submat.Name]})
							--mat:FindFirstChildOfClass("ObjectValue")	
						else	
							GenerateMesh:Invoke({{v},Enum.Material[mat.Name],Enum.Material[mat.Name]})
						end
						
					v.Transparency=1	
					else 
						workspace.Terrain:FillBlock(v.CFrame,v.Size,Enum.Material[mat.Name])
					end
					
					
            end
			
end
		end
	end
	end
end

--examine(script.Parent.Parent.Air)
--task.wait(1)
examine(script.Parent.Parent.Terrain)

Debris:AddItem(script.Parent,5)

TerrainModel bindable function code

local console=script.Parent.Parent
console.Parent=workspace.Terrain
--Setup

local GenerateMesh = require(workspace.Terrain:WaitForChild("TerrainModel").MeshvoxRuntime)
local bindableFunction = script.Parent.Parent.MeshVox -- Find the same BindableFunction object in the Workspace
local MeshVoxFunctions={

	
}
local threadhandle=false
local tasks=0
bindableFunction.OnInvoke = function(property)
	tasks+=1 
	local currenttask=tasks/10
	if threadhandle==false then	
		threadhandle=true
	else 
		repeat task.wait(currenttask) until threadhandle==false
threadhandle=true
	end	
	GenerateMesh(property[1],property[2],property[3])
	threadhandle=false 
	tasks-=1
end

NOTE: Must have HTTP Requests Enabled to use.

.

4 Likes

Very cool! Glad it’s working out for you

I had the idea of making a lil proof of concept for interesting randomly generated but pre-fabricated terrain environments using meshvox at runtime + the wave function collapse algorithm, but haven’t gotten around to it yet.

I’m glad to see it’s running fast enough for your use case

1 Like

Managed to get it to work with editable meshes and loving it. I can now make noise into terrain
(This was made by putting noise onto an editable mesh plane then converting it into terrain)

1 Like

Is this generating the tree structure and changing it for each tree?

I had an issue that was caused by a bug where I misclicked a object and ended up exceeding the API-limit to import meshes, so I wrote some code that prints the results of the jobs and then that is saved to a module, after some tinkering I got it working then realised it wouldn’t work for my use case and wasn’t currently necessary because I was also saving the triangles position in 3-D space, which would make it unsuitable. I may post the results of that later. I’ve currently finished formatting the a library of 30+ 3-D models using this tool and most of the models are in as few pieces as possible besides one of them., so I don’t think the API limit will be an issue.

But in short to save and execute the jobs to not exceed API limit you do the job once in studio runtime. return jobs add jobs to an array, then print and paste the array into a module. return them and execute the jobs.
For the purpose of executing a module of data to replace the API, It may be better to just save the minimal data such as the triangle data from the meshdata, in its raw form it’s very character heavy. so quantizing what you need would be best.
I also couldn’t use it for certain 3-D objects because I wasn’t sure how to configure the color map settings the settings in your module to automatically select the material based on the RGB of the triangle.