Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Adding blur to sprite / container? — Gideros Forum

Adding blur to sprite / container?

NinjadoodleNinjadoodle Member
edited August 2017 in General questions
Hi guys

I'm trying to find a simple way to blur a container with a bunch of sprites in in. I've trying to use this class ...
http://giderosmobile.com/forum/discussion/6682/radial-blur-effect-class#Item_1
... but all I get is a white box (when used on a sprite).

I can't quite figure out the example included with Gideros.

If anyone has a link to a simple way to do this, that would be awesome :)

Thank you in advance!

Comments

  • Okay I think you would make a Sprite, and attach all your blurry sprites to that. Then make a shader on the original container.

    I haven't played with shaders but I think this might be the way to go.

    Likes: Ninjadoodle

    +1 -1 (+1 / -0 )Share on Facebook
  • Hi @antix

    Thank for the reply :) I've had a good look into it and can't get my head around it. I was hoping to just find a snippet that worked ... but the ones I've tried don't work for me.

    It's not that important and I'd rather focus on designing my levels, then figuring shaders out lol.

    Thanks again for you help!
  • keszeghkeszegh Member
    edited August 2017
    the blur example makes you the right shader, you don't need to understand it much, just add
    mySprite:setShader(shader)
    if i remember correctly there is a typo in glsl file
     for (int v=0;v<20;v++)
    should be
     for (int v=0;v<ext;v++)
    on the other hand the example either horizontally or vertically blurs, not both. so i attach a modified (only glsl) example which blurs in both directions.

    note that if you want to blur a hierarchy of several sprites then you should draw them to a rendertarget and add the shader to this rendertarget and put it on stage.
    zip
    zip
    Blur_modified.zip
    218K

    Likes: Ninjadoodle

    +1 -1 (+1 / -0 )Share on Facebook
  • Hi @keszegh

    Thanks heaps for posting this - I managed to get this working on a sprite now :)

    I've however tried this on a movie clip and no go. Any ideas how you'd get this working with mc's?

    Thanks again for the sample!
  • try to draw it on a rendertarget at each enterframe event.
  • Shaders don't seem to work on nested sprites. I have also tried to get a blur effect, but only got it to work on bitmaps.

    Likes: Ninjadoodle

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 )Share on Facebook
  • Hey, hadn't seen the link!

    http://giderosmobile.com/forum/discussion/6682/radial-blur-effect-class/p1

    I bet @hgy29 has something to say about this.

    Likes: antix, Ninjadoodle

    My Gideros games: www.totebo.com
    +1 -1 (+2 / -0 )Share on Facebook
  • I just thought of another idea ... would something like this work?

    Gideros takes a snapshot of my screen (or portion of a screen). I add it as a sprite and then perform the blur on that instead (I'm just looking to use this as a Game Over effect).
  • snapshot... that is what rendertarget is for, as i recommended.
  • NinjadoodleNinjadoodle Member
    edited August 2017
    Hi @keszegh

    I'm still learning about all of this :) I pretty much do basic coding, mainly using tweens, event listeners, containers and movie clips.

    I remember the last time I've tried using rendertarget, I couldn't use it with @2x @4x atlases.

    I think in the case of using it for a screen grab, it would work ok?
  • @Ninjadoodle, i never used the automatic @2x etc image loading. and indeed probably for rendertarget you have to manually make the right resolution rendertarget texture.
  • Hi @keszegh

    Thanks again for your help :) I have my workflow pretty much sorted and everything is working perfectly, so it's not really worth it for me to change it just for a single effect. I'll improvise and come up with something else.

    Thanks heaps for the tips!
Sign In or Register to comment.