Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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:
    5
    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 ?
     
    suxiangting likes this.
  2. Lili_873

    Lili_873

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

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

    Noadasi

    Joined:
    Dec 11, 2019
    Posts:
    5
    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:
    5
    Still in need for help... Anyone, please ?
     
  5. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    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!
     
    NotaNaN, suxiangting and Noadasi like this.
  6. Noadasi

    Noadasi

    Joined:
    Dec 11, 2019
    Posts:
    5
    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.
     
  7. suxiangting

    suxiangting

    Unity Technologies

    Joined:
    Jun 12, 2020
    Posts:
    5
    Thank you for letting us know, Noadasi and Hidingspot! Just curious, what are some of your commonly used/ preferred blend styles? I'm hearing "Overlay" and what else?
     
  8. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    The artist on our current game uses the photoshop Overlay mode pretty exclusively when creating lighting effects. So that's the main one for us.
     
  9. suxiangting

    suxiangting

    Unity Technologies

    Joined:
    Jun 12, 2020
    Posts:
    5
    Thank you Hidingspot! I'll feedback this to the team. We are looking into making the Blend Styles more accessible and easier for more users. This is definitely moving up on our agenda. So feel free to let us know of any more suggestions like these in the meantime.

    P.S. I took a peep at your website and saw one of your games, "Welcome to Beacon Pines". Looking great!
     
    AzureMasters likes this.
  10. Lili_873

    Lili_873

    Joined:
    Nov 7, 2019
    Posts:
    2
    Soooo, I necro this post, but this is the top result when you search for this topic on Google.

    To reititerate on the subject:
    I made a lighting system, using the old shader system. It's a 2D light system, using either circle lights or textures, and, the stuff that we want here, can blend the light using liner dodge mode, color dodge, multtiy and overlay.

    We recently migrate the project to the URP shader system, and the Unity 2D light system, and now I want to bring back these blending modes (old light system I made is not compatible as it is with URP, and we want to use Unity light system).

    So, to make it short, do any of you have an idea how to add lighing styles for Unity ? (we want to add linear dodge, color dodge and overlay blending styles to Unity light system)
    I tried to see if I could modify the Unity light classes, but no luck there, I couldn't find where the lights are being processed.

    if any of you have idea about it, I'll take it !