Download

Corrected Affine Texture Mapping (PS1 Style)

So I’ve been messing around with ways to replicate Affine Texture Mapping from the PS1 era in Unreal.

I found a few resources online with similar information, so I’ll credit both of them here as I don’t know who the original author was. The problem with the code I found is it rarely works the way you’d want it to, often heavily distorting random areas of meshes far beyond acceptable values. I messed around with different conversion methods and came up with a Revised version that as far as I know, works perfectly! Taking input from the Camera’s Relative Position instead, and transforming that to Camera Space replicated the Affine Texture Mapping we all knew and still love. There’s a clamp value to keep it from getting too crazy, and at higher values can warp the distance instead of the surrounding camera view. Code will be posted below, have fun!

CODE - Corrected Affine Texture Mapping posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4

Original Code by Gossy and bezzalel3d

Image Ver.

EDIT: You’re going to want to use this on Walls, Floors, and Ceilings only. This method uses vertices to distort the texture, so the lower the polycount the better the result.

That’s the exact opposite of how affine mapping should work. That’s why PS1 games subdivide their geometry close to the camera to reduce the distortion because the more the polygons the better. But I understand not wanting to deal with that.