POV-Ray : Newsgroups : povray.binaries.scene-files : A POV-color picker Server Time
1 Sep 2024 16:13:00 EDT (-0400)
  A POV-color picker (Message 1 to 3 of 3)  
From: Paolo Gibellini
Subject: A POV-color picker
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)

From: MatrixFrog
Subject: Re: A POV-color picker
Date: 8 Jul 2005 04:05:02
Message: <web.42ce335a2715ce6ec62e6bcb0@news.povray.org>
Cool! I actually made something similar, but not nearly as good as this. I
didn't realize this already existed.

http://news.povray.org/povray.binaries.scene-files/thread/%3Cweb.42cc6059664ac275c62e6bcb0%40news.povray.org%3E/


Post a reply to this message

From: Paolo Gibellini
Subject: Re: A POV-color picker
Date: 8 Jul 2005 08:54:30
Message: <42ce7786$1@news.povray.org>
Hope it can help you.
I've realized that a 3d color picker must be interactive and needs some
(simple) mathematics and time (I haven't) to be performed.
Basic idea is to have a 256+256+256 cube with visible pixel colored by
coordinates (e.g. r=x, g=y, b=z), a button to rotate the cube and a pipe
tool to pick in depth the color, showing the section of the cube normal to
the pipe while the pipe is advancing in his interior. From the section the
color can be picked.

Have a nice day,
;-)
Paolo

> Cool! I actually made something similar, but not nearly as good as this. I
> didn't realize this already existed.


Post a reply to this message

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