POV-Ray : Newsgroups : povray.text.scene-files : Exoskeleton shader (scene + shader) Server Time
5 Jul 2024 10:42:03 EDT (-0400)
  Exoskeleton shader (scene + shader) (Message 1 to 1 of 1)  
From: gemelli david
Subject: Exoskeleton shader (scene + shader)
Date: 16 Jan 2001 06:27:26
Message: <3A64308B.598AF2BB@xlstudio.com>
// see povray.binaries.images
//==================================================
//         SCENE
//==================================================
camera {
  location <9.0, 4.0, 0.0>
  sky <0.0, 1.0, 0.0>
  look_at <0.0, 2.5, 0.0>
}

light_source {
  <80.0, 100.0, 50.0>
  color rgb 1.0
}

light_source {
  <0.0, 100.0, -150.0>
  color rgb 1.0
}

plane {
  <0.0, 1.0, 0.0>, 0.0
  pigment {color rgb 1.0}
  finish {ambient 0.0}
}

union {
#local maxI = 144;
#local angleI = 360.0 / maxI;
#local maxJ = 72;
#local angleJ = 180.0 / maxJ;
#local dotR = 0.15;
#local sphereR = 2.0;

#local ii = 0;
#while (ii < maxI)
  #local jj = 0;
  #while (jj < maxJ)
    sphere {<0.0, 0.0, 0.0>, dotR
      translate sphereR * x
      rotate (-90 + (jj * angleJ)) * z
      rotate ii * angleI * y
    }
    #local jj = jj + 1;
  #end
  #local ii = ii + 1;
#end
  texture {
    pigment {
      shader {
        shader_file "Test052.slp"
        "basicColor" <0.0, 0.4, 0.0>
        "highlightColor" <0.0, 0.15, 0.4>
        "specularCoef" 0.7
        "specularRoughness" 0.01
      }
    }
  }
  normal {
    bumps 0.4
    scale 0.03
  }
  translate (sphereR + dotR) * y
}
//==================================================
//         END SCENE
//==================================================


//==================================================
//         SHADER (Test052.sl)
//==================================================
surface Test05(color basicColor = color (0.0, 0.4, 0.0),
                     highlightColor = color (0.0, 0.15, 0.4);
               float specularCoef = 0.7,
                     specularRoughness = 0.01;)
{
  vector Nn = normalize(N);
  vector Ln;
  point Nf;
  float prod;

  color spec = specular(Nn, -normalize(I), specularRoughness);

  color mixedColor;

  Ci = color (0.0, 0.0, 0.0);

  illuminance(P, Nn, PI)
  {
    Ln = normalize(L);
    prod = Ln.Nn;
    Nf = faceforward (Nn, L);

    mixedColor = mix (highlightColor, basicColor, 1.0 - (prod * prod));
    Ci += mixedColor * (Cl * prod + spec * specularCoef);
    Oi = Os;
  }
}
//==================================================
//         END SHADER (Test052.sl)
//==================================================


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.