tommyettinger / IsoVoxel

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

Bigger export doesn't have all frames #5

Closed Inateno closed 6 years ago

Inateno commented 6 years ago

Hi,

That's an astounding software you made here, very cool! (should be featured in magicavoxel lol).

Anyway, I have a problem with the custom size export, it doesn't export the other angle (and not the same rendering), some small exports are perfect but wayyyyyyyyyy to small.

Any information about how to proceed (if there is) or maybe you can lead me to the appropriate code file? Not sure I'll get all of it but I imagine it's mainly configuration, no?

Thanks!

tommyettinger commented 6 years ago

Hello, and thanks! I'm not sure what you mean in the issue title; I just drag+dropped Red_Fish_Animated.vox onto IsoVoxel.exe and I got all sorts of sizes of all the frames, though only in North, South, East, and West facing. One file, for example, is Red_Fish_Animated_Size3_W_02.png . The other facings I'll work on now.

Currently the larger sizes aren't implemented in a very sophisticated way, but I think I can get the isometric angles (like facing northeast) to be produced along with the larger orthogonal angles (like facing north). The "slope" renders are probably the ones you have seen with a different rendering; they use more than just cube-shaped voxels and act kinda like marching cubes in MagicaVoxel (they just widen corners instead of thinning them). The slope renders have a different palette they use, I think because each slope has an estimate on how it should be shaded based on how it faces a light source (presumed to be in the upper left of the screen).

Almost all of the code is smashed into PaletteDraw.cs , but a small amount is in TransformLogic.cs . I'm by no means an expert at C#, so the code is probably not the best, and it's only made worse by how much copy-paste coding I've done here (large parts were first written in another project and copied over). I think I can handle this in the next few days, though making the slope palette match the other colors could take longer.

There also seems to be an issue in the current version where the different facing directions produce differently-sized images, which I thought I had handled earlier. I'll try to fix it along with adding isometric renders at larger sizes, and release that as 0.0.11; if the palettes are easy enough those may also be in that release, or delayed to 0.0.12 .

Inateno commented 6 years ago

Hey, sorry it looks like a word disappeared lol.

I just checked, with the default "ch_sword" coming with last MagicaVoxel, the bigger export I've been able to do so far is 202*312 (named chr_sword_Size10_E_00), is there a maximum size allowed?

Maybe this size is enough (not all the time, for big stuff for exemple) but I don't have isometric views with this one.

And also the rendering is not as good as what Magica do when exporting to iso (through Magica), but Magia doesn't export all angles (only isometric) so actually I just do screenshot in rendering mode then cut in Paint.net XD (not the best I know).

Thanks for the information, will try it out later.

tommyettinger commented 6 years ago

There's no technical maximum size to the bigger renders, but I think the rendering seriously slows down when it needs to make lots of the much-bigger sizes. I'll try ch_sword out next. Currently (in the latest commit, not in a release) the larger renders look like this on a 12x12x8 voxel model:

red_fish_animated_size2_nw_07 red_fish_animated_size2_s_07

(I think there's currently a bug with the top-side shading for the one facing south.)

Before (in the 0.0.10 release), the bigger renders looked like: red_fish_animated_size2_s_07

At even larger sizes, the 0.0.10 bigger renders stayed smooth and pixel-based, but relatively small compared to the new ones. They also appeared very flat, without much shading. They used a different technique that rendered voxels as individual pixels, and it definitely had some issues. Currently (in the latest commit) the larger sizes use the same technique as the existing normal-size non-Slope renders, so they're much larger but visibly blocky. In both versions, they enlarge the existing model, smooth out the corners of the enlarged model by adding and removing voxels with a cellular automaton technique (called RunCA() in TransformLogic, I think), and then render the changed model. I'm guessing you primarily want the renders to be visible on something like a phone screen, so image size is a main priority. I'll go ahead with the blocky approach and maybe try to get it to work with slopes, which would add an option that's less blocky.

Inateno commented 6 years ago

Thanks for that additional information.

Here is the render Magica is giving me on a 126126126 cube with the iso export. monster

The monster is around 945460. Image size is 637*547 (but I have no control on this)

The char sword Magica file is 212020.

But the render you have is pretty cool (better than the smoothy one), at least it's isometric when actually the "biggest" render doesn't give me those isometric: image

So at least that would be a nice progression because it is painful!

tommyettinger commented 6 years ago

I'm almost done with the changes; I think I may add some more outline options so the shaded outline doesn't always have to form a hard, 90-degree angle, and then I should be able to release a new version that provides the very-large-size renders. Here's a size-10 non-slope version of the deer model that came with MagicaVoxel 0.98.2, facing on a diagonal: deer_size10_ne_00

Here's a work-in-progress size-10 slope version of the same model, with the new orthogonal sloped voxels: deer_size10_slope_e_02

This version has corner outlines that are too sharp compared to the other renders, so I would like to adjust that. It also seems to be shading too eagerly, and there's some long lines of shading that shouldn't probably be there.

Inateno commented 6 years ago

Nice this is a good size now XD Do you think you can make available the rendering close to cubic voxel with this size? I do prefer the rendering I showed you instead of this one trying to edge-cut everything.

This rendering is also nice I would probably use it in the future but I want my current game to look as I'm designing in Magica ^^

Good job btw ;)

