Sunday, May 17, 2020

SculptrVR to Roblox Workflow

SculptrVR is a fun, free-form VR sculpture program.  After my son made a cool design in the app, I extracted the .obj mesh from the Oculus Quest (see this post for all the details).  Besides 3D printing it, I also wanted to be able to bring it into a Roblox level so he can play on it.

A few things I learned about this process:

First, you need an "adult" Roblox account to make "mesh objects" in Roblox Studio.  I guess they are afraid of the kinds of meshes kids might upload?  Weird.

Second, you can import .obj files into Roblox Studio, but I suggest the following workflow in Mesh Lab to do some processing on the mesh so it works well in Roblox Studio.

1) Load the .obj file into MeshLab

2) Roblox Studio has a limit of 10,000 faces on MeshParts:



So if you have more than 10,000 faces in your mesh, in MeshLab use "Filters/Remeshing, Simplification and Reconstruction/Simplification: Quadratic Edge Collapse Decimation" to reduce the number of faces:



You can target for 10,000 faces, but if you end up with more faces than 10,000 after the decimation, you may need to set a slightly lower target like 9,900:



3) SculptrVR exports .obj meshes with vertex colors.  However, Roblox Studio expects a mesh to have a texture image file instead.  So you need to create the texture file from the .obj file you obtained from SculptrVR.  There are two steps to do this.  First use "Filters/Texture/Parameterization: Trivial Per-Triangle":



What is "Parameterization"?  It maps the space of the 3D triangular mesh onto a flat, 2D surface.  The best explanation I've seen is from this slide from a Tel Aviv University presentation:



4) Now that there is a mapping from the triangular mesh to 2D, we need to carry the vertex colors to the 2D texture.  Use "Filters/Texture/Transfer: Vertex Color to Texture":



You must then name the texture file:



The texture file is a .png. It will look like a lot of colored triangles:



5) Now export the processed .obj file from Mesh Lab, and make sure that it references the texture file:





6) Now go into Roblox Studio.  Right click or Command-I to insert an Object:



And insert a "MeshPart":



Select the generic MeshPart you inserted



Then go to the Properties/MeshId and choose the .obj file you exported from MeshLab:



You will get a couple of warnings, you can choose to say yes or no:

 

And at the end of that, Roblox Studio should import your .obj mesh and automatically load up the texture file as well:




There you go!



No comments: