## Skewing/Shearing and Canvases

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
meganukebmp
Prole
Posts: 8
Joined: Thu Jan 07, 2016 10:38 pm
Location: Sofia, Bulgaria

### Skewing/Shearing and Canvases

Hey, I'm trying to skew a background with objects that are updating each frame. I thought about drawing them on a canvas and then using graphics.shear on it but the canvas remains static. Is there a way to apply any type of translation effect on multiple objects while still updating them?
Here is a pic of what I am trying to do. Black rectangles have to be able to update. Red is the canvas on which all the objects are being drawn.

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: Skewing/Shearing and Canvases

love.graphics.shear should work with and without canvas'. Are you sure you know how to use it? Or do you experience the bug from the wiki page?

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

meganukebmp
Prole
Posts: 8
Joined: Thu Jan 07, 2016 10:38 pm
Location: Sofia, Bulgaria

### Re: Skewing/Shearing and Canvases

S0lll0s wrote:love.graphics.shear should work with and without canvas'. Are you sure you know how to use it? Or do you experience the bug from the wiki page?
Nvm what I just said. I fixed the canvas not working. I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.

micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

### Re: Skewing/Shearing and Canvases

meganukebmp wrote:I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
It is not possible to create a perspective effect using shearing. When you shear an image, then parallel lines always stay parallel.

meganukebmp
Prole
Posts: 8
Joined: Thu Jan 07, 2016 10:38 pm
Location: Sofia, Bulgaria

### Re: Skewing/Shearing and Canvases

micha wrote:
meganukebmp wrote:I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
It is not possible to create a perspective effect using shearing. When you shear an image, then parallel lines always stay parallel.
Is there another way to do it then? Are there any libs that allow me to achieve this?

Jasoco
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

### Re: Skewing/Shearing and Canvases

meganukebmp wrote:
micha wrote:
meganukebmp wrote:I cant figure out how to use shear to achieve this effect though. Since I cant just skew it vertically from the center. I'm missing something.
It is not possible to create a perspective effect using shearing. When you shear an image, then parallel lines always stay parallel.
Is there another way to do it then? Are there any libs that allow me to achieve this?
A user named xXxMoNkEyMaNxXx made one for me once for a project, but it's a bit finicky in some projects depending on how they're made, and has some problems. It's a shader. And 0.10.0 breaks it slightly over the fixed 0.9.x version. But here's a post where a 0.9.1 fix was made by someone:

viewtopic.php?f=3&t=2198&p=174908&hilit ... ry#p174908

It'll probably need tweaking of course.

bobbyjones
Party member
Posts: 728
Joined: Sat Apr 26, 2014 7:46 pm

### Re: Skewing/Shearing and Canvases

You would be able to do it with love3d I played with a little bit and cpml's mat4 already has perspective in it. I only used the ortho but im sure the perspective would work as expected. I recommend going to their forum and download their demo from the second to last page and use that as a base to mess with. If you have any trouble with it then join irc and talk to holo or karai they made it.
https://github.com/excessive/love3d
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

### Who is online

Users browsing this forum: No registered users and 23 guests