POV-Ray : Newsgroups : povray.binaries.images : pattern blend : Re: pattern blend Server Time
30 Apr 2024 16:19:12 EDT (-0400)
  Re: pattern blend  
From: Tor Olav Kristensen
Date: 3 Apr 2018 12:20:01
Message: <web.5ac3a9038351d7b05bf3e3600@news.povray.org>
"Norbert Kern" <nor### [at] t-onlinede> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> >
> > Hi Norbert
> >
> > Your post inspired me to try to achieve image solarisation with the
> > new user defined pattern in v3.8:
> >
> > http://wiki.povray.org/content/Reference:User_Defined_Pattern
>
>
> Hi Tor,
>
> very well done.
> I've to look more in user defined pattern - definitively.

Thank you Norbert

For those of you that hasn't started to experiment with v3.8 yet,
here is some code that can be used with v3.7 to achieve the same:

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Tor Olav Kristensen
// http://subcube.com
// Solarizing an image
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.7;

// For this image made by Gilles Tran:
// http://hof.povray.org/images/glasses.jpg
#declare GuessedGamma = 2.2;

global_settings { assumed_gamma GuessedGamma }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Render with same image dimensions as the original image for best
// result. E.g.: +w1024 +h768 +FJ

#declare PigmentFn =
    function {
        pigment {
            image_map {
                jpeg "glasses.jpg"  // 1024 x 768 pixels
                gamma GuessedGamma
                interpolate 2
            }
        }
    }
;

// Frequency = 0.5 and Inverted = true
// - will give original image (approximately)
#declare Frequency = 1.0; // Try 0.5, 1.0, 1.5, 2.0, ...
#declare Inverted = false;

#declare Fn = function(x) { Frequency*mod(x, 1/Frequency) };
#declare VeeFn = function(x) { 2*max(Fn(x), 1 - Fn(x)) - 1 };
#declare InvertedVeeFn = function(x) { 1 - VeeFn(x) };

#if (Inverted)
    #declare SolarizeFn = InvertedVeeFn ;
#else
    #declare SolarizeFn = VeeFn;
#end // if

#declare PigmentR =
    pigment {
        function { SolarizeFn(PigmentFn(x, y, z).red  ) }
        color_map {
            [ 0 color red   0 ]
            [ 1 color red   3 ]
        }
    }
;

#declare PigmentG =
    pigment {
        function { SolarizeFn(PigmentFn(x, y, z).green) }
        color_map {
            [ 0 color green 0 ]
            [ 1 color green 3 ]
        }
    }
;

#declare PigmentB =
    pigment {
        function { SolarizeFn(PigmentFn(x, y, z).blue ) }
        color_map {
            [ 0 color blue  0 ]
            [ 1 color blue  3 ]
        }
    }
;

box {
    <0, 0, 0>, <1, 1, 1>
    texture {
        pigment {
            average
            pigment_map {
                [ PigmentR ]
                [ PigmentG ]
                [ PigmentB ]
            }
        }
        finish {
            diffuse 0
            emission color rgb <1, 1, 1>
        }
    }
    translate -<1, 1, 0>/2
    scale <image_width, image_height, 1>
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

camera {
    orthographic
    right image_width*x
    up image_height*y
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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