POV-Ray : Newsgroups : povray.binaries.images : using an image_map for media density/color Server Time
15 Nov 2024 19:19:59 EST (-0500)
  using an image_map for media density/color (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: Kenneth
Subject: using an image_map for media density/color
Date: 7 Apr 2006 18:30:00
Message: <web.4436e54a72fe66658ad7a9060@news.povray.org>
I thought I'd try an experiment to see if an image_map with an alpha channel
could be used for determining the density and color of a media-filled
object...specifically to try and make the resulting object *look* solid,
without using a heightfield to do so. Just to see if it was possible.  (I
may be "re-inventing the wheel" here, rehashing old news. Sorry if that's
the case.) My original question about this is at....

http://news.povray.org/povray.general/thread/%3Cweb.4428c5d859cea9017bf568ef0%40news.povray.org%3E/

First, let me thank Bruno Cabasson and Mike Williams for some VERY helpful
code they posted there, which put me on the right track.

For subject matter, I chose a photo I took of a dino skeleton at the Museum
of Natural History in New York. The image's alpha channel was made in
Photoshop.

Image #2 shows what normally happens when an alpha-channel image_map is
applied to a box: the front and back faces are visible, but the intervening
space is empty. I wanted to "solidify" the intervening space. (I added the
box shape just for clarity.)

I first tried using the image_map as a single function, applied to three
different primary-color emission medias. The results were somewhat
promising, but had one major drawback: The function seems to ignore the
image_map's alpha channel (or, if it does recognize it, I couldn't find a
way to access that information, though I tried mightily!) So, the
supposedly-transparent areas were filled with media as well.

But a simple work-around solved that roadblock: using THREE versions of the
image_map.  Two (with the alpha channel removed) are used as functions--one
for absorbing media (image #3), and one for emitting media (image #4--with
its alpha channel areas replaced with black.) The original image_map (with
alpha channel) is projected onto the box as usual; it helps give more
"solidity" to the front--and replaces the need for pigment{rgbt 1} as the
box's texture. (I found that quite interesting!)

Having tried all three media types with various versions of the image_map,
the best visual result seems to come from using both absorbing and emitting
media, overlapped.  The "plug" of absorbing media is definitely needed; it's
primarily responsible for making the media look solid. Using scattering
media (by replacing the three emission medias) worked reasonably well...not
great...and took *forever* to render. So right now, there's no light
interaction with the object, other than its full shadow on the ground.

The subtle moire patterns visible in the media are a mystery, but can be
minimized by using higher and higher samples values. I thought they might
be a result of "coincident media" (if there is such a thing); but shifting
each media around slightly in space didn't affect it.  Could come from any
of a number of causes. AA values in the media, perhaps?

As it is, this technique is not much more than an intriguing experiment
(though I'm just beginning to explore its possibilities.) Adding
warp{turbulence, etc.} to each media creates some wild and interesting
results, for example.  And there's probably a way to fade out all the media
as it progresses in the +z direction...like an image-based vapor trail. If
that's possible, then the technique could also be used to create what looks
like a motion-blurred object.

Ken W.

-----------------
The code...

#declare my_image_function_1 = function{pigment{image_map {png
"dino_skeleton_ABSORPTION.png" map_type 0 interpolate 2}}};

#declare my_image_function_2 = function{pigment{image_map {png
"dino_skeleton_EMISSION.png" map_type 0 interpolate 2}}};

#declare MM = 75; // overall media multiplier...very dense

#declare EM = .75; // extra media multiplier for emission media (yes, .75)

#declare media_samples = 160; // if this is changed, then EM above will
probably need tweaking.


