User Tag List

Results 1 to 10 of 10

Thread: Using shader to toggle anti-aliasing effect

  1. #1
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Using shader to toggle anti-aliasing effect

    I've been playing around with shaders and I have yet to come up with a way to simulate real anti-aliasing. All my attempts at adjusting values with shaders just aren't producing good results. I've fiddled around with some blur shaders but it doesn't look right. Fusion doesn't give you a way to toggle anti-aliasing at runtime so I'm trying to find a solution that actually looks like real anti-aliasing in a game. I'm really trying to find a way to accomplish this, whether it's with shaders or something else.

  2. #2
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This is as close as I've been able to come using the blur shader. I think it works, but I'd like some input. Of course, this is with a static image, I haven't tested what it looks like with moving objects yet. I believe the blur shader I used is in Complex Software's shader pack. If you don't have it, it's here: http://www.castles-of-britain.com/co...rs_pack_v2.zip

    Regular image:



    Blur shader applied:



    However, if you set the layer's blur properties in the frame editor manually it looks like the picture below. I have no idea why it looks like that if you set the layer effect in the frame editor, but if you set it at run time with events using the exact same parameters it looks like the picture above (edit: I should clarify that it still looks normal when you run the application at runtime, it's only in the frame editor that this happens). I attached an example file to see if other people view it correctly during runtime. Press the space bar to toggle the effect on and off.

    Attached files Attached files

  3. #3
    Clicker 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)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,304
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)
    Just out of curiosity, what is it you're trying to anti alias? ie. Where are you seeing jaggies in the first place?

    The main time I've ever seen jaggies in fusion are in shader effects themselves (eg. Lens shader)

  4. #4
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I'm just trying to give the option for the user to toggle anti-aliasing for the entire game if they'd rather have the pixels smoothed out instead of pixel perfect blocks. So it's not that there's anything wrong that requires me to use anti-aliasing, it's just a user option. Similar to what you'd see with emulators.

  5. #5
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    In Nestopia it's labeled Bilinear Interpolation so maybe AA isn't the technical term. Here's what I'm talking about:

    Pixel Perfect


    Bilinear Interpolation

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    piscesdreams's Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    928
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Neat! How is it on performance? I've always thought not being able to toggle anti-aliasing at runtime is a horribly crucial flaw.

  7. #7
    Clicker 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)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,304
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the explanation.

    You usually hear of Bilinear interpolation (and its superior cousin, Bicubic Interpolation) in the context of resizing, which is I guess the appropriate context when you're talking about emulators. Though I think AA is probably just a different term for more or less the same thing.

    Weird that you get such different results when modifying at runtime. Good to know!

    That first blurred image doesn't look too bad. In a 3D game, you wouldn't want everything (including flat surfaces) softened like that. But in a retro platformer, it evokes the softness you'd get on an old CRT TV, which makes it actually more authentic than the first, un-anti-aliased one.

    Though it's interesting that the blur does a fantastic job with 45degree jaggies, yet is almost useless at gentler/steeper slopes.

  8. #8
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Piscesdreams: I haven't actually tested this with a fully functioning game just yet, just mainly seeing if I can even get the effect to be remotely acceptable. In a single screen platforming engine it worked fine but that's a far cry from a full game so I can't say for sure.

    Volnaiskra: I think that maybe the reason why there's a drastic difference between editor and runtime has to do with the game running in Direct3D versus just the regular software. That's the only explanation I can come up with at least. I also noticed in my testing that blurring doesn't look very good with smaller pixel graphics which I guess makes sense. The larger your pixel graphics are the more natural it looks. I hope Fusion 3 has the ability to toggle AA at runtime.

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    piscesdreams's Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    928
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I tried on my game and got a solid 60 fps while applying the blur to the frame itself. I couldn't strike a likeable medium between the AA in Fusion and the Blur shader. I wish Anti-Aliasing could be toggled at runtime. *hint hint*

  10. #10
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That was my problem too. On that Sonic image it looks okay but applied to my own graphics it didn't turn out so well.

Similar Threads

  1. Toggle Anti-Aliasing at Runtime?
    By piscesdreams in forum Fusion 2.5
    Replies: 18
    Last Post: 15th September 2015, 09:11 PM
  2. Shader for Text Anti-Aliasing
    By Bruto in forum Shader Development
    Replies: 3
    Last Post: 4th July 2011, 11:05 PM
  3. Anti-aliasing bug?
    By Bruno in forum Multimedia Fusion 2 - Technical Support
    Replies: 23
    Last Post: 7th July 2006, 12:23 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
  •