POV-Ray : Newsgroups : povray.binaries.images : Using functions to distort images Server Time
14 Nov 2024 22:22:21 EST (-0500)
  Using functions to distort images (Message 1 to 8 of 8)  
From: Tor Olav Kristensen
Subject: Using functions to distort images
Date: 20 May 2006 17:12:52
Message: <446f8654@news.povray.org>
Here's the results of a little experiment I did today.

Functions are used to distort heavily photos (shot with my mobile).
(The resulting pigments can can be used in textures.)

-- 
Tor Olav
http://subcube.com


Post a reply to this message


Attachments:
Download 'imagepigment_functions_10.jpg' (427 KB)

Preview of image 'imagepigment_functions_10.jpg'
imagepigment_functions_10.jpg


 

From: Tor Olav Kristensen
Subject: Re: Using functions to distort images
Date: 20 May 2006 17:14:41
Message: <446f86c1@news.povray.org>
Tor Olav Kristensen wrote:
> 
> Here's the results of a little experiment I did today.
> 
> Functions are used to distort heavily photos (shot with my mobile).
> (The resulting pigments can can be used in textures.)

And here's another such image.

-- 
Tor Olav
http://subcube.com


Post a reply to this message


Attachments:
Download 'imagepigment_functions_08.jpg' (352 KB)

Preview of image 'imagepigment_functions_08.jpg'
imagepigment_functions_08.jpg


 

From: Dave Matthews
Subject: Re: Using functions to distort images
Date: 21 May 2006 14:50:00
Message: <web.4470b54a286bc2238c7259570@news.povray.org>
Tor Olav Kristensen <tor### [at] TOBEREMOVEDgmailcom> wrote:
> Here's the results of a little experiment I did today.
>
> Functions are used to distort heavily photos (shot with my mobile).
> (The resulting pigments can can be used in textures.)
>

Very cool (and useful, I think!)  I'm pretty sure I know how this is done,
but could you post up a snippet of code, showing it, please?

Dave Matthews


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Using functions to distort images
Date: 21 May 2006 18:25:45
Message: <4470e8e9@news.povray.org>
Dave Matthews wrote:
> Tor Olav Kristensen <tor### [at] TOBEREMOVEDgmailcom> wrote:
>> Here's the results of a little experiment I did today.
>>
>> Functions are used to distort heavily photos (shot with my mobile).
>> (The resulting pigments can can be used in textures.)
>>
> 
> Very cool (and useful, I think!)  I'm pretty sure I know how this is done,
> but could you post up a snippet of code, showing it, please?

Sure Dave - see source code below.

Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Use of functions to distort image
// Tor Olav Kristensen, 21. May 2006
// http://subcube.com
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.6;

#include "functions.inc"

global_settings {
   ambient_light color rgb <1, 1, 1>
//  assumed_gamma 1.0
}

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

#declare ImageFn =
   function { pigment { image_map { "YourImage.png" } } }

#declare Ampl = 1.5;
#declare Freq = 1.0;

#declare NoiseFnX =
   function { Ampl*(f_agate( 0 + Freq*x, Freq*y, z) - 0.5) }
#declare NoiseFnY =
   function { Ampl*(f_agate(10 + Freq*x, Freq*y, z) - 0.5) }

#declare PigmentR =
   pigment {
     function {
       ImageFn(x + NoiseFnX(x, y, z), y + NoiseFnY(x, y, z), z).red
     }
     color_map {
       [ 0 color red 0 ]
       [ 1 color red 3 ]
     }
   }

#declare PigmentG =
   pigment {
     function {
       ImageFn(x + NoiseFnX(x, y, z), y + NoiseFnY(x, y, z), z).green
     }
     color_map {
       [ 0 color green 0 ]
       [ 1 color green 3 ]
     }
   }

#declare PigmentB =
   pigment {
     function {
       ImageFn(x + NoiseFnX(x, y, z), y + NoiseFnY(x, y, z), z).blue
     }
     color_map {
       [ 0 color blue 0 ]
       [ 1 color blue 3 ]
     }
   }

box {
   -<1, 1, 1>/2, <1, 1, 1>/2
   texture {
     pigment {
       average
       pigment_map {
         [ PigmentR ]
         [ PigmentG ]
         [ PigmentB ]
       }
     }
     finish { ambient color rgb <1, 1, 1> } // Adjust brightness here
     translate -<1, 1, 0>/2
   }
   scale <4, 3, 1>
}

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

camera {
   orthographic
   location -3.1*z
   look_at 0*y
}

background { color rgb <1, 1, 1> }

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


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Using functions to distort images
Date: 21 May 2006 18:52:51
Message: <4470ef43@news.povray.org>
Tor Olav Kristensen wrote:
> Dave Matthews wrote:
>> Tor Olav Kristensen <tor### [at] TOBEREMOVEDgmailcom> wrote:
>>> Here's the results of a little experiment I did today.
>>>
>>> Functions are used to distort heavily photos (shot with my mobile).
>>> (The resulting pigments can can be used in textures.)
>>>
>>
>> Very cool (and useful, I think!)  I'm pretty sure I know how this is 
>> done,
>> but could you post up a snippet of code, showing it, please?
> 
> Sure Dave - see source code below.

There's now a macro version of the code in povray.text.scene-files:

http://news.povray.org/4470ee5b%40news.povray.org

-- 
Tor Olav
http://subcube.com


Post a reply to this message

From: Dave Matthews
Subject: Re: Using functions to distort images
Date: 21 May 2006 19:15:40
Message: <4470f49c@news.povray.org>
Tor Olav Kristensen wrote:

> There's now a macro version of the code in povray.text.scene-files:
> 
> http://news.povray.org/4470ee5b%40news.povray.org
> 

Thank you!


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Using functions to distort images
Date: 21 May 2006 19:34:04
Message: <4470f8ec@news.povray.org>
Dave Matthews wrote:
> Tor Olav Kristensen wrote:
> 
>> There's now a macro version of the code in povray.text.scene-files:
>>
>> http://news.povray.org/4470ee5b%40news.povray.org
>>
> 
> Thank you!

=)

There's now yet another version of the source code in 
povray.text.scene-files

-- 
Tor Olav
http://subcube.com


Post a reply to this message

From: Sebastian
Subject: Re: Using functions to distort images
Date: 23 May 2006 10:11:12
Message: <pan.2006.05.23.14.11.11.515347@gmx.de>
Am Sat, 20 May 2006 23:14:33 +0200 schrieb Tor Olav Kristensen:


> And here's another such image.

Interesting


Post a reply to this message

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