Search Unity

Question custom shader lighting change from script or mat property

Discussion in 'Shaders' started by Hybrid46, Dec 7, 2020.

  1. Hybrid46

    Hybrid46

    Joined:
    Mar 21, 2014
    Posts:
    5
    Hi! Is there a way to change surface shader's lighting model with a property or from a script? I'm working on an Uber surface shader and I am able to control everything except the lighting model.

    I tried #ifdef and:
    #pragma surface Surf [lightingModel]

    Thanks for any advice!
     
  2. Hybrid46

    Hybrid46

    Joined:
    Mar 21, 2014
    Posts:
    5
    I found a solution by myself:
    In the lighting.cginc i made some IF statements to handle which lighting model i want to use.