I made a little demo showing what effects you can use quads for, a spinner.
The spinner spins the LÖVE logo around its own center in 3D and the script works with any Image. This is just a quick demo and the code is a bit messy
But it could easily be made into a library and even a stretch function between 4 points. And because everyone should be able to see this, the source image is a Power of 2 And the fact that it's very fast makes it even better, on my PC I get up to 800 FPS (with vsync disabled for testing purposes)
Feel free to comment
3D Spinner
- TechnoCat
- Inner party member
- Posts: 1612
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: 3D Spinner
This is brilliant. Now someone go remake GTA. Or even possibly include this in that raycasting demo.
Re: 3D Spinner
I just wanted to report it even runs on my old computer with Windows using its software GL renderer at about 20 to 40 FPS. That was much better than I expected, considering that most LÖVE programs just crash on it.
I'll see if I can do a little write-up about the math involved here at some later time, and look at how well this can be adapted to a more general case. This is not to prevent anyone else from doing the write-up first, of course
Good show, Kalle.
I'll see if I can do a little write-up about the math involved here at some later time, and look at how well this can be adapted to a more general case. This is not to prevent anyone else from doing the write-up first, of course
Good show, Kalle.
- TechnoCat
- Inner party member
- Posts: 1612
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: 3D Spinner
It just creates a quad for each column.
Re: 3D Spinner
I didn't imply that it would be hard to understand, just that it might be interesting to go over it in some detail and also see how well the technique generalizes. You know, because it is cute.
Re: 3D Spinner
Hmm.. making this stretching between 4 points is a bit harder than I thought. If ImageData supported pasting quads (or more important, scaling ) this would be a piece of cake.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: 3D Spinner
I too wish we could specify X and Y coordinates for each corner of an image. We could do some nifty fake 3D effects like Coverflow and such.
I could make my 2D adventure engine into a pseudo PSX-style half-3D game.
I could make my 2D adventure engine into a pseudo PSX-style half-3D game.
Re: 3D Spinner
I really have to stop distracting myself with this LÖVE 3D business. There are real 3D APIs, you know. Well, okay okay, this is done for fun. I understand.
And since I am posting yet again, I have something useful to say too. What this method could possibly approximate in its most general form is known as perspective correct texture mapping. Reading about it might be helpful if you are intent on hacking together something like this in LÖVE.
http://en.wikipedia.org/wiki/Texture_ma ... orrectness
I confess I have a perverse fascination as to how fast it can be made, but I must really not start working at it myself. I. Must. Not.
And since I am posting yet again, I have something useful to say too. What this method could possibly approximate in its most general form is known as perspective correct texture mapping. Reading about it might be helpful if you are intent on hacking together something like this in LÖVE.
http://en.wikipedia.org/wiki/Texture_ma ... orrectness
I confess I have a perverse fascination as to how fast it can be made, but I must really not start working at it myself. I. Must. Not.
Re: 3D Spinner
This is somewhat relevant to the topic.
I suggested a new feature for a future version of LÖVE, namely shear mapping. It's a transformation that can help in building pseudo-3D effects, and will perhaps find some use as a result.
http://en.wikipedia.org/wiki/Shear_mapping
http://love2d.org/forum/tracker.php?p=2&t=193
The math in the Wikipedia article is not an exact match with what is appropriate for LÖVE.
I have taken a PNG screenshot of the program I posted into the feature suggestions. It shows a rectangular array of circles sheared (shorn?? no way) with the parameters 0.2 and 0.1 . The image is hosted at imgur to avoid making you download it (unless you want to), though it is only 42.7 KB by the looks of it.
http://imgur.com/UA7HJ
Let's hope the LÖVE devs decide to include it in a future version.
I suggested a new feature for a future version of LÖVE, namely shear mapping. It's a transformation that can help in building pseudo-3D effects, and will perhaps find some use as a result.
http://en.wikipedia.org/wiki/Shear_mapping
http://love2d.org/forum/tracker.php?p=2&t=193
The math in the Wikipedia article is not an exact match with what is appropriate for LÖVE.
I have taken a PNG screenshot of the program I posted into the feature suggestions. It shows a rectangular array of circles sheared (shorn?? no way) with the parameters 0.2 and 0.1 . The image is hosted at imgur to avoid making you download it (unless you want to), though it is only 42.7 KB by the looks of it.
http://imgur.com/UA7HJ
Let's hope the LÖVE devs decide to include it in a future version.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: 3D Spinner
It'll only be useful if it can be skewed as well. In that one edge is shorter than the other. Then you'd have real perspective.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest