Page 1 of 2

Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 3:56 pm
by Tjakka5
Hey there!

Inspired by Sprit3r I started work on a full out renderer for voxels, with a camera, z-buffers and everything else needed.
I am very pleased with the end result, so I cleaned it up and am now ready to release it.

Lovox works very similar to Love's image system, as in you load ModelData from a file (Or generate it at runtime), then generate a model which you can draw with that ModelData.

When you draw a model it gets passed into a buffer in the camera, which sorts it by depth, and renders all the models when it is told to do so.

Enough with the talk; have a few gifs:
3d3.gif
3d3.gif (1.53 MiB) Viewed 16589 times
3d1.gif
3d1.gif (4.91 MiB) Viewed 16589 times
3d2.gif
3d2.gif (735.33 KiB) Viewed 16589 times
Download it here: https://github.com/tjakka5/Lovox

Re: Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 4:33 pm
by s-ol
Do you have any y-shortening/perspective scaling? Because it looks like that's too weak, which makes things look skewed when the camera is rotating.

Re: Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 5:21 pm
by Tjakka5
s-ol wrote:Do you have any y-shortening/perspective scaling? Because it looks like that's too weak, which makes things look skewed when the camera is rotating.
I do not, but it shouldnt be too hard to implement.
That said, the models dont seem skewed to me, can you maybe explain what youre seeing?

Re: Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 6:50 pm
by s-ol
Tjakka5 wrote:
s-ol wrote:Do you have any y-shortening/perspective scaling? Because it looks like that's too weak, which makes things look skewed when the camera is rotating.
I do not, but it shouldnt be too hard to implement.
That said, the models dont seem skewed to me, can you maybe explain what youre seeing?
basically your stacking algorithmn draws this view by shifting higher layers further back, simulating a perspective like this:
Image

but your camera rotation and the way your single layers are drawn look like this:
Image

this means things look 'thicker' than they should and when you rotate the camera it gives a sort of 'fisheye' feeling. It's most noticeable in the gif of yours with the ships and signs.

Re: Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 7:42 pm
by Davidobot
Fantastic work! Really!
Borrowing from your mentioned Sprit3r, I made a .vox to your model format converter. Simply drag your .vox models into the window and retrieve them from your LOVE directory, from "Vox-to-Model Converter".

It uses the filename for the folder name.
Shout-out goes to kikito for his voxel libraries and to evgiz for his aforementioned Sprit3r.

Also, using MagicaVoxel for model editing makes making models a lot easier. Hence, why I "ported" over this converter.

Re: Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 8:26 pm
by Tjakka5
Davidobot wrote:Fantastic work! Really!
Borrowing from your mentioned Sprit3r, I made a .vox to your model format converter. Simply drag your .vox models into the window and retrieve them from your LOVE directory, from "Vox-to-Model Converter".

It uses the filename for the folder name.
Shout-out goes to kikito for his voxel libraries and to evgiz for his aforementioned Sprit3r.

Also, using MagicaVoxel for model editing makes making models a lot easier. Hence, why I "ported" over this converter.
Awesome!
Would you mind if I added this as a module to the library? Both as a way to convert .vox to .png, but also the ability to load in .vox's directly. (Obviously you wouldn't want to do that in a finished game, but it could be good for quick testing.)

On a side note, is the documentation good enough? I know it's pretty crummy, but does it atleast make the lib usable?

Re: Lovox - Load and render voxels in Love2d

Posted: Wed Nov 30, 2016 9:08 pm
by Davidobot
Tjakka5 wrote: Would you mind if I added this as a module to the library?
I would be honoured. Kikito's voxel library is under MIT license as far as I know.
Tjakka5 wrote: On a side note, is the documentation good enough? I know it's pretty crummy, but does it atleast make the lib usable?
It is usable in it's current state, but not very user-friendly. I would for one add more documentation about the camera (does it rotate around the origin, or the point where it's looking? A simple function list would be nice); and about the ModelData.

Does it detect a change in camera angle or sprite position itself to update, or does one need to do it manually?

Re: Lovox - Load and render voxels in Love2d

Posted: Thu Dec 01, 2016 2:27 pm
by Ulydev
Tjakka! Great work :)

Re: Lovox - Load and render voxels in Love2d

Posted: Thu Dec 08, 2016 8:41 pm
by Tjakka5
I feel so bad for not realizing this earlier.
The whole process can be much, MUCH faster by using shaders.

Excuse me for a few days while I redo the rendering code.

Re: Lovox - Load and render voxels in Love2d

Posted: Thu Dec 08, 2016 9:34 pm
by Zarty55
Tjakka5 wrote:I feel so bad for not realizing this earlier.
The whole process can be much, MUCH faster by using shaders.

Excuse me for a few days while I redo the rendering code.
That was exactly what I was trying to do right now. I'm not sure how would be the best way of handling voxels. I was trying to first do a simple vox renderer, but I'm not sure, it might end up being too slow with so many draw calls.