POV-Ray : Newsgroups : povray.binaries.images : pattern blend : Re: pattern blend Server Time
30 Apr 2024 07:49:16 EDT (-0400)
  Re: pattern blend  
From: Tor Olav Kristensen
Date: 16 Mar 2018 23:35:00
Message: <web.5aac8b2f8351d7b0de6196580@news.povray.org>
"Norbert Kern" <nor### [at] t-onlinede> wrote:
> Stephen <mca### [at] aolcom> wrote:
>
> > Has anyone tried to produce a solarisation effect?
>
> Hi,
> with a simple approach I got this image - here is the code
> ...

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

BTW: Nice tricks to scale the camera vectors by the image dimensions
and to make a V-function with the max function !

Here's the results from my experiment:

// ===== 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.8;

// 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. Anti-aliasing can be used. E.g.: +w1024 +h768 +a0.1 +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

box {
    <0, 0, 0>, <1, 1, 1>
    texture {
        pigment {
            user_defined {
                function { SolarizeFn(PigmentFn(x, y, z).red  ) },
                function { SolarizeFn(PigmentFn(x, y, z).green) },
                function { SolarizeFn(PigmentFn(x, y, z).blue ) }
            }
        }
        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


Attachments:
Download 'solarized glasses.jpg' (77 KB)

Preview of image 'solarized glasses.jpg'
solarized  glasses.jpg


 

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