POV-Ray : Newsgroups : povray.advanced-users : Controlling density Server Time
23 Nov 2024 18:28:24 EST (-0500)
  Controlling density (Message 1 to 6 of 6)  
From: posfan12
Subject: Controlling density
Date: 13 Oct 2013 03:50:00
Message: <web.525a4fa8a9f12adfb9c369c00@news.povray.org>
How do you control the density of a medium at a given point?

For instance, if you use a spherical pattern then the medium is fully opaque at
the center of the sphere, and is fully transparent at the outer radius.

BUT, what if I want the sphere to be 25% transparent at 1/3 of the distance from
the center?

How do I control that?

Thanks!


Mike


Post a reply to this message

From: MichaelJF
Subject: Re: Controlling density
Date: 13 Oct 2013 04:35:01
Message: <web.525a5aece6c9a291d9b93f5b0@news.povray.org>
"posfan12" <nomail@nomail> wrote:
> How do you control the density of a medium at a given point?
>
> For instance, if you use a spherical pattern then the medium is fully opaque at
> the center of the sphere, and is fully transparent at the outer radius.
>
> BUT, what if I want the sphere to be 25% transparent at 1/3 of the distance from
> the center?
>
> How do I control that?
>
> Thanks!
>
>
> Mike

Hi Mike,

you can use color_maps or density_maps within the media. Something like this:

 media{
    emission 0.75
    scattering {1, 0.5}
    density { spherical
      density_map {
        [0.0 rgb 0]
        [2/3 rgb 1]
        [1.0 rgb 1]
      }
    }
  }

Best regards,
Michael


Post a reply to this message

From: posfan12
Subject: Re: Controlling density
Date: 13 Oct 2013 06:30:01
Message: <web.525a7615e6c9a291b9c369c00@news.povray.org>
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> Hi Mike,
>
> you can use color_maps or density_maps within the media. Something like this:
>
>  media{
>     emission 0.75
>     scattering {1, 0.5}
>     density { spherical
>       density_map {
>         [0.0 rgb 0]
>         [2/3 rgb 1]
>         [1.0 rgb 1]
>       }
>     }
>   }
>
> Best regards,
> Michael

Are you sure? I thought color maps are just for changing the color of the media
at different densities, and density maps are for using multiple pre-defined
densities.


Mike


Post a reply to this message

From: posfan12
Subject: Re: Controlling density
Date: 13 Oct 2013 07:05:00
Message: <web.525a7de3e6c9a291b9c369c00@news.povray.org>
Wouldn't it be better to define a new function instead of messing with the
color/density maps?

Something like this maybe (I'm still working on the ringworld project):

density
{
 function {1-f_cylindrical(x,y,z)}
}

But how would I rewrite the function for my scene if:

1. the radius of the habitat ring is equal to "ring_radius" and the height of
the atmosphere is equal to "atmosphere_height"
2. the atmosphere should have 0 density at the top and some arbitrary low value
like 10% at the ring surface.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Controlling density
Date: 13 Oct 2013 07:12:24
Message: <525a8018$1@news.povray.org>
On 13-10-2013 12:29, posfan12 wrote:
> "MichaelJF" <mi-### [at] t-onlinede> wrote:
>> Hi Mike,
>>
>> you can use color_maps or density_maps within the media. Something like this:
>>
>>   media{
>>      emission 0.75
>>      scattering {1, 0.5}
>>      density { spherical
>>        density_map {
>>          [0.0 rgb 0]
>>          [2/3 rgb 1]
>>          [1.0 rgb 1]
>>        }
>>      }
>>    }
>>
>> Best regards,
>> Michael
>
> Are you sure? I thought color maps are just for changing the color of the media
> at different densities, and density maps are for using multiple pre-defined
> densities.

You can use a density map to control how dense the media will be, like 
Michael shows. A density map interprets the grey values. rgb 0 is 
transparent; rgb 1 is opaque. If you use colours, they are interpreted 
as grey values.

Thomas


Post a reply to this message

From: MichaelJF
Subject: Re: Controlling density
Date: 13 Oct 2013 07:40:00
Message: <web.525a85d0e6c9a291d9b93f5b0@news.povray.org>
Better to  have a complete example:

global_settings { assumed_gamma 1 }
 background { rgb 1 }
 camera { location <3,4,-5>*.8 look_at 0 angle 35 }
 light_source { <20,40,10>, 1 }

 box // floor
 { <-1.5,-1.01,-1.5>, <1.5,-1.2,1.5>
   pigment { checker rgb 0.75, rgb 0.25 scale 0.2 }
 }

 box
 { -1,1 pigment { rgbt 1 } hollow
   interior
   { media
     { scattering { 1, 0.5 }

       density {
          gradient y
          color_map {
             [ 0 rgb 1 ]
             [ 1/3 rgb 1 ]
             [ 2/3 rgb 0 ]
             [1 rgb 0 ]
          }

          scale 2
          translate -y
       }

     }
   }
 }
 cylinder
 { <0.9, -1, 0.7>, <0.9, 0.9, 0.7>, 0.5
   pigment { rgb <1, 0.8, 0.5> }
 }


This is a modification of the demo-scene from the POV-documentation. I added
only the density (scaled and translated to meet the scene). As you can see,
there is no density at the top third, increasing to 1 at the bottom third.

Best regards,
Michael


Post a reply to this message

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