box{<0,0,0>,<1,1,1> hollow
        texture{
      // the original image with its alpha channel...
        pigment {image_map {png "dino_skeleton.png" map_type 0 interpolate 2
once}}

                finish{
                        ambient 1
                        diffuse 0
                      }
               }

        interior{

                // absorbing media--one only
                media{
                        absorption 1*MM // absorbs all colors equally
                        samples media_samples
                        density{ function{my_image_function_1(x,y,z).gray}
                               }
                     }


                // emitting medias--THREE
                media{
                        emission <1,0,0> *MM*EM  // red
                        samples media_samples
                        density{ function{my_image_function_2(x,y,z).red}
                               }
                     }


                media{

                        emission <0,1,0>*MM*EM // green
                        samples media_samples
                        density{ function{my_image_function_2(x,y,z).green}
                               }
                     }

                media{

                        emission <0,0,1>*MM*EM // blue
                        samples media_samples
                        density{ function{my_image_function_2(x,y,z).blue}
                               }
                     }
                } // end of interior

                scale <1.22,1,1> // or whatever

} // end of box


Post a reply to this message


Attachments:
Download 'dino_solid_media.jpg' (301 KB)

Preview of image 'dino_solid_media.jpg'
dino_solid_media.jpg


 

From: Thomas de Groot
Subject: Re: using an image_map for media density/color
Date: 8 Apr 2006 03:37:26
Message: <44376836@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> schreef in bericht
news:web.4436e54a72fe66658ad7a9060@news.povray.org...
>
> For subject matter, I chose a photo I took of a dino skeleton at the
Museum
> of Natural History in New York. The image's alpha channel was made in
> Photoshop.
>
Just for clarity :-) : Not a dino, but a bird! (which is a dino technically
speaking, of course). But this giant critter lived after the times of the
dinos, so that's why...

But more importantly, I am impressed by your experiment. It opens all kinds
of possibilities imo, and some weird experiments with warps and turbulence,
like you have mentioned. I am going to try out your code!
Thanks for sharing this!

Thomas


Post a reply to this message

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 8 Apr 2006 12:45:01
Message: <web.4437e796dc50c7b37260380@news.povray.org>
"Thomas de Groot" <t.d### [at] internlnet> wrote:
> "Kenneth" <kdw### [at] earthlinknet> schreef in bericht
> news:web.4436e54a72fe66658ad7a9060@news.povray.org...
> >
> > For subject matter, I chose a photo I took of a dino skeleton at the
> Museum
> > of Natural History in New York. The image's alpha channel was made in
> > Photoshop.
> >
> Just for clarity :-) : Not a dino, but a bird! (which is a dino technically
> speaking, of course). But this giant critter lived after the times of the
> dinos, so that's why...

Very interesting! (Being a fan of all things dinosaurian, I should have
known that. :-[   )

BTW, I hope my image came through OK; there may have been a problem with my
'net connection during the upload. (On my own computer, I'm not seeing the
thumbnail image.)

Ken


Post a reply to this message

From: Jellby
Subject: Re: using an image_map for media density/color
Date: 8 Apr 2006 13:40:18
Message: <bn7lg3-9s3.ln1@badulaque.unex.es>
Among other things, Thomas de Groot saw fit to write:

>> For subject matter, I chose a photo I took of a dino skeleton at the
> Museum
>> of Natural History in New York. The image's alpha channel was made in
>> Photoshop.
>>
> Just for clarity :-) : Not a dino, but a bird! (which is a dino
> technically speaking, of course). But this giant critter lived after the
> times of the dinos, so that's why...

Wow! Just a couple of hours ago I watched the first episode of David
Attenborough's "Life of Birds", where this creature (or a very similar one)
makes a stellar appearance. An now I see this picture.

-- 
light_source{9+9*x,1}camera{orthographic look_at(1-y)/4angle 30location
9/4-z*4}light_source{-9*z,1}union{box{.9-z.1+x clipped_by{plane{2+y-4*x
0}}}box{z-y-.1.1+z}box{-.1.1+x}box{.1z-.1}pigment{rgb<.8.2,1>}}//Jellby


Post a reply to this message

