the model baked is different from the normal

0
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

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

Hi,

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 support@picavoxel.com and I can take a closer look.

0
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: http://answers.unity3d.com/questions/295911/how-to-set-up-uv-for-lightmaps-for-generated-meshe.html

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

#if UNITY_EDITOR
        Unwrapping.GenerateSecondaryUVSet(mf.sharedMesh);
        if (!Application.isPlaying && uvArray.Length > 0)
        {
            MeshUtility.SetMeshCompression(mf.sharedMesh, vol.MeshCompression);
        }
#endif

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 330 members have posted 404 times in 96 discussions