Sprit3r - 3D model viewer for spritesheets

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
evgiz
Citizen
Posts: 83
Joined: Mon Aug 29, 2016 11:05 pm
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by evgiz »

kikito wrote:It's probably that my parser has a bug. I'll give it a look, thanks!
It looks like the voxel is included, but all color values are set to 0 in the texture which is why I couldn't see it
Computer science student and part time game dev! Currently working on Depths of Limbo! :cool:

Check out the game website DepthsOfLimbo.com! :ultrahappy:
And my personal website with all my projects evgiz.net! :megagrin:
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by s-ol »

evgiz wrote:
kikito wrote: The next step I want to take is where our paths divert: Instead of rendering the slices directly, I want to try using the texture as a 3d texture and render it using a shader, as explained here and here. But I don't know if I will be able to do it.
I don't know enough about shaders to do this myself, but I look forward to seeing what you can come up with!
Does löve have 3d texture support? Which formats can do that?

If it does the rendering should be rather straightforward, the only thing I'm not sure how to do is casting a ray into the 3d texture to find the first pixel hit (and doing it better than just looping over it).

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
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by kikito »

evgiz wrote:
kikito wrote:It's probably that my parser has a bug. I'll give it a look, thanks!
It looks like the voxel is included, but all color values are set to 0 in the texture which is why I couldn't see it
Hi, I am having trouble reproducing this. Can you pass me your current code + the vox model that you are using for tests?
When I write def I mean function.
User avatar
evgiz
Citizen
Posts: 83
Joined: Mon Aug 29, 2016 11:05 pm
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by evgiz »

kikito wrote: Hi, I am having trouble reproducing this. Can you pass me your current code + the vox model that you are using for tests?
Yeah of course. Here is a love file, just click the example button and it'll load up example.vox
sprit3r-voxelerror.love
(3.14 MiB) Downloaded 124 times
As you can see on the bottom spritesheet there's a black pixel on the cyan circle, the last voxel I placed.

The code is pretty much the same as the one in your example, but tweaked to flip the model (it was upside down) as well as rendering any pixels with 0 alpha at 255 alpha so you can actually see them.

EDIT: Solved it! I changed this line in vox_model:readChar from self.str:len() to self.str:len()+1

Code: Select all

if self.index > self.str:len()+1 then return 0 end
I'm not exactly sure what it does, but it seems to work... Thanks for all your help!
Last edited by evgiz on Thu Nov 03, 2016 11:20 pm, edited 3 times in total.
Computer science student and part time game dev! Currently working on Depths of Limbo! :cool:

Check out the game website DepthsOfLimbo.com! :ultrahappy:
And my personal website with all my projects evgiz.net! :megagrin:
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Sprit3r - 3D model viewer for spritesheets

Post by Tjakka5 »

Hey,

Your post inspired me to mess around with the same concept of 2d sprites to 3d display.
So far I've got "models" as well as animations working with a simple camera, but there's one thing I'm still missing...

In your application you can switch between "flat" and "voxel" mode.
How did you achieve the "voxel" mode? I've looked trough your code, but can't figure it out.

Thanks in advance!
User avatar
evgiz
Citizen
Posts: 83
Joined: Mon Aug 29, 2016 11:05 pm
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by evgiz »

Tjakka5 wrote:In your application you can switch between "flat" and "voxel" mode.
How did you achieve the "voxel" mode? I've looked trough your code, but can't figure it out.
Thanks in advance!
To render voxels I simply draw each layer multiple times depending on the zoom and model scale so that they cover every pixel inbetween. This is veeery inefficient, but works fine for a single model. If you're planning on making a game I'd recommend finding an approach with better performance, for instance by pre rendering at set angles, clever spritebatching or something else.
Computer science student and part time game dev! Currently working on Depths of Limbo! :cool:

Check out the game website DepthsOfLimbo.com! :ultrahappy:
And my personal website with all my projects evgiz.net! :megagrin:
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by s-ol »

Oh just by the way - i had also seen the reddit post and tried around with the concept for a little, but I got sidetracked and made this animation:
Image
the way it is rendered is the same except that the rotation is different between the layers most of the time, and the layer density is animated. Sprites could simply be substituted for the rectangles though.

and since apparently noone linked the thread, here is the original one on reddit with links to explanation videos and the games.

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
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by zorg »

evgiz wrote:I'm not exactly sure what it does, but it seems to work... Thanks for all your help!
It was an off-by-one indexing error; the code assumed that the array was zero-based (0 to length-1), but apparently, it's one-based (1 to length)
Interestingly, it should have also ignored the 0th (or, first) value before, as well, not just the last... i think.

In any case, i löve this project! Hope it keeps being relevant :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by D0NM »

The Sprit3r idea is very great. Way to go!
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

Re: Sprit3r - 3D model viewer for spritesheets

Post by Ulydev »

I love it! You should put it on Github if it isn't already :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 146 guests