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. Dismiss Notice

Multiple lighting model in one shader with mask

Discussion in 'Shaders' started by Charles_Gams, Apr 24, 2014.

  1. Charles_Gams

    Charles_Gams

    Joined:
    Feb 23, 2013
    Posts:
    31
    Hi

    I know its possible to have multiple lighting models in a shader but for example say you have BlinnPhong and Lambert and you want only some parts of a model to have a BlinnPhong lighting and others a Lambert (basically masking). How would this be done I've tried out things with no success so far
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Is there a reason you need to do this using a shader rather than by splitting up the model?

    Moreover, Lambert is a strict subset of Blinn-Phong. Any area of BlinnPhong with a black specular colour will behave the same as Lambert.
     
  3. Charles_Gams

    Charles_Gams

    Joined:
    Feb 23, 2013
    Posts:
    31

    Yeah cause I've built a shader that can blend between two or three lighting models and I would want to mask parts of a model rather than splitting it into pieces(model)
     
  4. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    If you've already got a shader that blends between lighting models, the masking part is easy: simply read a mask texture to get your blending parameters rather than the constants your are (presumably) using now.