POV-Ray : Newsgroups : povray.advanced-users : help with my code Server Time
24 Nov 2024 17:54:06 EST (-0500)
  help with my code (Message 1 to 5 of 5)  
From: Dennis Miller
Subject: help with my code
Date: 13 Feb 2006 08:36:05
Message: <43f08b45$1@news.povray.org>
Hello. I have been having great luck with using image maps to create 
isosurfaces, but I must admit, I don;t quite understand what is happening. 
What specific parameters of the preexisting bitmaps are being extracted for 
use as isosurface parameters? Luminance, for example? In the code below, I 
use frames from a video of myself for both the pigment and the function. The 
result is awesome. But can someone explain, in any level of detail, what 
processes are at work? When I union ("morph" may be a better term here) the 
function onto a sphere, the image looks like Mt. Rushmore - the face is 
carved out of the surface of the sphere (excellent!).
In any event, thanks very much for the help.
Best,
Dennis

#declare IM = pigment {
  image_map {
  tga concat("e:\\me\\me", str(clock*356,-3,0), ".tga")
    map_type 1
    interpolate 2
  }   }

#declare Pic = function {
 pigment {
  image_map {
  tga concat("e:\\me\\me", str(clock*356,-3,0), ".tga")
    map_type 1
    interpolate 2
  } } }

#declare Sphere = function { x^2+y^2+z^2 }

#declare FINAL = union {
  isosurface {
    function {
      (1 - Pic(x, y, z).grey) * 0.4 +  Sphere(x, y, z)   }
    max_gradient 8
    threshold 0.9
    contained_by { sphere { 0, 0.999 } }
    no_shadow

    pigment {IM}
    finish { ambient 0.8 specular .2 diffuse 0.7 }
      }

-- 

dhm### [at] comcastnet
http://www.dennismiller.neu.edu


Post a reply to this message

From: Warp
Subject: Re: help with my code
Date: 13 Feb 2006 16:15:43
Message: <43f0f6ff@news.povray.org>
Dennis Miller <dhm### [at] comcastnet> wrote:
> #declare Pic = function {
>  pigment {
>   image_map {
>   tga concat("e:\\me\\me", str(clock*356,-3,0), ".tga")
>     map_type 1
>     interpolate 2
>   } } }

  This creates a pigment function (which uses an image map).

