User Tag List

Results 1 to 8 of 8

Thread: Zooming shader? (Layer zooming)

  1. #1
    No Products Registered

    Join Date
    Jun 2006
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Zooming shader? (Layer zooming)

    Hi there,

    I'm having a bit of trouble getting any zoom shader to work. I want to make a simple zoom feature, that will zoom in and out of a layer with the mouse wheel. This should be done with a shader - as it doesn't mess with the positions of the objects.
    I seem to remember getting it to work before, but i can't seem to work it out now! But I also remember there was a problem where sometimes sprites would have some crazy distortion put on them (is this to do with the 1 pixel border you are meant to use?)

    EDIT - I have found my old file where I have correctly made this - But there's still the problem that when objects pass below 0pixels (0,0 co-ords) even though my virtual height and width is set to -1 (infinite) the objects disappear, and it distorts them strangely before they finally go invisible... Anyone know if this can be fixed?


    Any help would be appreciated.
    Thanks,
    Alex

  2. #2
    No Products Registered

    Join Date
    Dec 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    I implemented a zoom in my game, and after messing around with zoom shaders applied to both objects and to the frame, I settled on what I think is a better method.

    Make your game at the closest zoom level you want. (So frame size, sprite size, etc, should be pretty large.) Then in your MMF event code, actually scale and reposition all of the objects to simulate the zoom. Do this as the last events in your frame.

    Then the starting events of the frame should reverse the process, returning all objects and scales back to full zoomed in size. This way, all of your events occur at the closest zoom level, and the zoom is only applied to objects in the very last events each frame.

    HWA is plenty fast enough to use this method, and you don't have to worry about all the glitches that occur when using a zoom shader. Not to mention, you can have hi-def art when zoomed all the way in this way. (You don't end up just blowing up the lower res sprites.)

  3. #3
    No Products Registered

    Join Date
    Jun 2006
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    Thats a genius idea! That would certainly get round the bugs of using a shader, although the math for zooming+displacing objects i remember taking me a day or so, but that was years ago..

    Thanks, i'm going to give it a try. but it would be alot better if we could get a working zoom shader at some point

  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    I made a quick example of a zoom system. The example shows the bug though but it could have a workaround made and be updated a lot as it's just a simple example really.

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=161414#Post1614 14

  5. #5
    Clicker Multimedia Fusion 2 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-on
    iamjot's Avatar
    Join Date
    Nov 2008
    Location
    Austria
    Posts
    712
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    nice work!

  6. #6
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    astrospoon, thats a good idea but wouldnt you get rounding errors when you reposition objects when your zoomed out? Say your zoomed all the way in and move your object 2 pixels. When you zoom out again, your resizing and repositioning your object so you are actually rounding out any decimal that would occur when you scale down. Then when you zoom in again, you would be zooming in based on the rounded value, resulting in you losing the 2 pixels you just moved. Unless you stored the true positions as floats in alterable values this could cause problems for many games...

  7. #7
    No Products Registered

    Join Date
    Jun 2006
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    Your probably right redron, why can't we just have a working shader? Atom's example is just showing that the shader works only for zooming IN, which was my problem in the first post. Zooming is pretty useless if you can only zoom in.

  8. #8
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Zooming shader? (Layer zooming)

    One thing i was thinking of doing was to use large imported graphics and then set the zoom in more. Then when you zoom out it would create the effect as long as you worked to scale. The thing of course is that this could be more annoying to setup in the frames.

    My example does work for zooming in but it also has a bug depending on the position you are in the frame. With the extra stuff i added it was only slightly offset though and would work for simple areas but still needs a slight fix to center the player on zooming but i couldn't figure it out at the time. Nobody ever gave me any feedback for that thread unfortunately even after 2 bumps and many downloads.

Similar Threads

  1. Zooming in and out (example)
    By bybyblue in forum File Archive
    Replies: 2
    Last Post: 15th August 2012, 04:44 PM
  2. Zooming out?
    By ChrisBurrows in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 20th March 2012, 11:38 AM
  3. Zooming out?
    By brawltaunts22 in forum Hardware Accelerated Runtime
    Replies: 2
    Last Post: 5th July 2011, 05:51 AM
  4. Zooming in
    By delta9857 in forum The Games Factory 2 - Technical Support
    Replies: 8
    Last Post: 9th January 2011, 07:40 PM
  5. Zooming Out
    By Kalnar in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 13th November 2007, 11:31 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
  •