sandrofigo / voxreader Goto Github PK
View Code? Open in Web Editor NEWA C# library to read .vox files created with MagicaVoxel
License: MIT License
A C# library to read .vox files created with MagicaVoxel
License: MIT License
"PACK" chunk
KeyNotFoundException when parsing specific .vox files
I am experiencing a KeyNotFoundException when attempting to parse certain .vox files. The error message is:
System.Collections.Generic.KeyNotFoundException: 'The given key was not present in the dictionary.'
I have tried parsing several .vox files and have found that some of them work as expected, while others do not. I have not been able to identify any specific pattern or cause for the files that are causing this exception to be thrown.
I have attached a .zip of the vox file below, when parsing this file you will be presented with the error above:
Any help or guidance on this issue would be greatly appreciated. Thank you!
After a little investigation I could reproduce the behaviour by exporting the file with the ".vox" export function instead of saving the "project".
If the file is exported this way, some chunks are missing that would normally be used to parse the models. I will add the feature to read "exported" .vox files in the next release.
Originally posted by @sandrofigo in #16 (reply in thread)
In MagicaVox palletes color indexes start from 1, but in PalleteChunk.Colors they start from 0. Indexes are shifted. Because of it, if I want to get a color with index i, I need to write palleteChunk.Color[i - 1]. This is counter intuitive and caused me a problem, because palleteChunk.Color[voxel.ColorIndex] doesn't give me a color of that voxel. Instead I have to write palleteChunk.Color[voxel.ColorIndex - 1]. That takes some time and nerves to understand. Please make color indexes start with 1 like in MagicaVox, so color indexes would match.
Can i export voxel model from list positions, colors ?
Hello, I would like to access palette notes per voxel.
I managed to get the notes out of the note chunk with the following code:
var noteChunk = vox.Chunks.Single(x => x.Type == ChunkType.Note);
var noteList = new List<string>();
var i = 4; // skip row count
while (i < noteChunk.Content.Length)
{
var noteLength = BitConverter.ToInt32(noteChunk.Content, i);
i += 4;
var note = Encoding.ASCII.GetString(noteChunk.Content[i..(i + noteLength)]).Trim();
i += noteLength;
noteList.Add(note);
}
This creates an array with 32 names that match with what's in the editor.
Unfortunately, I have not been able to match colors to the actual group names. The color indexes don't match up at all, in fact, they aren't even in the same order.
I've noticed the existence of ChunkType.IndexMap, maybe I need to use that somehow?
Also, it would be nice if you could access the color index from the public Voxel struct. As things are right now, I had to clone this repo and modify it to expose it.
The XML comments are missing in the final build.
If the user wants to know the global voxel position in the scene the user must calculate this manually. There should exist a method to calculate the global position of a voxel in the scene.
I'm working with .vox files, and I noticed there isn't a way to get the position of a group, the cars.vox file included with magicavoxel, has two groups which can be seen below, however when I parse the voxels using voxelReader and since there's no group positions, the voxels all occupy the same space.
Hello!
I've used this tool in a game server plugin, where it is responsible for loading in custom terrain from magica voxel. In order to load this plugin, users need to drop my plugin in a folder as .dll, however they also need to put in voxreader.dll for it to work.
Right now, I've published both our dll's under one release like such: https://github.com/SwatDoge/SOTTBBVFMVTAEBP/releases/tag/1.0.0 and credited accordingly. I've mostly done this for convenience.
Do you feel this is sufficient crediting? Would you prefer me to delete the voxreader.dll, and refer users to this github?
I apologize for publishing your code, I am still figuring out the best way to do this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.