Search Unity

How to modify lighting Blend Styles ?

Discussion in '2D Experimental Preview' started by Noadasi, Dec 11, 2019.

  1. Noadasi

    Noadasi

    Joined:
    Dec 11, 2019
    Posts:
    4
    Hello everyone,

    Last year, my teamate created a 2D light system from scratch. We were delighted to see that Unity incorporated an official one that work very well but, our own system had some features (mostly light shaders) that the new system does not offer.

    We are currently trying to take the best of both worlds and import our own light shaders into the official new Unity 2D light system. Unfortunately it isn't that simple, we could use a little help in that regard.

    So, in the new Unity system, inside the renderer, you can tell Unity which light shader the lights will be able to use (regarded as "Blend Styles") and you are limited in 4 slots. We want more. We tried to brute-force the code but adding more Blending Style caused the graphics to f*** up badly.

    That's one point.

    Secondly, these Blend Styles are currently limited to "Additive", "Multiply", "Substractive".
    Again, we want more of these, my teamates had created more for our old system but we have no idea where Unity putted these and how it interracts so to merge everything together is quite puzzling at the moment.

    Can you help us ?
     
  2. Lili_873

    Lili_873

    Joined:
    Nov 7, 2019
    Posts:
    1
    Hmmm...

    Maybe using a derived class from Unity ones would make it possible ?
     
  3. Noadasi

    Noadasi

    Joined:
    Dec 11, 2019
    Posts:
    4
    Unfortunately, my teamate doesn't know how the Unity class works in the first place, so he cannot do that, any ideas ?
     
  4. Noadasi

    Noadasi

    Joined:
    Dec 11, 2019
    Posts:
    4
    Still in need for help... Anyone, please ?
     
  5. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    66
    We're in a similar situation. The artist I'm working with likes to create lighting layers in photoshop with the "Overlay" blend mode, which gives a much nicer look. I've gone out of my way to create a system that let's us recreate that blend mode in Unity. It basically goes like this:
    - the main scene, minus lighting layers, is rendered into a RenderTexture
    - a custom ShaderGraph shader uses the blend node (which conveniently has an Overlay option) to combine the lighting texture with the scene colors from the RenderTexture above

    There are downsides to this approach though. It requires an extra camera/RenderTexture and a fair amount of added complexity. Also, to avoid even more cameras and render textures, I render all the lighting layers to the same camera/RenderTexture, which means the artist can't do fun stuff like mixing lights within the scene; all lighting effects are just rendered in front.

    It would be really wonderful if more blend modes were supported in the new Unity 2D lighting system!
     
    Noadasi likes this.
  6. Noadasi

    Noadasi

    Joined:
    Dec 11, 2019
    Posts:
    4
    That seems like a hell of an approach ! Indeed, more blend modes would be insane ! Or at least, if Unity wouldlike to explain how to add some custom modes, we could do the job by ourselves. I'll submit your idea to my teamate, though and I am VERY grateful to you for answering this topic ! Hopefully, if we are not the only ones interested, Unity will provide us with something to help our predicament.
     
unityunity