I’m trying to do something which I thought would be relatively simple but I don’t get the output as expected.
I’m attempting to use the Homography on a texture transform pin to sample a specific region of an image. BUT! when moving the X&Y of each of the 4 homography points the output behaves in a strange way. If for example I try and sample a trapezoidal section of an image by using texture transform the image transforms in a strange way.
I’ve tried experimenting with scaling the transform and projection space transform ut i cannot get it to behave as i wish. Can anyone see what im missing here? Very simple patch attatched!
Homography Texure Transform.v4p (6.1 kB)
I constantly get confused about how textures work and either try a lot or do it like this.
HomographyAdjustTexture.v4p (15.3 kB)
Thanks Sunep, that’s a great help! I still don’t fully understand how the texture works but this is a great start!
just a brief note: homography is a perspective transformation, thus it alters the w part of the 4d homogeneous coordinates and since the common texture sampler does only take 2d coordinates, it cannot do perspective texture lookups. i assume one could write a shader and apply the perspective stuff before and divide the texture coordinates by w or use one of the many special texture lookup methods, but i think sune’s solution is more clear to the user and not slower.