Are there any ways / functions to distort images like this in löve?
Original:
Distorted:
Just wondering...
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Just wondering...
Perhaps with some rotate/scale/rotate combo?
Help us help you: attach a .love.
Re: Just wondering...
No, you would need a 'shear' transformation, which is not supported by love.graphicsRobin wrote:Perhaps with some rotate/scale/rotate combo?
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Just wondering...
Darn. That would be /really/ handy. It wouldn't be so complex to do (assuming Love renders each image as a 2-polygon rectangle)... Maybe we should request this feature?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Just wondering...
I'd say so, especially if there's already an OpenGL or SDL API call to do that, which just has to be exposed.
Help us help you: attach a .love.
Re: Just wondering...
Im sure I've seen this been done in the "3D Dice" game:
http://love2d.org/forums/viewtopic.php?f=5&t=1692
... to draw the faces of the dices.
http://love2d.org/forums/viewtopic.php?f=5&t=1692
... to draw the faces of the dices.
- Jasoco
- Inner party member
- Posts: 3725
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Just wondering...
It only skews. It doesn't distort.
Re: Just wondering...
Indeed!Robin wrote:I'd say so, especially if there's already an OpenGL or SDL API call to do that, which just has to be exposed.
I guess that would work too.Jasoco wrote:It only skews. It doesn't distort.
- Jasoco
- Inner party member
- Posts: 3725
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Just wondering...
The Dice thing fooled me at first too until I noticed that the images that were being used for faces could only be skewed like a rhombus. Rather than distorted over a trapezoidal shape which is the main ingredient for making textured 3D polygons.
Once Löve can do distorted images shaped to any polygon mask, we'll be able to do real 3D. If only low-polygon. Though people have proven Löve is pretty powerful in the past and can do a lot of stuff really fast while keeping a fair enough framerate.
We'll need to be able to:
A) Define a polygon shape with 3 or more sides
B) Apply an image to that shape
C) Adjust the image's base coordinates and rotation
love.graphics.texturedPoly(image, quad, imageoffsetX, imageoffsetY, imagerotation, imagescale, x1, y1, x2, y2, x3, y3 ...)
Or something like that. Maybe simpler. Of course the points portion would accept an array of X and Y coordinates if need be.
Once Löve can do distorted images shaped to any polygon mask, we'll be able to do real 3D. If only low-polygon. Though people have proven Löve is pretty powerful in the past and can do a lot of stuff really fast while keeping a fair enough framerate.
We'll need to be able to:
A) Define a polygon shape with 3 or more sides
B) Apply an image to that shape
C) Adjust the image's base coordinates and rotation
love.graphics.texturedPoly(image, quad, imageoffsetX, imageoffsetY, imagerotation, imagescale, x1, y1, x2, y2, x3, y3 ...)
Or something like that. Maybe simpler. Of course the points portion would accept an array of X and Y coordinates if need be.
Re: Just wondering...
As cool as that would be, it would introduce another problem:Jasoco wrote:love.graphics.texturedPoly(image, quad, imageoffsetX, imageoffsetY, imagerotation, imagescale, x1, y1, x2, y2, x3, y3 ...)
How to map the texture onto the polygon? Where is the "origin" of the texture to take the offset from?
More technically: What texture coordinates to assign to the vertices (xi,yi) of the polygon?
I suppose you could introduce something like love.graphics.texturedPolygon(image, x1,y1,u1,v1, ...) where u and v denote texture coordinates; but that seems rather unlövely.
on another note: love-glsl is probably capable of such things...
Who is online
Users browsing this forum: Google [Bot] and 39 guests