Author Topic: Color Obj Mesh Export for 3D printing  (Read 110 times)

Rad

  • Guest
Color Obj Mesh Export for 3D printing
« on: September 09, 2021, 09:44:23 AM »
This may be more of a feature request.

Basically, I want to take the voxels that I have generated and export them as a single .obj mesh with .mtl file. The goal would be to have it 3D printed.

I tried this library https://assetstore.unity.com/packages/tools/utilities/scene-obj-exporter-22250 with not much luck. Can you suggest any other libraries?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Color Obj Mesh Export for 3D printing
« Reply #1 on: September 09, 2021, 10:53:05 AM »
Hi,

From Voxel Play Environment inspector, you can export the chunks as regular gameobjects using the "Export Chunks" button:


Once the chunks are regular gameobjects with their materials in the scene, it's just a matter of finding a pluging or tool to make that export. We currently don't know of a good plugin for this sorry.

Regards

Rad

  • Guest
Re: Color Obj Mesh Export for 3D printing
« Reply #2 on: September 09, 2021, 08:09:06 PM »
Great! I need to reverse engineer that a bit so that it is automated within my script; but converting each chunk sounds like it will work. The library I linked works very well once I have game objects. I will let you know the results!

Rad

  • Guest
Re: Color Obj Mesh Export for 3D printing
« Reply #3 on: September 10, 2021, 12:00:15 AM »
I'm getting an error something like this:
Code
Not allowed to access vertices on mesh '' (isReadable is false; Read/Write must be enabled in import settings)

When the obj exporter library (not your library) does this call:
Code
sceneMeshes = FindObjectsOfType(typeof(MeshFilter)) as MeshFilter[];
for(int i = 0; i < sceneMeshes.Length; i++)
{
    MeshFilter mf = sceneMeshes[I];
    Mesh msh = mf.sharedMesh;
    foreach (Vector3 vx in msh.vertices)
    {
       ...
    }
}

The closest I've come is this forum post:
https://answers.unity.com/questions/1636250/meshisreadable-is-false-although-readwrite-enabled.html

But I'm stuck currently.

I was able to get something exported from the editor, so I think it's something specific to my IOS IPAD. I did disable "Optimize Mesh Data" as suggested in the post.

Any thoughts?

Rad

  • Guest
Re: Color Obj Mesh Export for 3D printing
« Reply #4 on: September 10, 2021, 12:01:56 AM »
To my previous message, I started with this:
Code
VoxelPlayEnvironment vpe = gameObject.GetComponent<VoxelPlayEnvironment>();
vpe.ChunksExport();

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Color Obj Mesh Export for 3D printing
« Reply #5 on: September 10, 2021, 12:06:43 AM »
Itís possible that the generated meshes are not marked as readable. Iíll check it.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Color Obj Mesh Export for 3D printing
« Reply #6 on: September 10, 2021, 09:24:36 AM »
Procedural meshes created by VP are readable by default so I guess that error is related to some other mesh that's in the scene as you are trying to convert ALL meshes in the scene.
Instead, you could try using all meshes of children under the exported gameobject root, the gameobject with name "Exported Chunks".

Rad

  • Guest
Re: Color Obj Mesh Export for 3D printing
« Reply #7 on: September 10, 2021, 10:45:27 AM »
I did some simpler tests, and it exports an obj on the MacOS (currently without color) but not at all on the iPad IOS... So there's just some sort of build setting I'm missing. Thanks again, and I'll get back once I have something working.

Rad

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Color Obj Mesh Export for 3D printing
« Reply #8 on: September 11, 2021, 12:27:33 AM »
I got something hacked together using your Colorizer example and reverse engineering a obj export library.

See attachments with https://3dviewer.net/index.html

Now it's off to the 3D printer!

P.S. Still having issues with the iPad, but that's a different problem to solve :)

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Color Obj Mesh Export for 3D printing
« Reply #9 on: September 11, 2021, 08:50:26 PM »