Posts

Showing posts with the label standard shader

Lighting models other than Lambert - BlinnPhong, Standard, StandardSpecular

So far we've just been using the Lambert lighting model in our shaders. This is all well and good for simple non-shiny surfaces - but if we do want proper specular highlights, or more physical accuracy we'll want to use some other lighting models. Blinn Phong First up is BlinnPhong. To use it, change the usual #pragma statement to     #pragma surface surf BlinnPhong Also, in the Properties block we now will be using a few more variables -  Properties{     _Color("Colour",color)=(1,1,1,1)     _SpecColor("Specular Colour",color)=(1,1,1,1)     _Spec("Specular",Range(0,1))=0.5     _Gloss("Gloss",Range(0,1))=0.5 } The _Spec/Specular controls the coverage of the highlight & the _Gloss/Gloss controls the strength of the highlight. We do not have to define the _SpecColor within the SubShader block -Unity already has this built in for some reason & might complain if you do redefine it. Datatypes are - Float4/...