tommyettinger / IsoVoxel

Generates isometric pixel art from MagicaVoxel .vox files
MIT License
344 stars 25 forks source link

Support for Multiple Models in World #7

Open HurricanKai opened 6 years ago

HurricanKai commented 6 years ago

Recently Magica Voxel introduced the World mode, where its possible to have multiple Models in one "Scene", it woud be great to have support for that :)

tommyettinger commented 6 years ago

This should be possible, though I haven't updated my MagicaVoxel version in a while (at least some versions didn't support animations, and other issues on IsoVoxel specifically needed me to test animations). Some of the rendering methods here are better-suited than others for this, so a World-mode renderer may need to only produce some sizes of renders. I'll start on this when I understand World mode a little better, and hopefully I will have used it some.

HurricanKai commented 6 years ago

I think here it should be enough to know that world mode is just a Model Array instead of a single moddel. Iterating over each one and then handling each one like you are a single one now should be fine? (Maybe lightning won't be as great, but for now just it not throwing an error would be enough ^^)

tommyettinger commented 5 years ago

Hmm... World mode seems like it might use some very different extensions to the .vox format, which previously was fairly simple. The docs for the scene graph addendum to the format seem like they will be a lot of work to support, and it also looks like the format is still changing, since that file was edited 4 days ago. I'd like to see someone's code that reads in files with these extended features before I try to write my own.

superfrantv commented 4 years ago

Greetings from Germany,

iam also wish to convert vox scenes (world format) to a big sized picture with IsoVoxel. Hope it is possible.

HurricanKai commented 4 years ago

Not sure if this is still supported, but it should be fairly easy to implement the new stuff (excluding nOBJ) I found it quite easy in my vox/unity conversion tool The changes:

* there can be multiple SIZE and XYZI chunks for multiple models; model id is their index in the stored order
* the palette chunk is always stored into the file, so default palette is not needed any more
* the MATT chunk is deprecated, replaced by the MATL chunk, see (4)
* (a), (b), (c) are special data types; (d) is the scene graph in the world editor
tommyettinger commented 4 years ago

Yeah, I'm still somewhat interested in implementing this feature, but I really don't understand the world format's docs, and I haven't found any (readable) existing code that can parse it. There's some seriously weird usage of DICT, which is described in one place as having string keys and string values, and completely different info in other places, including mixed types for values. If I could see some existing code that loads world scenes (I have not used the world renderer myself), that would help a lot.

superfrantv commented 4 years ago

Hello, have you read from the official documentation? this is used by magicavoxel, or ask Ephtracy? https://github.com/ephtracy/voxel-model

HurricanKai commented 4 years ago

The DICT is always string. You just have to parse that string into whatever format the actual value is

HurricanKai commented 4 years ago

Wouldn't say this is super readable, but it should work if you ignore all the Unity related stuff and just focus on the serializing bits (at the end) https://gist.github.com/HurricanKai/d63a36016167204bcf613d08d07d7e70

tommyettinger commented 4 years ago

Thanks! I'll take a look.

superfrantv commented 4 years ago

Hey Tommy, you can also ask Zarbuz, he has finished the chunk/world thing.

https://github.com/Zarbuz/FileToVox

tommyettinger commented 4 years ago

I just got onto the MagicaVoxel Community Discord, and noticed some discussion of the world hierarchy's complexities. I think I saw Zarbuz there, I'll ask about this in a bit.

HurricanKai commented 4 years ago

Didn't know that existed, will join that too, you can also DM me anytime (Kai#2345)

pointofpresence commented 4 years ago

any news?

tommyettinger commented 4 years ago

None! I did join the MagicaVoxel Community Discord (I'm TEttinger if you're there) but I didn't really know what to ask. I saw FileToVox mentioned often, so I'll probably look at how it handles this. I'm still also not sure what I'm going to do about another open issue regarding desaturation when rendering sloped voxels...

TBH IsoVoxel hasn't been a major priority for me lately; I've been writing lots of Java for another project, SquidLib, so a Java voxel renderer was a natural fit. I haven't tried to make that renderer general-purpose (its goal is to make isometric pixel art to supply as an asset library, not to render any voxel model); it's https://github.com/tommyettinger/isonomicon , it only does isometric views, and the results look pretty different. IsoVoxel was mostly hacked together 5-6 years ago, in C# because at that time it had a .vox parser written already, and C# is much easier for me to read than C/C++. I still don't know C# that well. I'll try to look into this, but I'm not especially optimistic about it being an easy change.

heenamkung commented 4 years ago

I just created a copy of my vox file (which contains multiple objects), and combined every object into a single object (using the "union" function in magicavoxel). I then drag that to IsoVoxel and voila.