Distort texture towards vanishing point (affine mesh?)
Posted: Sun Jun 05, 2016 5:36 pm
Earlier today I saw this post https://www.love2d.org/forums/viewtopic ... 84#p199220 and I thought the effect Jasoco created looked really cool. I'm making a simple game about dodging bombs right now and after seeing this I want to implement a kind of 2.5d ground in my game. I thought it would be pretty simple but it's turning out to be a huge headache for me.
Mainly, I want the ground to vanish towards the background, like a sheet of paper. Pretty much a plane tilted 30* from the camera. There won't be any objects on screen other than the ground, the player, flowers, bushes and bombs, so I should be able to just fake the 3d effect pretty easily if I can just make the ground distort correctly.
Something like this is what I want, the "correct" one.
My first idea was to write a fragment shader to do this for me, but that didn't work at all.
My next idea was to draw the texture of the ground to a mesh, and have that mesh be in a trapezoid shape. That kind of worked, but gave me the affine distortion shown above. I read that adding more vertexes should fix the issue, or at least correct it somewhat, but it looked like that no matter how many horizontal vertexes I added to the mesh.
Could anyone point me in the right direction for this? Messing with things like this is a bit of uncharted territory for me so I'm not even sure what to google haha. Thank you!
Mainly, I want the ground to vanish towards the background, like a sheet of paper. Pretty much a plane tilted 30* from the camera. There won't be any objects on screen other than the ground, the player, flowers, bushes and bombs, so I should be able to just fake the 3d effect pretty easily if I can just make the ground distort correctly.
Something like this is what I want, the "correct" one.
My first idea was to write a fragment shader to do this for me, but that didn't work at all.
My next idea was to draw the texture of the ground to a mesh, and have that mesh be in a trapezoid shape. That kind of worked, but gave me the affine distortion shown above. I read that adding more vertexes should fix the issue, or at least correct it somewhat, but it looked like that no matter how many horizontal vertexes I added to the mesh.
Could anyone point me in the right direction for this? Messing with things like this is a bit of uncharted territory for me so I'm not even sure what to google haha. Thank you!