POV-Ray : Newsgroups : povray.binaries.scene-files : And's pattern blend playground Server Time: 14 Dec 2018 14:26:21 GMT
  And's pattern blend playground (Message 1 to 3 of 3)  
From: Thomas de Groot
Subject: And's pattern blend playground
Date: 9 Mar 2018 12:20:26
Message: <5aa27c0a@news.povray.org>
With thanks to And, a little playground when you have nothing better to 
do :-)


/**********************************************************************************
  Persistence of Vision Ray Tracer Scene Description File
  File name   : And_Pattern blend.pov
  Version     : 3.71
  Description : Pattern blending of a photograph.

  Date        : 2 March 2018
  Author      : And
  E-mail      : in p.b.i. pattern blend (by And):
 
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5a996d03fe35f84f1c2f7e850%40news.povray.org%3E/
  See also:
 
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5a996d03fe35f84f1c2f7e850%40news.povray.org%3E/?mtop=421077&moff=20

**********************************************************************************/

// Render settings 3.7 (right-click on a line below):
// Be sure to set the image width and height
// for glasses.jpg:
// +w1024 +h768 +a0.3 +am2 +bm2 +rp0 +bs8 +wt6

#version 3.71;
//#version unofficial patch 3.71; //UberPOV

#include "stdinc.inc"

#local Rad     = off;     // radiosity switch

global_settings {
   assumed_gamma 1.0
   max_trace_level 5
   noise_generator 2
   #if (Rad)
     radiosity {
       pretrace_start   0.08
       pretrace_end     0.004
       count            100, 1000
       nearest_count    10, 5
       error_bound      1
       recursion_limit  1
       low_error_factor 0.3
       gray_threshold   0.0
       minimum_reuse    0.015
       maximum_reuse    0.1		
       brightness       1

       adc_bailout      0.01/2
       normal           off
       media            off
       always_sample    off
       //max_sample     1.0
     }
   #end
}

// ----------------------------------------
camera {
   orthographic
   location  <0.0, 0.0, -10.0>
   look_at   <0.0, 0.0,  0.0>
   right     x*image_width
   up        y*image_height
   angle 5.8*1
}

background {color rgb 1}

//==============================================================================================
// Controls:
#local Mono    = off;    // monochrome/polychrome switch
#local Gamma   = 5;      // play with this value for interesting results
#local Pattern = 1;      // 1=crackle solid; 2=granite; 3=agate; 
4=bumps; 5=quilted; 6=bozo;
#local N       = 0.1;  // use N <= 1.0
#local rotZ    = 40;     // rotation angle of the pattern around the z-axis

//==============================================================================================
// Load here your image:
#declare p_original =
pigment {
   image_map {
     jpeg "glasses.jpg" gamma Gamma
     map_type 0
     interpolate 2
   }
}

//==============================================================================================
#if (Mono)

#declare p_modify =
pigment{
     pigment_pattern{p_original}
     pigment_map {
     #for(i,0,255)
       [i/255  #switch (Pattern)
               #case(1)
                 crackle solid
               #break #case(2)
                 granite
               #break #case(3)
                 agate
               #break #case(4)
                 bumps
               #break #case(5)
                 quilted control0 0.5 control1 1
               #break #case(6)
                 bozo
               #end
               scale (1/<image_width, image_height, 1>)*N
               rotate <0,0, rotZ>
               color_map {
                 [0.2+0.6*(1-pow(i/255,1/3)) rgbt<0,0,0,0.1>]
                 [0.2+0.6*(1-pow(i/255,1/3)) rgbt<0,0,0,0.9>]
               }
       ]
     #end
     }
}

#else

#declare f_original =
function {pigment {p_original}}

#declare f_o_R = function {f_original (x,y,z).red}
#declare f_o_G = function {f_original (x,y,z).green}
#declare f_o_B = function {f_original (x,y,z).blue}

#declare f_modify =
pigment {
   average
   pigment_map {
     [1    function {f_o_R (x,y,z)}
           pigment_map {
             #for (i, 0, 255)
                  [i/255  #switch (Pattern)
                          #case(1)
                            crackle solid
                          #break #case(2)
                            granite
                          #break #case(3)
                            agate
                          #break #case(4)
                            bumps
                          #break #case(5)
                            quilted control0 0.5 control1 1
                          #break #case(6)
                            bozo
                          #end
                          scale (1/<image_width, image_height, 1>)*N
                          rotate <0,0, rotZ>
                          color_map {
                            [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,0,0.1>]
                            [0.2+0.6*(1-pow (i/255,1/3)) srgbt <3,0,0,0.9>]
                          }
                  ]
             #end
           }
         ]
     [1    function {f_o_G (x,y,z)}
           pigment_map {
             #for (i, 0, 255)
                  [i/255  #switch (Pattern)
                          #case(1)
                            crackle solid
                          #break #case(2)
                            granite
                          #break #case(3)
                            agate
                          #break #case(4)
                            bumps
                          #break #case(5)
                            quilted control0 0.5 control1 1
                          #break #case(6)
                            bozo
                          #end
                          scale (1/<image_width, image_height, 1>)*N
                          rotate <0,0, rotZ>
                          color_map {
                            [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,0,0.1>]
                            [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,3,0,0.9>]
                          }
                  ]
             #end
           }
         ]
     [1    function {f_o_B (x,y,z)}
           pigment_map {
             #for (i, 0, 255)
                  [i/255  #switch (Pattern)
                          #case(1)
                            crackle solid
                          #break #case(2)
                            granite
                          #break #case(3)
                            agate
                          #break #case(4)
                            bumps
                          #break #case(5)
                            quilted control0 0.5 control1 1
                          #break #case(6)
                            bozo
                          #end
                          scale (1/<image_width, image_height, 1>)*N
                          rotate <0,0, rotZ>
                          color_map {
                            [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,0,0.1>]
                            [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,3,0.9>]
                          }
                  ]
              #end
            }
          ]
   }
}

#end

//==============================================================================================
plane {
   z, 0
   #if (Mono)
     pigment {p_modify
   #else
     pigment {f_modify
   #end
     translate -0.5
     scale <image_width, image_height, 1>
     scale 0.001
   }
   finish {emission 1 diffuse 0}
   no_shadow
}

//==============================================================================================

-- 
Thomas


Post a reply to this message

From: omniverse
Subject: Re: And's pattern blend playground
Date: 11 Mar 2018 00:15:00
Message: <web.5aa4742c86da4c369c5d6c810@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> With thanks to And, a little playground when you have nothing better to
> do :-)
Thanks to you too, I had just started looking at that a few days ago and thought
I would try layering images to combine them. Didn't get far but on a whim I
changed to interpolate 3 for the input image and got an interesting result.

Reading the docs to refresh my memory on that bicubic interpolation it says
there could be a sharpening effect on certain color boundaries. So that probably
explains the peculiar outlines seen in these pattern blend renderings if
interpolate 3 is used.


Post a reply to this message

