2
votes

I'm making a game in Unity C# and need to extract voxel position (and ideally color) from my MagicaVoxel editor which saves it's files in the .vox format, and can export in a few other ones.

I'd think it's best to extract this information from the .vox files, but none of my text editing programs could decern it's encoding. Does anyone know how exactly I should go about getting this data?

1
You already have the file layout, which clearly, more or less, states how the data is arranged. Why do you expect it to be readable by a text editor? It's just a bunch of bytes packed into larger chunks.Milster
@Milster I thought that if none of my test editors can read it, my program wouldn't ether... I don't have much experience in reading from files like this and I don't know how to use the file layout if I can't read it in the first place... maybe you could write an answer, and clear my confusion? ThanksAlex P.
I don't think this question is answerable in the current state. While the original data isn't the most complex, it's probably quite a job for a beginner. The .vox format you mentioned saves data in chunks (every time first stating how much data is coming and then how it will be saved). You will need to read the data bytewise, in exactly the given format. As it stands I can't answer the question as I don't know how you want the output to look and as it would mean a ton of work for me, which should be actually yours.Milster
I'd be happy to put in the work to learn this, I'm just lost and not sure what to look for. Could you recommend any learning resources or keywords?Alex P.
No keywords I am afraid. The .vox format you linked could answer all your questions if you understand it (no offense meant). It describes how the bytes are ordered and how you can interpret them to build an interpreter / transform it to the format you want. Telling you how and what to do in as few characters as this is impossible for me, maybe someone else can.Milster

1 Answers

2
votes

Here's the answer in case someone is still interested: with the export option you can save it in the .ply format (click 'point' - export point clouds). If you open the .ply file with a text editor, you will find the coordinates and the associated RGB values.