User Tag List

Results 1 to 6 of 6

Thread: Looking for a transform/distort/skew shader

  1. #1
    Clicker Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    J3sseM's Avatar
    Join Date
    Feb 2013
    Location
    Finland
    Posts
    868
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Looking for a transform/distort/skew shader

    Hey Clickers!

    I'm looking for a shader that could do this:
    Untitled-8.jpg
    (I need to alter only one side of the active object)

    I wouldn't mind adding some alpha space around the object if that would make it possible.

    I looked through my shaders but couldn't find one that could do this. I'm confident it's possible, and I could almost swear one already exists.

    Any idea?

    Thanks!

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Either Werbad's "3D shader", or my own "Quad" shader:

    http://community.clickteam.com/threads/73365-3d-shader-fx
    http://community.clickteam.com/threads/92958-Convex-Quadrilateral-pixel-shader

    (if that's all you need it to do, Werbad's shader will probably be faster, as it's much simpler).

  3. #3
    Clicker Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    J3sseM's Avatar
    Join Date
    Feb 2013
    Location
    Finland
    Posts
    868
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey MuddyMole!

    Oh you can do that with 3D Shader?
    Obviously I didn't try hard enough, I will play some more and see if I can achieve the result I'm after.
    I'll report back here how it is done once I figure it out!

    Thanks,

    Jesse

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Hey Jesse,
    since I did this job quite much here's a little tip that may help: you have to scale the object also to achieve the result
    (or start with a picture as big as your skewed edges will reach!)

    summarizing:

    1) scale the object to max width/height the object's "bounding box" will reach
    2) if you're using Werbad's shader, set parameters to left/right height in UV coordinates (that's, in short, the percentage of length/100)
    3) if you're using Werbad's shader, set "centers" to the UV coordinate of where the center of the segment should lie

    I find Quad more handy because you somewhat have a more direct control over coordinates,
    but the number of parameters you would change is the same
    and as Muddymole said, there's extra parameters in Quad (the other two sides) you could not need

    (with Werbad's shader you can only deform two sides, as your pictures show, while with Muddymole's Quad you can have all sides deformed)

    If you have hard times figuring out drop a line,
    I should have a test-example with Quad that does the scale+deform thing you would need based on X,Y coordinates you supply
    (that's the base of P3D polygon deformation)
    don't know if/how much efficiency is an issue in your setup
    this works fine up to about 200 deformations x frame on average machines


    Edit___

    found the test/example and added some comment,
    just in case someone needs:

    Quad_deform_example.mfa

    (remember you can't have convex shapes)

    this is based on the original example supplied by Muddymole with his Quad,
    you can find that example in the link he posted above
    which is more staightforward (and efficient)
    but you can't use that approach if your starting picture is not at the "max size" it will eventually reach
    (you can only shrink it from its starting size)
    while with the "scale" example above you can achieve any picture size

    Well, you know the one that suits best your needs

  5. #5
    Clicker Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    J3sseM's Avatar
    Join Date
    Feb 2013
    Location
    Finland
    Posts
    868
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hey schrodinger!

    If there's one guy that I know has played around with stuff like this it must be you.
    Thank you very much for posting here, I'm sure a lot of clickers will find this topic useful!

    I'm confident I can make it work now, thanks guys!

    Jesse

    EDIT: Hmm, I can only skew the image from left or right with 3D shader, not from top or bottom. Maybe I'm missing something, I will keep trying.

    EDIT2: I just ended up using the Quad shader, altering xA and xB seems to do the trick just fine. Thanks!

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    EDIT: Hmm, I can only skew the image from left or right with 3D shader, not from top or bottom. Maybe I'm missing something, I will keep trying.
    Yeah exactly, we were suggesting it because your pictures above seemed to show you only needed to move two vertices
    (you can rotate the active to make left-right become top-bottom) but not all four vertices at the same time

    3Dshader has this limitation, it's enough for a "Wolfenstein", single-axis rotation, but not for three-axis rotation,
    this is what led to the wonderful Quad by MuddyMole

Similar Threads

  1. manipulation of the object distort it
    By vinurd in forum Fusion 2.5
    Replies: 1
    Last Post: 6th May 2015, 10:04 AM
  2. Stretch/distort object
    By ChrisBurrows in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 3rd April 2012, 02:05 AM
  3. Matrix transform shader [request]!
    By Saml in forum Shader Development
    Replies: 3
    Last Post: 12th June 2010, 04:17 AM
  4. Skew Pixel Shader?
    By LazyCoder in forum Hardware Accelerated Runtime
    Replies: 12
    Last Post: 29th February 2008, 11:10 PM
  5. HWA Pixel Shader - Skew
    By LazyCoder in forum File Archive
    Replies: 2
    Last Post: 9th February 2008, 08:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •