Jump to content

Importing *.obj from MagicaVoxel


timetocode
 Share

Recommended Posts

Having some texture inconsistencies with *.obj from MagicaVoxel.

Original:

unknown.png?width=400&height=281

Texture problem (in browser). The problem is the magenta roof's color is bleeding into the light blue walls. and making weird triangles.

unknown.png?width=401&height=247

Imported from MagicaVoxel to Blender just to test a render:

image.png.440471e2f0bee3609a2db8d46e1fd3f1.png

Any idea what the problem might be, or how to test further?

 

I made a few other meshes and had the same problem, somewhere on there one of the colors starts to do some weird blendy thing with its neighboring voxels, but most of of the model maintains crisp edges.

Link to comment
Share on other sites

Nevermind! This turned out to be one of those things fixed with

BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true

 

image.png.c523600af6fc6148b4b706e290aaab76.png

Now the lines are clean.

 

Also if anyone happens to be playing with magicavoxel, I found out a few more things.

For everything to line up perfectly, the mesh needs to be moved by half its size and flipped on the z axis. I mean it looks fine as a mesh by default when imported, but if you want the coordinates from magicavoxel to line up with coordinates in babylon space such that 0,0,0 in babylon is 0,0,0 in voxels, then the offsetting + flipping needs to occur. Then it becomes possible to do voxel collisions instead of mesh collisions, which is what I'm working on next.

image.png.7d2be875bda34c9fda02f97a64411c2a.png

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...