Korchy (korchy) wrote,
Korchy
korchy

OSL-шейдер "Полярные шапки"

Шейдер на OSL для создания снежных "полярных шапок"







shader PolarCap(
   vector Pos = P,
   float NorthBorder = 0.5,
   float SouthBorder = 0.5,
   float Noise = 0.0,
   output float Factor = 0)
{
   vector lP = transform("object",Pos);
   float SB = (clamp(SouthBorder,0.0,1.0))*2.0 - 1.0;
   float NB = (1.0 - clamp(NorthBorder,0.0,1.0))*2.0 - 1.0;
   if(lP[2]>=NB) {
      Factor = 1-(lP[2]+1)/2.0;
      Factor = Factor/(NorthBorder);
   }
   else {
      if(lP[2]<NB&&lP[2]>SB) {
         Factor = 1.0;
      }
      else {
         Factor = (lP[2]+1)/2.0;
         Factor = Factor/(SouthBorder);
      }
   }
   Factor = Noise+Factor;
   Factor = clamp(Factor,0.0,1.0);
}

Ноды




Скомпилированный OSL-шейдер: Градиент

Tags: blender_tips, cycles, osl
Subscribe

Comments for this post were disabled by the author