2

So, I'm currently developing a puzzle game of sorts, and I came upon something I'm not sure how to approach.

As you can see from the screenshot below, the text on the sides next to the main square is distorted along the diagonal of the quadrilateral. This is because this is not a screenshot of a 3D environment, but rather a 2D environment where the squares have been stretched in such a way that it looks like it's 3D.

I have tried using 3D perspective and changing depths, and while it solves the issue of the distorted sides, I was wondering if it's possible to fix this issue without doing 3D perspectives. Mainly because the current mesh transformation scheme took a while to get to, and converting that to something that works on 3D space is extra effort that might be avoidable.

I have a feeling this is unavoidable, but I'm curious if anyone knows a solution. I'm currently using OpenGL ES 1.

this is gonna be the best strategy / puzzle game evar!

genpfault
  • 51,148
  • 11
  • 85
  • 139
kamziro
  • 7,882
  • 9
  • 55
  • 78

3 Answers3

2

Probably not the answer you wanted, but I'd go with the 3d transformation because it will save you not only this distortion, but will simplify many other things down the road and give you opportunities to do nice effects.

Ani
  • 10,826
  • 3
  • 27
  • 46
2

What you are lacking in this scene is "perspective-correct interpolation", which is slightly non-linear, and is done automatically when you provide coordinates with depth information.

It may be possible to emulate it another way (though your options are limited since you do not have shaders available) but they will all likely be less efficient than using the dedicated functionality of your GPU. I recommend that you switch to using 3D coordinates.

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
0

Actually, I just found the answer. Turns out there's a Q coordinate which you can use to play around with trapezoidal texture distortion:

texture mapping a trapezoid with a square texture in OpenGL http://www.xyzw.us/~cass/qcoord/ http://hacksoflife.blogspot.com.au/2008/08/perspective-correct-texturing-in-opengl.html

Looks like it won't be as correct as doing it 3D, but I suppose it will be easier for my use right now.

Community
  • 1
  • 1
kamziro
  • 7,882
  • 9
  • 55
  • 78