POV-Ray : Newsgroups : povray.binaries.scene-files : A POV-color picker : A POV-color picker Server Time
1 Sep 2024 18:20:29 EDT (-0400)
  A POV-color picker  
From: Paolo Gibellini
Date: 3 Jan 2005 11:30:32
Message: <41d97328$1@news.povray.org>
Sample image in p.b.i.
;-)
Paolo

%<-------------------------- cut here ----

// POV-color picker
// Paolo Gibellini 2005
// A simple wallpaper: +H1280 +W1024 +A0.1 (for straight lines AA 0.1 is
better)
/*
Parameters

cubes: size of the color cube
  n.b. increasing this number could be very memory-consuming (with 256 Mb I
cannot use more than 100 cubes)

tipo: type of the color 0=solid, 1=semitransparent, 2=metallic

random seed determines position (picking) of the color dropper and the color
of the dropper itself

 */


#version 3.5;

#include "colors.inc"

// Impostazioni globali ------------------------------------
global_settings {
  assumed_gamma 1.0
  max_trace_level 5
}
// ---------------------------------------------------------

// Ambiente ------------------------------------------------
sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}
// ---------------------------------------------------------

// Parameters ----------------------------------------------
#declare cubes=8;     /* Size of the color cube */
#declare tipo=2;      /* 0=solid, 1=semitransparent, 2=metallic */
#declare s=seed(39);   /* Random seed (determines position of the color
dropper and the color of the dropper itself) */
// ---------------------------------------------------------

// Random --------------------------------------------------
#macro r(m)
    rand(s)*m
#end
// ---------------------------------------------------------

// Textures ------------------------------------------------
#declare t_cromata=texture {
    pigment {
      color rgb <0.8,0.8,1.0>
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.8
        metallic
      }
      conserve_energy
    }
}

#declare t_onde=  texture {
    pigment {
      color rgb <0.8,0.8,1.0>
    }
    normal {
     waves
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.8
      }
    }
}
// Moray's NBoldglass
#declare NBoldglass = material  {
      texture {
         pigment {
            color rgbf <0.8, 0.9, 0.85, 0.85>
         }
         finish {
            ambient 0.1
            diffuse 0.1
            specular 1.0
            roughness 0.001
            reflection 0.25
         }
      }
      interior  {
         ior 1.5
      }
}
// ---------------------------------------------------------


// Camera --------------------------------------------------
camera {
  location  <-cubes*0.8, cubes*0.6, -cubes*3.5>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   cubes/2
}
// ---------------------------------------------------------

// Un po' di scena -----------------------------------------
plane {
 y, -3
 texture {t_onde scale cubes}
}

sphere {
 <-cubes/2,cubes/1.8,cubes/2>, cubes/3
 texture {t_cromata}
}
// ---------------------------------------------------------

// color dropper -------------------------------------------
#declare cx=(r(cubes))*0.6+cubes*0.2;
#declare cy=(r(cubes))*0.6+cubes*0.2;
#declare cz=(r(cubes))*0.6+cubes*0.2;
cylinder {<cx,cy,cz> <cubes*0.8,cubes*0.9,-cubes*1> 0.2*(cubes/10)
 pigment {color rgbft <cx/cubes,cy/cubes,cz/cubes,0.6,0.3>}
}
cylinder {<cubes*0.8,cubes*0.9,-cubes*1> <cubes*0.8,cubes*0.7,-cubes*1.35>
0.2*(cubes/10)
 pigment {color rgbft <cx/cubes,cy/cubes,cz/cubes,0.3,0.3>}
}
// ---------------------------------------------------------

// Glass ---------------------------------------------------
difference {
 cylinder {<cubes*0.8,cubes*0.8,-cubes*1.3>
<cubes*0.8,cubes*0.35,-cubes*1.3> 1.1*(cubes/10)}
 cylinder {<cubes*0.8,cubes*0.8,-cubes*1.3> <cubes*0.8,cubes*0.4,-cubes*1.3>
1*(cubes/10)}
 material {NBoldglass}
}
cylinder {<cubes*0.8,cubes*0.7,-cubes*1.3> <cubes*0.8,cubes*0.4,-cubes*1.3>
1*(cubes/10)
 pigment {color rgb <cx/cubes,cy/cubes,cz/cubes>}
}
// ---------------------------------------------------------

// Colors --------------------------------------------------
#declare rx=0;
#declare gy=0;
#declare bz=0;
#while (rx<cubes)
 #declare gy=0;
 #while (gy<cubes)
  #declare bz=0;
  #while (bz<cubes)
   #switch(tipo)
    #case(1)
     box {<rx,gy,bz>, <rx+0.8,gy+0.8,bz+0.8> pigment {color rgbft
<rx/cubes,gy/cubes,bz/cubes,0.6,0.3>}}
    #break
    #case(2)
     box {<rx,gy,bz>, <rx+0.8,gy+0.8,bz+0.8> pigment {color rgb
<rx/cubes,gy/cubes,bz/cubes> } finish{diffuse 0.3 ambient 0.0 specular 0.6
reflection {0.8 metallic}}}
    #break
    #else
     box {<rx,gy,bz>, <rx+0.8,gy+0.8,bz+0.8> pigment {color rgb
<rx/cubes,gy/cubes,bz/cubes>}}
   #end
   #declare bz=bz+1;
  #end
  #declare gy=gy+1;
 #end
 #declare rx=rx+1;
#end
// ---------------------------------------------------------


Post a reply to this message


Attachments:
Download 'color_picker_03_en.zip' (2 KB)

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