POV-Ray : Newsgroups : povray.newusers : Image function : Re: Image function Server Time
18 Apr 2024 12:34:50 EDT (-0400)
  Re: Image function  
From: Bald Eagle
Date: 29 May 2023 13:55:00
Message: <web.6474e69a8a5f67eb1f9dae3025979125@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
> On 28/05/2023 22:06, Bald Eagle wrote:
> > Once again, I'm asking WHY?
>
> apologies...
>
> I didn't describe what I wanted to do very well.
> I'll try to be clearer.
>
> a) I recover the color of a point <x,0,z> of a source image.
> b) I transform this point into a new point <x1,0,z1>.
> c) I give this new point the color taken in a)
>
> In fact, I already have a code that does this, but only with the checker
> pattern. Not very sexy !


Ah, excellent.
This makes much more sense now.

> The "geometric" transformation is the result of applying function.
> Two examples with f(z) = z^2 and f(z) = sin(z)/(z+1).
>
> Brighter ?

Much better.
Have coded a geometric inversion function?   I would be highly interested in
that for use with Clifford tori and such.

Anyway, here's what I think you need to do if you want to modify an image_map
using a function, and still have the full color.

Then all you have to do is modify the function.

------------------------------------------------------------------------



#version 3.8;
global_settings {assumed_gamma 1.0}
default {finish {diffuse 1}}

// +am3 +a0.01 +ac0.90 +r3


camera {
 location <0, 5, -0.01>
 right     x*image_width/image_height
 up y
 look_at <0, 0, 0>
}

light_source {<0, 100, 0> rgb 1.0}

sky_sphere {pigment {rgb 1}}


#declare ImageMap = function {pigment {image_map {png "plasma2.png"} rotate
x*90} }


#declare FullColorTexture =
  texture {
   pigment {
          average
          pigment_map {
              [
                  function { ImageMap (x, y, z).red }
                  color_map {
                      [ 0 red 0 ]
                      [ 1 red 5 ]
                  }
              ]
              [
                  function { ImageMap (x, y, z).green }
                  color_map {
                      [ 0 green 0 ]
                      [ 1 green 5 ]
                  }
              ]
              [
                  function { ImageMap (x, y, z).blue }
                  color_map {
                      [ 0 blue 0 ]
                      [ 1 blue 5 ]
                  }
              ]
                [
                  function { ImageMap (x, y, z).filter }
                  color_map {
                      [ 0 blue 0 ]
                      [ 1 blue 5 ]
                  }
              ]
                [
                  function { ImageMap (x, y, z).transmit }
                  color_map {
                      [ 0 blue 0 ]
                      [ 1 blue 5 ]
                  }
              ]
    } // end pigment map
   } // end pigment
  } // end layered texture

plane {
 y, 0
 texture {FullColorTexture }
}


Hope that works the way you want.

- BW


Post a reply to this message


Attachments:
Download 'imagemapfunction.pov.dat' (2 KB)

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