Results 1 to 14 of 14
  1. #1
    Member Thatimster's Avatar
    Join Date
    Jul 2012
    Location
    New Zealand
    Posts
    1,867

    [UPBGE] New Mipmap bloom filter!

    With UPBGE 0.1.4 introducing Mipmapping for the bgl_renderedTexture, this makes blurring much easier and more efficient.

    Before (Standard bloom with 4 samples):



    After (new filter with 4 samples):




    Downsides to using this method:
    -Slightly displaced to the top left due to mipmapping.
    -Can cause banding when incorrect settings are used.


    Code:
    uniform sampler2D bgl_RenderedTexture;
    
    float blur_amount = 2.0;
    float threshold = 0.5;
    int blur_sample = 4;
    float blur_size = 0.003;
    int x=0;
    int y=0;
    
    
    vec4 brightness(vec4 current_color){
        current_color = max(current_color-threshold, 0.0);
        return current_color;
    }
    void main()
    {
        vec4 new_color = vec4(0);
        for (x=-blur_sample; x <= blur_sample; x++){
            for (y=-blur_sample; y<= blur_sample; y++){
                vec2 offset = vec2(x,y) * blur_size;
                new_color += brightness(texture2D(bgl_RenderedTexture, gl_TexCoord[0].st + offset, blur_amount));
            }
            
        }
        new_color /= ((blur_sample*2)+1)*((blur_sample*2)+1);
        gl_FragColor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st, 0.0)+new_color;
    }
    I will probably attempt using the more efficient kawase blur algorithm when I get some time, to make it run even better.
    My BGE Tutorials | 98 free nature Assets | My BGE Sprite Addon | Facebook Page | Contact
    Stay inspired!



  2. #2
    Banned Member
    Join Date
    Sep 2013
    Posts
    1,149
    @Thatimster: Hi, Thanks this looks cool For banding issue, I think you can use HDR option in upbge render panel (half is generally enough. HDR costs performances. It correspond to openGL RGBA_16F in openGL)

    EDIT: oh, ok I thought about another kind of banding effect that happens sometimes with bloom filters.
    Last edited by youle; 14-Feb-17 at 08:26.



  3. #3
    Member Nicholas_A's Avatar
    Join Date
    Oct 2014
    Location
    own.worldPosition
    Posts
    1,110
    How do you recommend I start learning to make filters?
    My website | My YouTube channel | My Blendswap profile | Current Project: [BGMC 25] Ant Panic!

    I sell custom logos for $5 (among other things). Check them out!



  4. #4
    Member Thatimster's Avatar
    Join Date
    Jul 2012
    Location
    New Zealand
    Posts
    1,867
    Originally Posted by youle View Post
    @Thatimster: Hi, Thanks this looks cool For banding issue, I think you can use HDR option in upbge render panel (half is generally enough. HDR costs performances. It correspond to openGL RGBA_16F in openGL)
    Thanks its mainly a mipmapping issue because of the lowered resolution. Using HDR just seems to increase color but doesn't appear to affect the resolution.

    Originally Posted by Nicholas_A View Post
    How do you recommend I start learning to make filters?
    Learn C, it makes understanding everything and writing new code so much easier!
    My BGE Tutorials | 98 free nature Assets | My BGE Sprite Addon | Facebook Page | Contact
    Stay inspired!



  5. #5
    Member Nick Manchul's Avatar
    Join Date
    Apr 2016
    Location
    Ukraine
    Posts
    267
    - and I have this shader does not work, probably it's because there are no proprietary drivers - AMD.

    Of course, this you laid out for non-commercial use.

    Thatimster - forgive me for an immodest question - 3d graphics, this is your hobby between work, you're a civil servant in a cap - like I was not mistaken? Simply, as an example, I can be a cop, and as a hobby is engaged in graphics - although I'm not a cop.



  6. #6
    Member BluePrintRandom's Avatar
    Join Date
    Jul 2008
    Location
    NoCal Usa
    Posts
    18,394
    upbge are you using upbge recent build?
    Break it and remake it - Wrectified
    If you cut off a head, the hydra grows back two.
    "headless upbge"



  7. #7
    Member Akira_San's Avatar
    Join Date
    Aug 2004
    Location
    Bulgaria
    Posts
    1,882
    and I have this shader does not work, probably it's because there are no proprietary drivers - AMD.
    lets see your AMD drvs? - blender - help - save system log.
    anime, manga, blender3d



  8. #8
    Member Nick Manchul's Avatar
    Join Date
    Apr 2016
    Location
    Ukraine
    Posts
    267
    Originally Posted by Akira_San View Post
    lets see your AMD drvs? - blender - help - save system log.
    - apt-cache show xserver-xorg-video-radeon
    Package: xserver-xorg-video-radeonSource: xserver-xorg-video-ati (1:7.8.0-1)
    Version: 1:7.8.0-1+b1
    Installed-Size: 825
    Maintainer: Debian X Strike Force <[email protected]>
    Architecture: amd64
    Provides: xorg-driver-video
    Depends: libc6 (>= 2.17), libdrm-radeon1 (>= 2.4.39), libudev1 (>= 183), xorg-video-abi-23, xserver-xorg-core (>= 2:1.18.99.901)
    Suggests: firmware-amd-graphics
    Description-en: X.Org X server -- AMD/ATI Radeon display driver
    This package provides the 'radeon' driver for the AMD/ATI cards. The
    following chips should be supported: R100, RV100, RS100, RV200, RS200,
    RS250, R200, RV250, RV280, RS300, RS350, RS400/RS480, R300, R350, R360,
    RV350, RV360, RV370, RV380, RV410, R420, R423/R430, R480/R481,
    RV505/RV515/RV516/RV550, R520, RV530/RV560, RV570/R580,
    RS600/RS690/RS740, R600, RV610/RV630, RV620/RV635, RV670, RS780/RS880,
    RV710/RV730, RV740/RV770/RV790, CEDAR, REDWOOD, JUNIPER, CYPRESS,
    HEMLOCK, PALM, SUMO/SUMO2, BARTS, TURKS, CAICOS, CAYMAN, ARUBA, TAHITI,
    PITCAIRN, VERDE, OLAND, HAINAN, BONAIRE, KABINI, MULLINS, KAVERI, HAWAII.
    .
    More information about X.Org can be found at:
    <URL:http://www.X.org>
    .
    This package is built from the X.org xf86-video-ati driver module.
    Description-md5: f0dc7040ebe20189598467915db9b2e1
    Homepage: https://wiki.freedesktop.org/xorg/RadeonFeature/
    Tag: admin::hardware, hardware::video, implemented-in::c, role:lugin,
    use::driver, x11::xserver
    Section: x11
    Priority: optional
    Filename: pool/main/x/xserver-xorg-video-ati/xserver-xorg-video-radeon_7.8.0-1+b1_amd64.deb
    Size: 463150
    MD5sum: faa80babd8855cdb37b7979f7631d070
    SHA256: 13d8155a08801dad08a67dff8cb2f451aff199723e3ec22f1e ab09039f6a99b6
    - glxinfo |grep -i opengl

    OpenGL vendor string: X.Org
    OpenGL renderer string: Gallium 0.4 on AMD KABINI (DRM 2.49.0 / 4.9.0-4-amd64, LLVM 3.9.1)
    OpenGL core profile version string: 4.3 (Core Profile) Mesa 13.0.6
    OpenGL core profile shading language version string: 4.30
    OpenGL core profile context flags: (none)
    OpenGL core profile profile mask: core profile
    OpenGL core profile extensions:
    OpenGL version string: 3.0 Mesa 13.0.6
    OpenGL shading language version string: 1.30
    OpenGL context flags: (none)
    OpenGL extensions:
    OpenGL ES profile version string: OpenGL ES 3.1 Mesa 13.0.6
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
    OpenGL ES profile extensions:
    - everything is normal, these are standard open drivers - even parallax does not work for them. But if you deliver from AMD (fresh), everything will be fine..
    There are no errors in the console.



  9. #9
    Member Nick Manchul's Avatar
    Join Date
    Apr 2016
    Location
    Ukraine
    Posts
    267
    Originally Posted by Thatimster View Post
    Learn C, it makes understanding everything and writing new code so much easier!
    - I'm sorry, but is the open shading language (osl), is it the C language?



  10. #10
    Originally Posted by Nick Manchul View Post
    - I'm sorry, but is the open shading language (osl), is it the C language?
    it is glsl whose syntax is practically the same as c



  11. #11
    Member Nick Manchul's Avatar
    Join Date
    Apr 2016
    Location
    Ukraine
    Posts
    267
    Originally Posted by lopas View Post
    it is glsl whose syntax is practically the same as c
    - I understand, I basically thought so.



  12. #12
    Member Akira_San's Avatar
    Join Date
    Aug 2004
    Location
    Bulgaria
    Posts
    1,882
    @lopas
    Great bloom filter. You gonna share?
    @Nick Manchul
    Well for Linux you have OGL 3 and glsl 1.3, so it should work. But the mesa is too old. You still should see an error message in the console.
    anime, manga, blender3d



  13. #13
    Member Nick Manchul's Avatar
    Join Date
    Apr 2016
    Location
    Ukraine
    Posts
    267
    Originally Posted by Akira_San View Post
    @lopas
    Great bloom filter. You gonna share?
    @Nick Manchul
    Well for Linux you have OGL 3 and glsl 1.3, so it should work. But the mesa is too old. You still should see an error message in the console.
    - it's Debian, here everything is old, but time-tested - Deban + server = Wi....ws out.
    - There are no errors in the console. The console prescribes the errors of the shader, not the driver's faults.



  14. #14
    Member RyceKaeks's Avatar
    Join Date
    Oct 2016
    Location
    USA, California
    Posts
    17
    Just to let you know this works with blender 2.79



Posting Permissions

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