POV-Ray : Newsgroups : povray.binaries.images : using an image_map for media density/color Server Time
7 Aug 2024 13:21:37 EDT (-0400)
  using an image_map for media density/color (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Thomas de Groot
Subject: Re: using an image_map for media density/color
Date: 10 Apr 2006 09:12:52
Message: <443a59d4@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> schreef in bericht
news:web.443a29a1dc50c7b32ff47f1a0@news.povray.org...
>
> No problem; sorry if I didn't make that clear.  Image #3 is just the dino
> *shape* in white, surrounded by black; no greys or colors. (It looks the
> same as the original image's alpha channel, but it's actually a separate
> image.) It's used to create the solid black "plug" of absorbing media, in
> the shape of the dino. Then image #4 is used for all three emitting
medias;
> this image contains the actual colors of the dino, to create three
> primary-colored medias which are simply added to (or combined with) the
> black plug.
>
Right! Now, illumination has finally seeped through my thick braincase :-)
Thanks Kenneth! My results were indeed paler than yours (using the same
skeleton :-)  )

Thomas


Post a reply to this message

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 11 Apr 2006 03:25:01
Message: <web.443b58abdc50c7b3acc8f35f0@news.povray.org>
"Bob H" <omniverse@charter%net> wrote:
> I've been sitting here looking this over a while now, trying to figure what
> it does, and finally rendered something to check it out here.
>
> ...I also multiplied a color_map gradient
> z to get the fading out effect, as was suggested.
>

Congrats on accomplishing that so quickly; you beat me to it!  Not being
very wise in the way of math functions, I had to slog through a fair amount
of trial-and-error, discarding one attempt after another, before coming up
with a fade-out technique that worked well and looked good. Since the
medias are so dense, I needed a way to fade them out exponentially. Here's
my final result:

Create another pigment function:
#declare my_function_3 =
function{
 pigment{
  gradient z
  color_map{
   [0.0 rgb 1]
   [1.0 rgb 0]
          }
     }
     }

Then use this in each of the four medias the same way, multiplying the
original function in each media by this one.  Like this...

for the absorbing media...

density{
 function{
  my_image_function_1(x,y,z).gray
  * my_function_3(x,y,pow(z,.07)).gray
                     }
           }

and for each emitting media...

density{
 function{
  my_image_function_2(x,y,z).red // and green, and blue
  * my_function_3(x,y,pow(z,.07)).gray
                      }
            }


Play around with pow(z,.07) to see the varying fade-out effect.

BTW, I got rid of the "extra" dino image on the rear of the box by using

interior_texture{pigment{color rgbt 1}}

Not ideal, but it does the job. Interior textures can behave strangely,
depending on where the camera AND the lights are positioned. If the camera
is moved around behind the box, then suddenly the box's REAR dino image is
visible and the front one isn't. And it creates a bit of havoc with light
sources, too. With the camera in the front (the -z direction) and a light
positioned behind the box, the "invisible" rear-face image casts no shadow.
 But if the light is also moved in front of that rear face, suddenly it DOES
cast a shadow...even though the rear image itself is not visible from the
front. The interior_texture doesn't actually ELIMINATE that rear-face image
(which is still on the "outside" surface of the box); it just "hides" it
from the camera and lights--depending on where THEY are.

Ken


Post a reply to this message


Attachments:
Download 'dino_fadeout.jpg' (51 KB)

Preview of image 'dino_fadeout.jpg'
dino_fadeout.jpg


 

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 11 Apr 2006 03:55:00
Message: <web.443b600adc50c7b3acc8f35f0@news.povray.org>
"Chambers" <bdc### [at] yahoocom> wrote:

> Hasn't similar work been done using media voxels?  In any case, this looks
> amazing :)
>

Thanks!  I didn't know much about voxels at all, but your post  got me
interested, so I looked up the subject.  Fascinating! So THAT's how those
cool super-computer tornado simulations are accomplished...the swirling,
volumetric animations of air masses and densities. (Seems that isosurfaces
are involved as well.) So with POV, we already have the tools to do some
weather simulations!!

Ken


Post a reply to this message

From: Bob H
Subject: Re: using an image_map for media density/color
Date: 12 Apr 2006 10:04:02
Message: <443d08d2$1@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote in message 
news:web.443b58abdc50c7b3acc8f35f0@news.povray.org...
> medias are so dense, I needed a way to fade them out exponentially.
>
> density{
> function{
>  my_image_function_2(x,y,z).red // and green, and blue
>  * my_function_3(x,y,pow(z,.07)).gray
>                      }
>            }

Good idea, you are right about the linear gradient fadeout being too solid.

