1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Asset - Shaders 2D Block Lighting (free)

Discussion in 'Marketplace' started by Dragon47, Jul 27, 2016.

  1. Dragon47

    Dragon47 Member

    Joined:
    Jul 6, 2016
    Posts:
    179
    Last edited: Jan 24, 2019
    ThunkGames likes this.
  2. ThunkGames

    ThunkGames Guest

    Wasn't a pure copy/paste job, but the stuff I learned looking over this code is worth more to me than anything I've ever actually paid for on the marketplace.
     
  3. seanm

    seanm Member

    Joined:
    Jun 20, 2016
    Posts:
    332
    Hey, I love this asset, but I've got a question.
    I've only used the old version and now I can't seem to make things work the way they used to.

    I feel like I used to be able to pretty easily adjust the alpha of the fog, and the size of the blur. Both of those things don't seem to be so easy to change any more.

    Is there something obvious that I missed, or will this take some larger changes to accomplish?
     
  4. Dragon47

    Dragon47 Member

    Joined:
    Jul 6, 2016
    Posts:
    179
    It has been a long time since I've looked into this asset, but it might be possible to change the alpha by changing the "1" to a desired alpha in the bl_rectangle_draw script at the end of all lines starting with "shader_set_uniform_f(global.__bl_uniform_sh_bl_draw_color, ". As for the size of the blur, there are two lines starting with "shader_set_uniform_f(global.__bl_uniform_sh_bl_blur_x_size, " and "shader_set_uniform_f(global.__bl_uniform_sh_bl_blur_y_size, ", if you lower the values these functions set you can change the amount of blurring. E.g. change "shader_set_uniform_f(global.__bl_uniform_sh_bl_blur_x_size, 1 / sf_width);" into "shader_set_uniform_f(global.__bl_uniform_sh_bl_blur_x_size, 1 / sf_width * 0.5);"
     
  5. Jeason1997

    Jeason1997 Guest

    Hi, I use your Block Lighting 2D for GMS2, but there some compile error:

    Code:
    ___________________________________________
    ############################################################################################
    FATAL ERROR in Vertex Shader compilation
    ShaderName: sh_bl_blur_x
    
    Invalid shader
     at gml_Script_bl_rectangle_draw (line 60) -                     shader_set(sh_bl_blur_x);
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Script_bl_rectangle_draw (line 60)
    called from - gml_Object_obj_example_Draw_0 (line 23) -         bl_rectangle_draw(bl_rectangle, block_grid, 0, 0, blocks_horizontally, blocks_vertically, 0, 0, c_black);
    
     
  6. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,777
    Right click on the shader in the resource tree and make sure it is the correct type (probably GLSL ES is what you need).
     
  7. zendraw

    zendraw Member

    Joined:
    Jun 20, 2016
    Posts:
    1,330
    clamp the mouse pos actions in the grid size, else it goes crazy in the compiler or ide or w/e its called.
     
  8. Dragon47

    Dragon47 Member

    Joined:
    Jul 6, 2016
    Posts:
    179
    Thank you for helping out. As already pointed out, make sure all shaders are set to GLSL ES, and you might also want to clamp the grid actions although it's not directly related to the error you posted.
     
  9. MasterGrey

    MasterGrey Guest

    This is not bad you sir require a cookie but i am curious do they have to use the example script or can they just create their own lighting system using your code.
     
  10. Dragon47

    Dragon47 Member

    Joined:
    Jul 6, 2016
    Posts:
    179
    Thank you. You don't have to use the example code.
     
  11. MasterGrey

    MasterGrey Guest

    So then mate how would i use this in my lighting script because i have some simple codes i just need to know the functions of your lighting engine.
    So if you have some sort of documentation.
     
  12. Dragon47

    Dragon47 Member

    Joined:
    Jul 6, 2016
    Posts:
    179
    The scripts and example are commented. I recommend reading through these comments and the example code and try to understand how the asset works.
     
  13. Limekys

    Limekys Member

    Joined:
    Jan 1, 2018
    Posts:
    4
    Please, make it for GMS 2. I was make it, but have some problem with draw block, it's still drawing when i delete blocks. (sorry for my english)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice