POV-Ray : Newsgroups : povray.general : Photoshop Question (needed for texture) : Re: Photoshop Question (needed for texture) Server Time
24 Apr 2024 22:07:55 EDT (-0400)
  Re: Photoshop Question (needed for texture)  
From: Sven Littkowski
Date: 31 Jul 2017 19:43:16
Message: <597fc094$1@news.povray.org>
On 31.07.2017 15:18, Bald Eagle wrote:
> "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...
> 
> 
> 
> 
Thanks. Actually, there is a related thread inside the IMAGE group,
there you can see the texture file and its many pie-shaped areas, which
I want to transform to the individual average color of each section.

---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com


Post a reply to this message

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