> BTW, I got rid of the "extra" dino image on the rear of the box by using
>
> interior_texture{pigment{color rgbt 1}}
>
> Not ideal, but it does the job. Interior textures can behave strangely
---8<---

Very good point made there, glad you described the limitations. I tried the 
following instead and it looks okay.

        pigment {
         gradient z
         pigment_map {
    [0.5 image_map {png "mediatest.png" map_type 0 interpolate 2 once}]
    [0.5 rgbt 1]
         }
         scale 1.01 translate -0.001*z
        }


Post a reply to this message

From: Alain
Subject: Re: using an image_map for media density/color
Date: 12 Apr 2006 20:58:57
Message: <443da251@news.povray.org>
Kenneth nous apporta ses lumieres en ce 11/04/2006 03:20:
> "Bob H" <omniverse@charter%net> wrote:
> 
>>I've been sitting here looking this over a while now, trying to figure what
>>it does, and finally rendered something to check it out here.
>>
>>...I also multiplied a color_map gradient
>>z to get the fading out effect, as was suggested.
>>
> 
> 
> Congrats on accomplishing that so quickly; you beat me to it!  Not being
> very wise in the way of math functions, I had to slog through a fair amount
> of trial-and-error, discarding one attempt after another, before coming up
> with a fade-out technique that worked well and looked good. Since the
> medias are so dense, I needed a way to fade them out exponentially. Here's
> my final result:
> 
> Create another pigment function:
> #declare my_function_3 =
> function{
>  pigment{
>   gradient z
>   color_map{
>    [0.0 rgb 1]
>    [1.0 rgb 0]
>           }
>      }
>      }
> 
> Then use this in each of the four medias the same way, multiplying the
> original function in each media by this one.  Like this...
> 
> for the absorbing media...
> 
> density{
>  function{
>   my_image_function_1(x,y,z).gray
>   * my_function_3(x,y,pow(z,.07)).gray
>                      }
>            }
> 
> and for each emitting media...
> 
> density{
>  function{
>   my_image_function_2(x,y,z).red // and green, and blue
>   * my_function_3(x,y,pow(z,.07)).gray
>                       }
>             }
> 
> 
> Play around with pow(z,.07) to see the varying fade-out effect.
> 
> BTW, I got rid of the "extra" dino image on the rear of the box by using
> 
> interior_texture{pigment{color rgbt 1}}
> 
> Not ideal, but it does the job. Interior textures can behave strangely,
> depending on where the camera AND the lights are positioned. If the camera
> is moved around behind the box, then suddenly the box's REAR dino image is
> visible and the front one isn't. And it creates a bit of havoc with light
> sources, too. With the camera in the front (the -z direction) and a light
> positioned behind the box, the "invisible" rear-face image casts no shadow.
>  But if the light is also moved in front of that rear face, suddenly it DOES
> cast a shadow...even though the rear image itself is not visible from the
> front. The interior_texture doesn't actually ELIMINATE that rear-face image
> (which is still on the "outside" surface of the box); it just "hides" it
> from the camera and lights--depending on where THEY are.
> 
> Ken
> 
> 
> 
> ------------------------------------------------------------------------
> 
Have you tried cuting a slice off the box with another with an rgbt 1 pigment?
Enlarge the actual box toward the back, make a second shalow box a bit taler and
whider, and 
difference it from the first.
This way, it will make the back of the box it's texture: pigment{rgbt 1}

-- 
Alain
-------------------------------------------------
Gravity is a Myth.  The Earth Sucks!


Post a reply to this message

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 14 Apr 2006 03:05:00
Message: <web.443f48c6dc50c7b37e0dcd410@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
----------------------------------
> >
> Have you tried cuting a slice off the box with another with an rgbt 1 pigment?
> Enlarge the actual box toward the back, make a second shalow box a bit taler and
whider, and
> difference it from the first.
> This way, it will make the back of the box it's texture: pigment{rgbt 1}
>

Great idea!  I didn't think of that. Thanks. (Sometimes I get so wrapped up
with the problem at hand that a more obvious solution doesn't occur to me.)

I also tried using a slope pattern, which has its own idiosyncracies. You're
suggestion is much more straightforward.

Ken


Post a reply to this message

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 14 Apr 2006 03:10:00
Message: <web.443f4a85dc50c7b37e0dcd410@news.povray.org>
"Bob H" <omniverse@charter%net> wrote:

>
> ... I tried the
> following instead and it looks okay.
>
>         pigment {
>          gradient z
>          pigment_map {
>     [0.5 image_map {png "mediatest.png" map_type 0 interpolate 2 once}]
>     [0.5 rgbt 1]
>          }
>          scale 1.01 translate -0.001*z
>         }

A pigment_map is something I didn't think of. Very clever. I'll have to try
this!

Ken


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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