From: And
Subject: Re: And's pattern blend playground
Date: 25 Jun 2018 06:45:01
Message: <web.5b308ebf86da4c362d85b1510@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> With thanks to And, a little playground when you have nothing better to
> do :-)
>
>
> /**********************************************************************************
>   Persistence of Vision Ray Tracer Scene Description File
>   File name   : And_Pattern blend.pov
>   Version     : 3.71
>   Description : Pattern blending of a photograph.
>
>   Date        : 2 March 2018
>   Author      : And
>   E-mail      : in p.b.i. pattern blend (by And):
>
>
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5a996d03fe35f84f1c2f7e850%40news.povray.org%3E/
>   See also:
>
>
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5a996d03fe35f84f1c2f7e850%40news.povray.org%3E/?mtop=4210
77&moff=20
>
> **********************************************************************************/
>
> // Render settings 3.7 (right-click on a line below):
> // Be sure to set the image width and height
> // for glasses.jpg:
> // +w1024 +h768 +a0.3 +am2 +bm2 +rp0 +bs8 +wt6
>
> #version 3.71;
> //#version unofficial patch 3.71; //UberPOV
>
> #include "stdinc.inc"
>
> #local Rad     = off;     // radiosity switch
>
> global_settings {
>    assumed_gamma 1.0
>    max_trace_level 5
>    noise_generator 2
>    #if (Rad)
>      radiosity {
>        pretrace_start   0.08
>        pretrace_end     0.004
>        count            100, 1000
>        nearest_count    10, 5
>        error_bound      1
>        recursion_limit  1
>        low_error_factor 0.3
>        gray_threshold   0.0
>        minimum_reuse    0.015
>        maximum_reuse    0.1
>        brightness       1
>
>        adc_bailout      0.01/2
>        normal           off
>        media            off
>        always_sample    off
>        //max_sample     1.0
>      }
>    #end
> }
>
> // ----------------------------------------
> camera {
>    orthographic
>    location  <0.0, 0.0, -10.0>
>    look_at   <0.0, 0.0,  0.0>
>    right     x*image_width
>    up        y*image_height
>    angle 5.8*1
> }
>
> background {color rgb 1}
>
>
//==============================================================================================
> // Controls:
> #local Mono    = off;    // monochrome/polychrome switch
> #local Gamma   = 5;      // play with this value for interesting results
> #local Pattern = 1;      // 1=crackle solid; 2=granite; 3=agate;
> 4=bumps; 5=quilted; 6=bozo;
> #local N       = 0.1;  // use N <= 1.0
> #local rotZ    = 40;     // rotation angle of the pattern around the z-axis
>
>
//==============================================================================================
> // Load here your image:
> #declare p_original =
> pigment {
>    image_map {
>      jpeg "glasses.jpg" gamma Gamma
>      map_type 0
>      interpolate 2
>    }
> }
>
>
//==============================================================================================
> #if (Mono)
>
> #declare p_modify =
> pigment{
>      pigment_pattern{p_original}
>      pigment_map {
>      #for(i,0,255)
>        [i/255  #switch (Pattern)
>                #case(1)
>                  crackle solid
>                #break #case(2)
>                  granite
>                #break #case(3)
>                  agate
>                #break #case(4)
>                  bumps
>                #break #case(5)
>                  quilted control0 0.5 control1 1
>                #break #case(6)
>                  bozo
>                #end
>                scale (1/<image_width, image_height, 1>)*N
>                rotate <0,0, rotZ>
>                color_map {
>                  [0.2+0.6*(1-pow(i/255,1/3)) rgbt<0,0,0,0.1>]
>                  [0.2+0.6*(1-pow(i/255,1/3)) rgbt<0,0,0,0.9>]
>                }
>        ]
>      #end
>      }
> }
>
> #else
>
> #declare f_original =
> function {pigment {p_original}}
>
> #declare f_o_R = function {f_original (x,y,z).red}
> #declare f_o_G = function {f_original (x,y,z).green}
> #declare f_o_B = function {f_original (x,y,z).blue}
>
> #declare f_modify =
> pigment {
>    average
>    pigment_map {
>      [1    function {f_o_R (x,y,z)}
>            pigment_map {
>              #for (i, 0, 255)
>                   [i/255  #switch (Pattern)
>                           #case(1)
>                             crackle solid
>                           #break #case(2)
>                             granite
>                           #break #case(3)
>                             agate
>                           #break #case(4)
>                             bumps
>                           #break #case(5)
>                             quilted control0 0.5 control1 1
>                           #break #case(6)
>                             bozo
>                           #end
>                           scale (1/<image_width, image_height, 1>)*N
>                           rotate <0,0, rotZ>
>                           color_map {
>                             [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,0,0.1>]
>                             [0.2+0.6*(1-pow (i/255,1/3)) srgbt <3,0,0,0.9>]
>                           }
>                   ]
>              #end
>            }
>          ]
>      [1    function {f_o_G (x,y,z)}
>            pigment_map {
>              #for (i, 0, 255)
>                   [i/255  #switch (Pattern)
>                           #case(1)
>                             crackle solid
>                           #break #case(2)
>                             granite
>                           #break #case(3)
>                             agate
>                           #break #case(4)
>                             bumps
>                           #break #case(5)
>                             quilted control0 0.5 control1 1
>                           #break #case(6)
>                             bozo
>                           #end
>                           scale (1/<image_width, image_height, 1>)*N
>                           rotate <0,0, rotZ>
>                           color_map {
>                             [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,0,0.1>]
>                             [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,3,0,0.9>]
>                           }
>                   ]
>              #end
>            }
>          ]
>      [1    function {f_o_B (x,y,z)}
>            pigment_map {
>              #for (i, 0, 255)
>                   [i/255  #switch (Pattern)
>                           #case(1)
>                             crackle solid
>                           #break #case(2)
>                             granite
>                           #break #case(3)
>                             agate
>                           #break #case(4)
>                             bumps
>                           #break #case(5)
>                             quilted control0 0.5 control1 1
>                           #break #case(6)
>                             bozo
>                           #end
>                           scale (1/<image_width, image_height, 1>)*N
>                           rotate <0,0, rotZ>
>                           color_map {
>                             [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,0,0.1>]
>                             [0.2+0.6*(1-pow (i/255,1/3)) srgbt <0,0,3,0.9>]
>                           }
>                   ]
>               #end
>             }
>           ]
>    }
> }
>
> #end
>
>
//==============================================================================================
> plane {
>    z, 0
>    #if (Mono)
>      pigment {p_modify
>    #else
>      pigment {f_modify
>    #end
>      translate -0.5
>      scale <image_width, image_height, 1>
>      scale 0.001
>    }
>    finish {emission 1 diffuse 0}
>    no_shadow
> }
>
>
//==============================================================================================
>
> --
> Thomas



Well, I didn't know you post an article here.


Post a reply to this message

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