Image perspective transformation

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
DiegoG
Prole
Posts: 20
Joined: Sat Apr 29, 2017 2:43 am
Location: Venezuela

Image perspective transformation

Post by DiegoG »

Hello! Thanks for viewing my thread
The thing I want to ask about is what's the best possible way to 'apply' perspective into an image
I've thought a bit about it and the answer I've thought of is to go along the y axis from the bottom to the top of an image and change the width little by little as it goes up -- But I'm not sure how to actually pull it off, I'll be glad to hear any and all suggestions/answers, thanks :D



Also, added to this, this is specifically for terrain in my game. I planned on making two canvases, one slightly larger than the scissor of the drawn screen (The scissor I'm applying for the final product of what's about to be drawn on-screen) to draw the un-transformed piece of terrain that's going to be rendered, and have it transformed and drawn in the second canvas, that's the same size as the scissor. That way it's transformed and drawn on screen efficiently, and on the next frame, both canvases are simply cleared so they can be drawn on again. I'd like to know if there was an easier way/more performance efficient way to do this, thanks in advance!
function earth:destroy()
00count=5000
00while count>0 do
0000lg.draw(explosion,math.random(0,600),math.random(0,800))
0000count=count-1
00end
00earth = nil
00print("Earth has been destroyed.")
end
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Image perspective transformation

Post by pgimeno »

This might help with the perspective part: https://love2d.org/forums/viewtopic.php?f=5&t=12483 , and in particular https://love2d.org/forums/viewtopic.php ... 27#p212027 which is a port to 0.10.2.
Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests