Tips on Creating Perspective with Image Assets
Hello
I made a filter a PathEffect that can be applied to Vectors to transform the vertices in a “3D space” then project them back to 2D. that works well, and the ability to apply this through an EffectGroup is really cool (wish there was a way to select multiple shapes and apply the EffectGroup to all selected shapes simultaneously)
However I found an usecase where I need to apply this to a Raster Image. My first instinct was to use 4 Bones and mesh effect to do it, but I quickly found out that that would cause UV sliding as I’m not really moving points in 3D but rather moving their projected position. So it’s expected.
I tried getting around it by using more bones and points and I suppose that works and leads to better results, but could get costly. It’s likely that better topology can help to alleviate some distortion, but it really then depends on the areas you want to preserve, and I just want a solution that fits any image.
My last attempt was to use the Mat2D transform library to manipulate the image directly, but I can only figure out how to do affine transformations. So this is the end result here. This is using the renderer:transform() and drawImage()
I’m wondering if anyone has a trick up their sleeve to manipulate the texture directly. Or is the Mesh approach with more sub-Ds my best bet?