Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Lit shader emission

Discussion in 'Universal Render Pipeline' started by Naewulf, Sep 9, 2020.

  1. Naewulf

    Naewulf

    Joined:
    Jun 17, 2019
    Posts:
    23
    I need most parts of my sprite to react to the lights in the scene, so i created a lit shader, but some details like some glowing hdr parts need to be always visible to simulate light emission no matter if there are lights around just like an unlit material. Since the sprite lit master node does not have the emission map property, how can such effect be achieved?
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,498
    For simple emission you could use Add as shown below.. but if by "some details" you mean specific regions of the texture being emissive, you could do that by adding an _EmissionTex and pass output of a Sample Texture 2D for it into B input of Add instead of _Emission.

    sprite_emission.jpg

    Edit: As for "just like an unlit material" - it would have to be an unlit material with custom lighting (which so far I don't personally have any experience with).
     
  3. Naewulf

    Naewulf

    Joined:
    Jun 17, 2019
    Posts:
    23
    Thats pretty much what im doing, the only difference is that im not setting the emission as a texture or color, im just drawing it in real time based on some noise nodes. That way, with the add node, i can build a final lit image, in other words, the emission is also affected by lights like the rest thats been added to it. So, by doing that the emissive part remains not rendered when the sprite is in the dark.
     
  4. Naewulf

    Naewulf

    Joined:
    Jun 17, 2019
    Posts:
    23
    Im doing pretty much what brackeys do in his "dissolve 2d" effect, but with a lit shader and trying to fix that part of the glowing border not being shown if there are no lights in the scene.
     
    Last edited: Sep 9, 2020
  5. Sukirii

    Sukirii

    Joined:
    Oct 14, 2020
    Posts:
    15
    I've done that in 2D, but somehow, there is alpha blending on overlap enabled so the colors get transparent/mixed when overlapped. How can I prevent that?