tommyettinger commented 6 years ago

Sure, the current version has the smoothed connections in all directions for all sizes, available here, but I'll put together a quick mode that doesn't smooth by adding extra voxels. I think I can have an early release of that today/tonight; I think it will just make it so when the "m" size multiplier is negative (like IsoVoxel.exe chr_sword.vox 20 21 20 -10), it uses only cubes, like in the MagicaVoxel editor, but still uses multipliers up to m (so, 10 here).

tommyettinger commented 6 years ago

And it's almost ready; the deer looks like this now: deer_size6_nw_03 deer_size6_n_03

tommyettinger commented 6 years ago

OK, this is now in release 0.0.12, and I think any problems mentioned in this issue are now resolved. I'll close this issue in a day or two unless you find something that should be changed in release 0.0.12, and feel free to reopen the issue if you find a bug later.

If you have any links to projects you're using IsoVoxel on, I would really like to see what people are making.

Thanks for using IsoVoxel!

Inateno commented 6 years ago

Hey nice! I close the issue now and I go test this, if I have any issues I'll re-open or make a new ticket.

Yeah sure here is the link of the game I made during the Ludum Dare 42, actually I didn't use IsoVoxel because of the issue ^^ but now I will! (I will comment tonight the export rendering on my character, actually exporter via screenshot in Magica -_-). Voiders.io on LD42

There is some stuff which I'm not exporting in 8 directions, but I will give a shot to rendering everything through IsoVoxel and check it.

Here is the sprite of the character actually sprite

(it would be twice amazing if a software can make the sprite like this XD)

Inateno commented 6 years ago

Just passing by to leave a feedback about the new version. It's cool, size is very big, here are few rendering image

wall_big_se

On the monster, the mouth is strange compared to the pure voxel version but it's ok. monster_big_nw

So far so good, but I just see that it is not working with Magica 0.99.1a scenes (multiple objects in the same file), maybe a future release ;) (but it's okay I just export them one by one).

tommyettinger commented 6 years ago

Huh... the mouth suggests there's some improvements that can be made to smoothing. Was that rendered with a negative "m" parameter, as in IsoVoxel.exe monster.vox 126 126 126 -10 ? Using negative sizes should disable smoothing, resulting in the types of image I posted earlier, like this one: image

I definitely see some voxels in the monster image that are positioned on a finer-scale grid (which happens in the larger-size and "big" renders when smoothing is used), and some are being placed between the dark face of the monster and the red voxels that extend forward to make the mouth. To address this, you could disable smoothing (which you can do by using a negative size and using the "Size8" or similar size versions instead of the "Big" versions; "Big" is just double-size with a different kind of smoothing always on). You could also make the red voxels part of a flat face instead of sticking out (which needs changes to the model). Other than those options, I'm not sure what could be done to prevent that effect. Either the black or the red voxels will extend into where there is a corner whenever smoothing is used there.

If you want to post any files for me to try to render, I think you can zip them and just drag-and-drop onto a post here.

Inateno commented 6 years ago

Ah don't worry it's ok, I'll try the negative argument or changing the model! (it's not a big deal). Thanks ;)