the model baked is different from the normal

channpell posted this 15 February 2017

After I use picaVoxel import a model, I baked the scene, but the model looks like different from the normal, I think the model is short of lightmap uvs channel.How can I do to fix the problem? Anyone have the same problem?
May be some parameters need to be set, or the *.vox file is wrong. You can see the different from the image.![Normal Image][1]

Baked Image

Order By: Standard | Newest | Votes
GarethIW posted this 15 February 2017


I don't do a lot of baked lighting stuff, so I'm not sure what might be wrong. I can only see one image in your post (sorry, the forum markup is kinda terible).

One thing you could try is to switch the meshing mode to "Culled" instead of "Greedy". That might even out the UVs.

PicaVoxel is really meant for dynamic voxel models that can be changed at runtime and so probably isn't the best choice for static geometry anyway. You might want to try exporting as .OBJ from MagicaVoxel and seeing if that works better for static/background objects.

If you can, please zip up the project and send it to and I can take a closer look.

GarethIW posted this 15 February 2017

Okay, so I just did some research into this, and you were right about there being a missing UV set. Apparently when you procedurally generate a mesh, you need to generate a second set of UVs for lightmapping to work. Fortunately Unity has a utility method to do this:

So, to get PicaVoxel to generate the UVs, I added the GenerateSecondaryUVSet call to Chunk.cs at line 280 as follows:

        if (!Application.isPlaying && uvArray.Length > 0)
            MeshUtility.SetMeshCompression(mf.sharedMesh, vol.MeshCompression);

That seems to fix the lightmap baking, but in my test scene I have issues with shadow seams between chunks if I bake the directional light as well. Not sure if there's anything that can be done about that.

Our 127 members have posted 466 times in 112 discussions