Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

ShaderGraph Custom Lighting Support

Discussion in 'Graphics Experimental Previews' started by noio, Nov 29, 2018.

  1. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    232
    Are there plans for enabling 'Custom Lighting' in Shader Graph?

    (also mentioned in this feature request: https://feedback.unity3d.com/suggestions/shader-graph-custom-lighting-model-support )

    Enabling a more straightforward way of doing what @cirocontinisio did in https://connect.unity.com/p/zelda-inspired-toon-shading-in-shadergraph .

    Preferably, Unity would give users the tools to avoid the following two workarounds:

    1. Having to build a custom node for getting light information (c.q. main light direction)
    2. Having to output the custom lit values as the PBR Emission value.


    From the article:
    I've seen hints of this issue in different topics on the forum, but could not find a stance on whether this is considered an important use case by Unity and whether it will make it into Shader Graph.
     
    Last edited: Dec 11, 2018
    cirocontinisio and chrismarch like this.
  2. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    232
    Bump @wyatttt. With apologies for bumping. :oops:
     
  3. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
    I would imagine yes given how many different threads touch on this. Users want it, the post by @cirocontinisio shows unity know its wanted, and I am sure the reason such a node has not arrived is it is a more complex issue and they want to make sure the node they supply gets it right.

    For now you can use the node by @cirocontinisio and then make adjustments as he mentions in the comments on that article, at which point it will work.
     
  4. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    I asked this in the main LWRP thread as well, I imagine the current solution is exactly that: use emission channel or build custom lighting from ground up with unlit base, otherwise it will involve changing core shaders.

    (ShaderGraph_ExampleLibrary repo might give you some nice idea to kick start custom lighting, depending on your use case)
     
    noio likes this.
  5. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    noio likes this.
  6. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
  7. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    232
  8. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
  9. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    noio and bitinn like this.
  10. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    232
    I've been working with those Light Nodes, they open up quite a few options!

    However, what I haven't been able to do is create shaders that have just a slightly modified light function compared to PBR, and have all the other shader magic and shadows intact.

    In Surface shader, one could copy the Lambert or Blinn-Phong lighting function, make a few modifications, and plug in the modified function using `#pragma surface`.

    Even in the standard shader, it's possible to replace just the BRDF by defining `UNITY_BRDF_PBS`.
     
  11. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
    The Feedback page has been replaced with the forums, so I suppose I will raise my hand here and agree that custom lighting is a fundamental feature that Unity games I've worked on/am working on require (specifically toon shading). Our artists are very excited about the shader graph, but it seems practically experimental, until the LWRP and HDRP stabilize (for those without time to delve much into SRP). Once the Shader Graph can be used without dependecies on preview tech, I imagine more people will take a look at it, and then ask for custom lighting.
     
    Last edited: Mar 1, 2019
  12. amisner2k

    amisner2k

    Joined:
    Jan 9, 2017
    Posts:
    43
    Not sure if this is related but I found myself here looking for a way to change the light falloff used by the LWRP. I was thinking there'd be something I could do with a ShaderGraph, but what would really be helpful is an option on the Light component itself that lets you change the type of falloff per light (Inverse Square, Inverse Square (No Range Attenuation), Legacy, Linear), like what's described here: https://docs.unity3d.com/Manual/ProgressiveLightmapper-CustomFallOff.html
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902