>   isosurface {
>     function {
>       (1 - Pic(x, y, z).grey) * 0.4 +  Sphere(x, y, z)   }

  And this uses the grayscale values of that pigment function.

-- 
                                                          - Warp


Post a reply to this message

From: Dennis Miller
Subject: Re: help with my code
Date: 13 Feb 2006 19:08:51
Message: <43f11f93$1@news.povray.org>
Thanks Warp. Is there any way to dig a little deeper? How does the image map 
become the pigment function? Assuming there are RGB values for every pixel 
in my image, what exactly gets mapped to the pigment function? Is there any 
scaling of parameters values, or an offset? What would those values look 
like? I would like to get a better understanding of how this process works, 
as I am clear that the function comes from the bitmap. But I'm trying to get 
a better handle on how that happens...
And regarding the grayscale values, again, are those quantized to some range 
of values? What's the process here as well?
thanks much.
Dennis
"Warp" <war### [at] tagpovrayorg> wrote in message 
news:43f0f6ff@news.povray.org...
> Dennis Miller <dhm### [at] comcastnet> wrote:
>> #declare Pic = function {
>>  pigment {
>>   image_map {
>>   tga concat("e:\\me\\me", str(clock*356,-3,0), ".tga")
>>     map_type 1
>>     interpolate 2
>>   } } }
>
>  This creates a pigment function (which uses an image map).
>
>>   isosurface {
>>     function {
>>       (1 - Pic(x, y, z).grey) * 0.4 +  Sphere(x, y, z)   }
>
>  And this uses the grayscale values of that pigment function.
>
> -- 
>                                                          - Warp


Post a reply to this message

From: Trevor G Quayle
Subject: Re: help with my code
Date: 13 Feb 2006 22:04:56
Message: <43f148d8$1@news.povray.org>
"Dennis Miller" <dhm### [at] comcastnet> wrote in message 
news:43f11f93$1@news.povray.org...
> Thanks Warp. Is there any way to dig a little deeper? How does the image 
> map become the pigment function? Assuming there are RGB values for every 
> pixel in my image, what exactly gets mapped to the pigment function? Is 
> there any scaling of parameters values, or an offset? What would those 
> values look like? I would like to get a better understanding of how this 
> process works, as I am clear that the function comes from the bitmap. But 
> I'm trying to get a better handle on how that happens...
> And regarding the grayscale values, again, are those quantized to some 
> range of values? What's the process here as well?
> thanks much.
> Dennis

The image_map gets mapped from <0,0> to <1,1> in the x-y plane regardless of 
the image size and dimensions and is projected infinitely along the z axis. 
Without the 'once' keyword, the image is repeated inon the x-y plane at 
every unit square.  This gets converted to a function by assigning every 
x,y,z point a value equal to the colour of the image as mapped to the x,y,z 
space.   Next, an isosurface evaluates a given function.  The surface of the 
isosurface appears when the function is equal to the threshold limit 
(default is 0).  So when you use just the Sphere function, the surface shows 
up where the function equals 0, which (depending on how your Sphere function 
is defined...) gives you a spherical surface.  Now when you add the image 
function to the sphere function, the grey component (which will range from 0 
to 1 as evaluated from the standard conversion of rgb values to greyscale*: 
0.3R + 0.59G + 0.11B) of the image function as created by the image map for 
each point in the x,y,z space is added to the evaluation of the Sphere 
function at each each point.  The surface of the 2 functions added together 
appears where the value of this combined function is equal to 0.

Read "3.4.1.5.1  Specifying an Image Map" in the help for more info on image 
maps and try the isosurface tutorial "2.3.3.3  Isosurface Object" to 
understand better how isosurfaces are evaluated and how the functions 
defining themcan be manipulated.

-tgq


Post a reply to this message

From: Dennis Miller
Subject: Re: help with my code
Date: 13 Feb 2006 22:34:45
Message: <43f14fd5$1@news.povray.org>
Great Trevor. Thanks much. I'll have a look at the relevant docs.
Thanks again for the explanation.
Best.
Dennis

"Trevor G Quayle" <Tin### [at] hotmailcom> wrote in message 
news:43f148d8$1@news.povray.org...
>
> "Dennis Miller" <dhm### [at] comcastnet> wrote in message 
> news:43f11f93$1@news.povray.org...
>> Thanks Warp. Is there any way to dig a little deeper? How does the image 
>> map become the pigment function? Assuming there are RGB values for every 
>> pixel in my image, what exactly gets mapped to the pigment function? Is 
>> there any scaling of parameters values, or an offset? What would those 
>> values look like? I would like to get a better understanding of how this 
>> process works, as I am clear that the function comes from the bitmap. But 
>> I'm trying to get a better handle on how that happens...
>> And regarding the grayscale values, again, are those quantized to some 
>> range of values? What's the process here as well?
>> thanks much.
>> Dennis
>
> The image_map gets mapped from <0,0> to <1,1> in the x-y plane regardless 
> of the image size and dimensions and is projected infinitely along the z 
> axis. Without the 'once' keyword, the image is repeated inon the x-y plane 
> at every unit square.  This gets converted to a function by assigning 
> every x,y,z point a value equal to the colour of the image as mapped to 
> the x,y,z space.   Next, an isosurface evaluates a given function.  The 
> surface of the isosurface appears when the function is equal to the 
> threshold limit (default is 0).  So when you use just the Sphere function, 
> the surface shows up where the function equals 0, which (depending on how 
> your Sphere function is defined...) gives you a spherical surface.  Now 
> when you add the image function to the sphere function, the grey component 
> (which will range from 0 to 1 as evaluated from the standard conversion of 
> rgb values to greyscale*: 0.3R + 0.59G + 0.11B) of the image function as 
> created by the image map for each point in the x,y,z space is added to the 
> evaluation of the Sphere function at each each point.  The surface of the 
> 2 functions added together appears where the value of this combined 
> function is equal to 0.
>
> Read "3.4.1.5.1  Specifying an Image Map" in the help for more info on 
> image maps and try the isosurface tutorial "2.3.3.3  Isosurface Object" to 
> understand better how isosurfaces are evaluated and how the functions 
> defining themcan be manipulated.
>
> -tgq
>
>
>


Post a reply to this message

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