From: Chambers
Subject: Re: using an image_map for media density/color
Date: 8 Apr 2006 14:35:48
Message: <44380284$1@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote in message 
news:web.4436e54a72fe66658ad7a9060@news.povray.org...
>I thought I'd try an experiment to see if an image_map with an alpha 
>channel
> could be used for determining the density and color of a media-filled
> object...specifically to try and make the resulting object *look* solid,
> without using a heightfield to do so. Just to see if it was possible.  (I
> may be "re-inventing the wheel" here, rehashing old news. Sorry if that's
> the case.) My original question about this is at....

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

...Chambers


Post a reply to this message

From: Bob H
Subject: Re: using an image_map for media density/color
Date: 8 Apr 2006 21:08:04
Message: <44385e74$1@news.povray.org>
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 put jitter 0.5 confidence 0.9999 variance 0 into the media statements and 
used samples 200. It looks smooth to me, no AA done for the render itself, 
aside from my sloppy test image map. I also multiplied a color_map gradient 
z to get the fading out effect, as was suggested.

Does seem likely that more could be done to manipulate this and vary the way 
the media appears. At first, I couldn't help thinking how a HF could already 
be used to do what was shown until I got the idea behind it.
-- 
Bob H  www.3digitaleyes.com
http://3digitaleyes.com/imagery/


Post a reply to this message


Attachments:
Download 'semisolidimagemedia.jpg' (12 KB)

Preview of image 'semisolidimagemedia.jpg'
semisolidimagemedia.jpg


 

From: Thomas de Groot
Subject: Re: using an image_map for media density/color
Date: 9 Apr 2006 02:58:46
Message: <4438b0a6@news.povray.org>
Kenneth,
I tested your code and found out that you only need two images. The
absorption and emission images being the same, you can use one for both the
absorption and emission media.
Just thought to mention this.

Thomas


Post a reply to this message

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 10 Apr 2006 03:20:01
Message: <web.443a06e9dc50c7b3f466d5bb0@news.povray.org>
"Thomas de Groot" <t.d### [at] internlnet> wrote:
> Kenneth,
> I tested your code and found out that you only need two images. The
> absorption and emission images being the same, you can use one for both the
> absorption and emission media.
> Just thought to mention this.
>
> Thomas

Hmm.  When I try that, the results don't look very good; the colors are kind
of "grayed-out."  I assume you mean using image #4 for both types of media?

The absorption-media image (#3) is different from the emitting-media image
(#4).  Or perhaps I'm misunderstanding your suggestion?

Ken


Post a reply to this message

From: Thomas de Groot
Subject: Re: using an image_map for media density/color
Date: 10 Apr 2006 03:54:10
Message: <443a0f22@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> schreef in bericht
news:web.443a06e9dc50c7b3f466d5bb0@news.povray.org...
> "Thomas de Groot" <t.d### [at] internlnet> wrote:
> > Kenneth,
> > I tested your code and found out that you only need two images. The
> > absorption and emission images being the same, you can use one for both
the
> > absorption and emission media.
> > Just thought to mention this.
> >
> > Thomas
>
> Hmm.  When I try that, the results don't look very good; the colors are
kind
> of "grayed-out."  I assume you mean using image #4 for both types of
media?
>
> The absorption-media image (#3) is different from the emitting-media image
> (#4).  Or perhaps I'm misunderstanding your suggestion?
>

I think I am missing something. What is different between image #3 and #4?
Both have no-alpha channel, and a black background? Or is there something
else? I admit that I did not entirely understand your explanation there...

Thomas


Post a reply to this message

From: Kenneth
Subject: Re: using an image_map for media density/color
Date: 10 Apr 2006 05:50:00
Message: <web.443a29a1dc50c7b32ff47f1a0@news.povray.org>
"Thomas de Groot" <t.d### [at] internlnet> wrote:

>
> I think I am missing something. What is different between image #3 and #4?
> Both have no-alpha channel, and a black background? Or is there something
> else? I admit that I did not entirely understand your explanation there...
>
> Thomas

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.

Ken


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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