|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Maybe if you just use eval pigment to sample all the rgb values, average them
> and then place a box at that point, using only povray.
#version 3.71
global_settings {
assumed_gamma 1.0
}
// example scene to average pigment values in a box
// x and y ranges are -0.5 to 0.5
// Bill Walker "Bald Eagle" 2017
#include "colors.inc"
#include "functions.inc"
#include "rand.inc"
camera {
orthographic
location <0,0,-1> // position & direction of view
look_at <0,0,0>
right 1*x // horizontal size of view
up 1*y // vertical size of view
}
#declare Rseed = seed (123);
#declare Gseed = seed (456);
#declare Bseed = seed (789);
#declare Pig =
pigment {
cells
color_map {
#for (E, 0, 1, 0.1)
#local R = rand (Rseed);
#local G = rand (Gseed);
#local B = rand (Bseed);
[E color red R green G blue B]
#end // end for E
} // color_map
scale 0.01
} // end pigment
box { // this box fits exactly in view
<-0.5, -0.5, 0>, <0.5, 0.5, 0>
pigment {Pig}
} // end box
#declare YS = 1/image_height;
#declare XS = 1/image_width;
#declare ymin = 0.12;
#declare ymax = 0.25;
#declare xmin = -0.11;
#declare xmax = 0.15;
#declare AVG = 0;
#for (Y, ymin, ymax, YS)
#for (X, xmin, xmax, XS)
#declare Shade = eval_pigment (Pig, <X, Y, 0>);
#declare AVG = AVG + Shade;
#end // end for X
#end // end for Y
#declare AVG = AVG / ( ((xmax-xmin)/XS) * ((ymax-ymin)/YS) );
box { // this box fits exactly in view
<xmin, ymin, -0.01>, <xmax, ymax, -0.01>
texture {pigment {color rgb AVG}}
} // end box
Gives a gray box over the "cells" pattern.
I'm aware of the redundancy of generating the random colors for the cells
pattern - but I wanted that code block in there with the color map...
Post a reply to this message
|
|