- Home /
Multiple lighting models in one shader
Hi
I was wondering if its possible to have multiple lighting models in one shader/material so for example a Lambert lighting model and a Blinn Phong lighting model .
Reason I ask is cause I may want to have parts of a model lighted in a different way than others but still have that in one shader . Similiar to how you can have a map that allocates which parts of a model are reflective but rather which parts are lambert shaded or Blinn Phong etc
Regards
Charles
Answer by whydoidoit · Feb 22, 2014 at 12:59 AM
Sure, you would need to encode the lighting in a texture (or perhaps the alpha channel of the main texture) or into some property of the mesh such as Vertex colours - then you would branch in the lighting model (or fragment shader) and use a different calculation based on the branching where alpha is less than or more than 0.5 perhaps.
Your answer
Follow this Question
Related Questions
Blend from lighting model to another 0 Answers
How to force the compilation of a shader in Unity? 5 Answers
Reflective sphere for HDRI 0 Answers