POV-Ray : Newsgroups : povray.advanced-users : Media Density Question Server Time
31 Oct 2024 06:00:56 EDT (-0400)
  Media Density Question (Message 1 to 4 of 4)  
From: Woody
Subject: Media Density Question
Date: 17 Jan 2008 06:50:01
Message: <web.478f3fba1e3bd89b94e61a50@news.povray.org>
Is there anyway to change how a gradient density fades off?

The following scene has a density that's a linear gradient. That is it falls off
in a linear fashion. Is there any way to change this so the density falls off
say at a geometric or exponential rate? Maybe instead of a linear decreasing
density, something where the density is sinosoidal?

Maybe a density map of some type?

Any help appreciated.


#declare cam_pos=(x*4+y*3+z*-2)*2;
camera {
  location cam_pos
  look_at (x*1+y*0+z*0)*0.5
}

light_source {
  cam_pos
  color White // add *2 if this light is not bright enough
}

cylinder { 0, <1,0,0>, 1
         pigment {rgbt 1}
         hollow
         finish{ ambient 0.000 diffuse 0.000 specular 0}
         interior{
                 media{
                         emission y/2

                         density {gradient -x scale 1.01}
                }
         }
         scale x*3
}


Post a reply to this message

From: Mike Williams
Subject: Re: Media Density Question
Date: 17 Jan 2008 08:22:59
Message: <I2x5fEDNa1jHFwtX@econym.demon.co.uk>
Wasn't it Woody who wrote:
>Is there anyway to change how a gradient density fades off?
>
>The following scene has a density that's a linear gradient. That is it 
>falls off
>in a linear fashion. Is there any way to change this so the density falls off
>say at a geometric or exponential rate? Maybe instead of a linear decreasing
>density, something where the density is sinosoidal?

You can use a function as the density pattern, like this:

http://www.econym.demon.co.uk/isotut/patterns.htm#density

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Jan Dvorak
Subject: Re: Media Density Question
Date: 17 Jan 2008 10:48:47
Message: <478f78df$1@news.povray.org>
Mike Williams napsal(a):
> Wasn't it Woody who wrote:
>> Is there anyway to change how a gradient density fades off?
>>
>> The following scene has a density that's a linear gradient. That is it 
>> falls off
>> in a linear fashion. Is there any way to change this so the density 
>> falls off
>> say at a geometric or exponential rate? Maybe instead of a linear 
>> decreasing
>> density, something where the density is sinosoidal?
> 
> You can use a function as the density pattern, like this:
> 
> http://www.econym.demon.co.uk/isotut/patterns.htm#density
> 
or you can add a grayscale color map (I assume you want a colourless 
gas) or a waveform.


Post a reply to this message

From: Alain
Subject: Re: Media Density Question
Date: 17 Jan 2008 11:31:32
Message: <478f82e4$1@news.povray.org>
Woody nous apporta ses lumieres en ce 2008/01/17 06:44:
> Is there anyway to change how a gradient density fades off?
> 
> The following scene has a density that's a linear gradient. That is it falls off
> in a linear fashion. Is there any way to change this so the density falls off
> say at a geometric or exponential rate? Maybe instead of a linear decreasing
> density, something where the density is sinosoidal?
> 
> Maybe a density map of some type?
> 
> Any help appreciated.
> 
> 
> #declare cam_pos=(x*4+y*3+z*-2)*2;
> camera {
>   location cam_pos
>   look_at (x*1+y*0+z*0)*0.5
> }
> 
> light_source {
>   cam_pos
>   color White // add *2 if this light is not bright enough
> }
> 
> cylinder { 0, <1,0,0>, 1
>          pigment {rgbt 1}
>          hollow
>          finish{ ambient 0.000 diffuse 0.000 specular 0}
>          interior{
>                  media{
>                          emission y/2
> 
>                          density {gradient -x scale 1.01}
>                 }
>          }
>          scale x*3
> }
> 
> 
> 
In addition to what others have proposed, you can experiment with the various 
wave forms available. They are:
ramp_wave //the default for the gradient pattern
triangle_wave // used in the marble and wood patterns
sine_wave
scallop_wave // use the absolute value of a sine
cubic_wave
poly_wave [float]

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when your wife's raytraced image you 
made to flatter her is the only one you see of her anymore.
Ken Tyler


Post a reply to this message

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