Hello,
Has anybody found a way to stretch/distort the corners of an object based on co-ordinates?
Thank you![]()


Hello,
Has anybody found a way to stretch/distort the corners of an object based on co-ordinates?
Thank you![]()

You can use Polygons:
Working as fast as I can on Fusion 3


Thanks LB, but I need to do it with an active object. What are my chances?

Surface is active and it is an object. You can even blit actives onto it!
Working as fast as I can on Fusion 3


I need the polygon to be textured.....

Oh...the best I could think of would be some shader. :\
Working as fast as I can on Fusion 3


The top and bottom edges remain straight if that makes it any easier?
I just need to be able to pick these points by co-ordinates.
![]()

You could split it into a bunch of horizontal one-pixel-high actives and spread value on them then stretch them based on a formula involving their spread value. Or use a shader. Other than that I have no idea, if someone else would like to input.
Working as fast as I can on Fusion 3


That is an idea but it seems a bit extreme. I appreciate all your help though LB!
I know it can be done with the 3D Shader because I have stretched objects in this way before with it. I just can't get them to go exactly where I want. Any other ideas?


MMF2 only supports pixel shaders, not vertex shaders right now, unfortunately- vertex shaders would be a bit complicated for it given how the collision detection works on the collision mask. Vertex shaders are exactly what has this effect (and some more, light passive lighting), but unless you're using a custom 3d graphics plugin like OpenGL for MMF2, I don't think you'll have much success trying this, at least not with standard active objects- you can do it with other methods like polygons, the Surface object extension, and opengl as mentioned.
As far as pixel shaders themselves, you could plausibly create a shader that skews an image into a predefined quadrilateral. The limitation here is that pixel shaders still need to operate on the same texture size, so you cannot enlarge an image- it only works if the points are *inside* of the rectangle. Still plausible, if you have the object be larger than the actual texture size, so as to give it extra distance on the sides, for example making it three times as wide and high, and centering the image by default. But it still won't allow large stretches, and the larger the texture, the slower it will go (pixel shaders are expensive GPU operations), and no matter what you do, it won't actually affect the collision mask for that object- it is purely display, no effect on collisions.