POV-Ray : Newsgroups : povray.text.scene-files : Function-Based Shader Macro Server Time
30 Jun 2024 04:42:47 EDT (-0400)
  Function-Based Shader Macro (Message 1 to 1 of 1)  
From: Dave Dunn
Subject: Function-Based Shader Macro
Date: 17 Aug 2002 08:57:45
Message: <3D5E48F1.6812959C@aol.com>
//Here is the source for the f_ridged_mf-based shader macro in p.b.i...

#version 3.5;

#include "colors.inc"
#include "functions.inc"

global_settings {
assumed_gamma 1.0}

camera {
  location  <0,2,-8>
  look_at   <0,2,0> }

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0 rgb <.6,.7,1>]
      [.7 rgb <0,.1,.8>]}}}

light_source { <-30,130,-130> White}

plane { y, -1 pigment {rgb <.7,.5,.3>}}


#macro
ShaderRidged(X_Scale,Y_Scale,Z_Scale,Offset,Noise,Color_1,Color_2,Color_3,Bump_Size)

texture {
 pigment {
   function {
   f_ridged_mf(x*X_Scale,y*Y_Scale,z*Z_Scale,1,1,0,Offset,0,Noise)}
   color_map {
   [0 Color_1]
   [.5 Color_2]
   [1 Color_3]} }
 normal {
   function {

f_ridged_mf(x*X_Scale,y*Y_Scale,z*Z_Scale,1,1,0,Offset,0,Noise)*(1/Bump_Size)}}

 finish {specular .5 roughness .0005 reflection {.2}}}
#end


//Bottom Row
sphere { 0,1
ShaderRidged(8,8,8,0,0,Red,White,Blue,-2)
translate x*-2}

sphere {0,1
ShaderRidged(2,2,2,1,0,Yellow,Orange,Aquamarine,1)}

sphere {0,1
ShaderRidged(4,4,4,.5,0,Red,Blue,Green,1.5)
translate x*2}

//Mid Row
sphere {0,1
ShaderRidged(2,4,8,0,1,Pink,Salmon,Violet,-2)
translate <-2,2,0>}

sphere {0,1
ShaderRidged(2,8,4,1,1,Clear,Gray50,Yellow,1)
translate <0,2,0>}

sphere {0,1
ShaderRidged(8,4,2,.5,1,Gold,Silver,Black,-1.5)
translate <2,2,0>}

//Top Row
sphere {0,1
ShaderRidged(4,2,8,-1,1,Red,White,Black,2)
translate <-2,4,0>}

sphere {0,1
ShaderRidged(4,4,8,-1,0,Red,Orange,Yellow,-1)
translate <0,4,0>}

sphere {0,1
ShaderRidged(4,8,2,-.5,1,Salmon,Green,Khaki,1.5)
translate <2,4,0>}


Post a reply to this message

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