Perspective correct texturing without d3d
Filed under: Game Maker

I whipped this up after someone posted on the GMC asking about it. Mark’s naiive approach to drawing in version 6 and above resulted in it having a d3d and normal mode when both are esentially the same thing. Enabling d3d makes a number of things impossible. Mainly, surfaces. Not having d3d makes other things impossible like zbuffer and perspective correct texturing.
If you ever try to draw a skewed or distorted polygon with textures, you’ll see that there’s a weird artifact. Unfortunely only Mark can fix this, but we can approximate a solution by subdividing our polygon into several segments and interpolating the texture coordinates for them. By providing properly calculated UVs to each segment, we reduce the error the renderer produces by giving it more clues as to what the UV values should actually be.







September 10th, 2009 at 5:48 pm
Hi! I was surfing and found your blog post… nice! I love your blog.
Cheers! Sandra. R.
September 13th, 2009 at 10:10 am
Do you think we should submit this as a bug to be fixed in GM 8?
September 13th, 2009 at 10:24 pm
You can try.
My solution to Game Maker’s problem is Aziel =)
October 16th, 2011 at 5:35 pm
Thanks for your post The Master, I needed a simple perspective corrected polygon to simulate flowing water in a 2d game (GM8.1), and I think I’ll adopt your solution