## Lovox - Load and render voxels in Love2d

Tjakka5
Party member
Posts: 240
Joined: Thu Dec 26, 2013 12:17 pm

### Lovox - Load and render voxels in Love2d

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 (1.53 MiB) Viewed 9358 times
3d1.gif (4.91 MiB) Viewed 9358 times
3d2.gif (735.33 KiB) Viewed 9358 times
Last edited by Tjakka5 on Wed Nov 30, 2016 9:47 pm, edited 1 time in total.
Check out my portfolio: http://tjakka5.sorunome.de/

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: Lovox - Load and render voxels in Love2d

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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

Tjakka5
Party member
Posts: 240
Joined: Thu Dec 26, 2013 12:17 pm

### Re: Lovox - Load and render voxels in Love2d

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?
Check out my portfolio: http://tjakka5.sorunome.de/

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: Lovox - Load and render voxels in Love2d

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:

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

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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

Davidobot
Party member
Posts: 1155
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

### Re: Lovox - Load and render voxels in Love2d

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.
Attachments
GenerateModelFromVox.love
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

Tjakka5
Party member
Posts: 240
Joined: Thu Dec 26, 2013 12:17 pm

### Re: Lovox - Load and render voxels in Love2d

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?
Check out my portfolio: http://tjakka5.sorunome.de/

Davidobot
Party member
Posts: 1155
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

### Re: Lovox - Load and render voxels in Love2d

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?
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

### Re: Lovox - Load and render voxels in Love2d

Tjakka! Great work

Tjakka5
Party member
Posts: 240
Joined: Thu Dec 26, 2013 12:17 pm

### Re: Lovox - Load and render voxels in Love2d

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.
Check out my portfolio: http://tjakka5.sorunome.de/

Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

### Re: Lovox - Load and render voxels in Love2d

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.

### Who is online

Users browsing this forum: No registered users and 5 guests