-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Individual voxels #16
Comments
Just wanted to throw this in here in case someone finds it useful. I'm using this in Unity 2019.3.10f and while it works (we'll ignore the 100s of console messages I don't understand). I was looking to get individual voxels, and the lighting thing threw me for a loop. So my solution, instead of generating meshes, generate Unity cube primitives. In MVImporter.CreateIndividualVoxelGameObjectsForChunk() I commented out the line
One other change I've made, is that the default material has been changed to an HDRP/Lit. So I feel like I've done some stuff poorly, but this gets me what I want, a bunch of cubes the same color they were in MagicaVoxel, with colliders. I'm going to look at creating a ShaderGraph that will look at the pallet, and texture the cubes according to those instead, that way I can have it handle separate materials differently like glass, and such. Left ship is an import straight from MV. Right one was exported from MV as OBJ, cleaned up in Blender to be exported as FBX, and finally imported to Unity. Also, ships are at 0.1 scale, knight is default. I'd also like to note that this throws a bunch of warnings about using Update: More hacky hacky! I now have it check for a material asset matching the RGBA in hex, if that material doesn't exist, it's created, if not, it's just applied. This made more sense to me than doing a custom shader.
|
When "Import as Individual Voxels is selected", there is a bug with mesh building : in the following screen, I've imported a model as individual voxels, then used the "Combine Selected" function on the left half of the voxels.
There clearly is a problem with lighting and I believe this is due to incorrect normals. In MVImporter.CubeMeshWithColor(float, Color) only 8 vertices are added to the mesh, one for each "corner". There should 3 for each corner : one for each corner and for each face (normal).
On the other hand models will have 3 times more data...
I'm not concerned about individual voxels (yet), so I just open this ticket so that people knows what's going on with lighting. I don't know if this should be fixed or not.
The text was updated successfully, but these errors were encountered: