Let's say I have a road I'm looking at from the top, have a square on it. Then I have a different location from which I look at the road, the square now is a convex quadrilateral.
https://i.stack.imgur.com/KRljZ.png
I have a square shaped texture I want to put inside this quadrilateral (which is a square with perspective distortion), I can use this method and it works perfectly : Finding the Transform matrix from 4 projected points (with Javascript)
Now if I have an image of a road and I select the edges of the quadrilateral on it to determine a perspective plane. How can I calculate the perspective projection of squares I draw onto the other sides of the image? The oculus point is not known. https://i.stack.imgur.com/ZZ7cq.png
For the plane's equation I should be able to use any 3 edge points of the quadrilateral, where: based on the other post's step 6, I compute (x,y,z) of these points.
From there on I am very confused how to and what to do, mostly because I can't imagine how things would look.
Maybe it has to do something with rotation of the plane, which if not related would still be nice to know, because I draw the initial square based on a vector and rotate the texture accordingly, with a downwards looking vector it will look like this and I want to correct it (ignore the diagonals, also the arrow is not perfectly centered) https://i.stack.imgur.com/12nJY.png
Found a gimmicky solution there :https://stackoverflow.com/questions/76134/how-do-i-reverse-project-2d-points-into-3d
Unfortunately it is too slow for my use case, so I have to scrap it altogether.
– Krend Jan 24 '19 at 08:23