Page 3 of 4

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Fri Nov 04, 2016 11:24 pm
by kikito
evgiz wrote:
kikito wrote:
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
Emm... are you sure that's the only change you did? I have tried that and it gives me a bad result with your code. Can you upload the version which works fine?

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Sat Nov 05, 2016 5:03 pm
by evgiz
That animated purple cube is amazing, it looks very "organic" if that makes any sense. Might have to play around with that :P
I'll see if I can get the project on github soon too!
kikito wrote:Emm... are you sure that's the only change you did? I have tried that and it gives me a bad result with your code. Can you upload the version which works fine?
Check out the .love in my original post, its the updated version. Im pretty sure I only changed that line in vox_model and another line in vox_texture (to flip the image), could be wrong tho... But anyways I got it to work so no need to take any more of your time :)

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Sat Nov 05, 2016 9:32 pm
by s-ol
evgiz wrote:That animated purple cube is amazing, it looks very "organic" if that makes any sense. Might have to play around with that :P
I'll see if I can get the project on github soon too!
kikito wrote:Emm... are you sure that's the only change you did? I have tried that and it gives me a bad result with your code. Can you upload the version which works fine?
Check out the .love in my original post, its the updated version. Im pretty sure I only changed that line in vox_model and another line in vox_texture (to flip the image), could be wrong tho... But anyways I got it to work so no need to take any more of your time :)
the code is very simple, but in moonscript: https://github.com/s-ol/demoloops/blob/ ... d.moon#L31

converted to Lua:

Code: Select all

      local width, height = lg.getDimensions()
      love.graphics.translate(width / 2, height / 2 + 70)
      
      local function draw(i)
        love.graphics.push()
        love.graphics.translate(0, -120 * i)
        love.graphics.scale(1, 0.5) -- perspective shortening
        love.graphics.scale(1 - 0.1 * math.sin(self.time + i * 2)) -- pyramid/bulge effect
        love.graphics.scale(0.8 - i * .4 * math.cos(self.time)) -- global zoom
        love.graphics.rotate(self.time / 4) -- global rotation
        love.graphics.rotate(i * .6 * math.cos(self.time)) -- skewing
        love.graphics.setColor(self.shades[i])
        love.graphics.rectangle("fill", -80, -80, 160, 160)
        return love.graphics.pop()
      end
      
      for i = 0, 1, 1 / (20 + 19 * math.sin(self.time / 2)) do
        draw(i) -- this does all the 'stacking' magic
      end
      draw(1)
time is just incremented by dt every update and loops after 4*math.pi (two full rotations in seconds).

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Sun Nov 06, 2016 2:37 pm
by evgiz
s-ol wrote: the code is very simple, but in moonscript: https://github.com/s-ol/demoloops/blob/ ... d.moon#L31
Impressive result in such a few lines of code!
Ulydev wrote:I love it! You should put it on Github if it isn't already :)
Here it is! https://github.com/evgiz/sprit3r

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Sun Nov 06, 2016 6:06 pm
by thatcosmonaut
this tool looks amazing, about to play around with it now.

If you wouldn't mind, could you add a license to the github repository? If you don't know which one to choose this site helps you decide: http://choosealicense.com/

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Sun Nov 06, 2016 6:43 pm
by zorg
thatcosmonaut wrote:this tool looks amazing, about to play around with it now.

If you wouldn't mind, could you add a license to the github repository? If you don't know which one to choose this site helps you decide: http://choosealicense.com/
That site's missing the best license of them all :P :3

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Sun Nov 06, 2016 7:30 pm
by evgiz
It's my first time using github for my own project, so I overlooked the need for a license. I've added the MIT one now, thanks for the heads up!

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Mon Nov 07, 2016 11:18 pm
by kikito
I was still finding some weird stuff so I have done more tests and found an error: in the generation of the texture, point coordinates need to be offset by 0.5 on the x and y coordinates in order to be precise. Otherwise, pixels might be drawn at the wrong coordinates.

I sent a pull request on Github.

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Fri Dec 30, 2016 12:47 pm
by raingloom
Since I'm not a pixel artist but wanted to try it, I kinda messed up and noticed two bugs in the process:
  • single frames mess it up, the UI still works but only the menu button has an effect and loading doesn't work either, also, the layer distance gets set to infinity (this is why one should always consider edge cases, someone (me) will be stupid enough to try them)
  • it can only handle frames in rows, not in columns (the editor i used defaulted to the latter)
I'll send them as issues on GH

Re: Sprit3r - 3D model viewer for spritesheets

Posted: Fri Dec 30, 2016 1:28 pm
by evgiz
raingloom wrote: Single frames mess it up, the UI still works but only the menu button has an effect and loading doesn't work either, also, the layer distance gets set to infinity (this is why one should always consider edge cases, someone (me) will be stupid enough to try them)
Not sure I understand exactly what you mean by this. If there's only one layer? Like a square image? Should probably be an easy fix.
raingloom wrote: It can only handle frames in rows, not in columns (the editor i used defaulted to the latter)
This was intentional, but I can see how its kinda limiting. It'd be preferable to have a choice here (perhaps even selecting tiles manually) but I'm not sure I can find the time to implement that myself.

Thanks for the feedback!