POV-Ray : Newsgroups : povray.general : Problem with scattering media and .png alpha channel Server Time
4 Nov 2024 17:34:31 EST (-0500)
  Problem with scattering media and .png alpha channel (Message 1 to 8 of 8)  
From: MadKairon
Subject: Problem with scattering media and .png alpha channel
Date: 1 Jun 2010 21:25:01
Message: <web.4c05b266f96fcb534fb7f0280@news.povray.org>
I have the following sphere:

 sphere
 { 0,1 pigment { rgbt 1 } hollow
   interior
   { media
     { scattering { 3, <.3,.1,.1> }
       density
       { spherical density_map
         { [0 rgb 0]
           [.5 rgb .2]
           [1 rgb .5]
         }
       }
     }
  }
  scale 1.1
 }

if I use no background and render using +fn32 no media effect is visible.
Doesn't happen when I use a black background. Is there any way to solve this?


Post a reply to this message

From: clipka
Subject: Re: Problem with scattering media and .png alpha channel
Date: 1 Jun 2010 21:46:28
Message: <4c05b7f4$1@news.povray.org>
Am 02.06.2010 03:22, schrieb MadKairon:

> if I use no background and render using +fn32 no media effect is visible.
> Doesn't happen when I use a black background. Is there any way to solve this?

Be aware that the value behind "+fn" does not specify the bits per 
/pixel/, but rather the bit depth of each /color channel/; i.e. "+fn32" 
would correspond to 96 or 128 bits per pixel (depending on whether you 
choose alpha transparency or not).

I guess what you really want is "+fn8 +ua".


Post a reply to this message

From: MadKairon
Subject: Re: Problem with scattering media and .png alpha channel
Date: 1 Jun 2010 22:10:01
Message: <web.4c05bd0bf0ecff7f4fb7f0280@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 02.06.2010 03:22, schrieb MadKairon:
>
> > if I use no background and render using +fn32 no media effect is visible.
> > Doesn't happen when I use a black background. Is there any way to solve this?
>
> Be aware that the value behind "+fn" does not specify the bits per
> /pixel/, but rather the bit depth of each /color channel/; i.e. "+fn32"
> would correspond to 96 or 128 bits per pixel (depending on whether you
> choose alpha transparency or not).
>
> I guess what you really want is "+fn8 +ua".

Nope, here's a simple scene:

#include "colors.inc"
background{Black}

camera {
  angle 20
  location<0,2,-10>*1
  look_at<0,0,0>
}
light_source { <10, 20, -10> color White }

 sphere
 { 0,1 pigment { rgbt 1 } hollow
   interior
   { media
     { emission 1
       density
       { spherical density_map
         { [0 rgb 0]
           [0.4 rgb <1,0,0>]
           [0.8 rgb <1,1,0>]
           [1 rgb 1]
         }
       }
     }
  }
 }

try using +fn8 +ua, first render as I posted it and then coment the second line
and see what happens :(


Post a reply to this message

From: Warp
Subject: Re: Problem with scattering media and .png alpha channel
Date: 2 Jun 2010 00:47:38
Message: <4c05e26a@news.povray.org>
MadKairon <nomail@nomail> wrote:
> if I use no background and render using +fn32 no media effect is visible.
> Doesn't happen when I use a black background. Is there any way to solve this?

  Which version of POV-Ray are you using? Note that there are still some
issues with POV-Ray 3.7 beta regarding the +ua functionality.

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Problem with scattering media and .png alpha channel
Date: 2 Jun 2010 05:59:38
Message: <4c062b8a@news.povray.org>
Am 02.06.2010 04:08, schrieb MadKairon:

> try using +fn8 +ua, first render as I posted it and then coment the second line
> and see what happens :(

I see what you mean.

This is a general problem with transparency handling and emissive media 
(and also the scattering portion of scattering media):

The transparency model used in the PNG file format allows only 
/blending/ of image color and whatever background the image is to be 
displayed on. That is, if you have 100% of the background colour, you 
necessarily have 0% image colour, and vice versa.

Emissive media, however, just /adds/ light without taking from the 
background. That is, it would require 100% of the background colour and 
100% image colour.

Some image file formats (such as OpenEXR) theoretically don't have this 
limitation, as they are specified to use a different transparency model, 
but many applications seem to apply the wrong transparency model to 
these. As a matter of fact POV-Ray is still one of them.

As it happens, the next beta will include a change to make it behave 
properly regarding output of OpenEXR, and will also get input files of 
that type (and others using that transparency model) mostly right. 
(There are still bottlenecks with input files due to conversions between 
the transparency models, which cause trouble when transparency is 
/exactly/ 100%.)


Thus, when using PNG output file format and/or the current beta, the 
only option you have is to introduce a good deal of absorption to make 
the emissive media show at all.

With future betas, you may want to try OpenEXR output instead, if that 
is an option for you. (You'll still have to add a /bit/ of absorption 
though if you should happen to plan on using it as a texture in POV-Ray.)


Post a reply to this message

From: MadKairon
Subject: Re: Problem with scattering media and .png alpha channel
Date: 2 Jun 2010 06:30:01
Message: <web.4c063281f0ecff7f4fb7f0280@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 02.06.2010 04:08, schrieb MadKairon:
>
> > try using +fn8 +ua, first render as I posted it and then coment the second line
> > and see what happens :(
>
> I see what you mean.
>
> This is a general problem with transparency handling and emissive media
> (and also the scattering portion of scattering media):
>
> The transparency model used in the PNG file format allows only
> /blending/ of image color and whatever background the image is to be
> displayed on. That is, if you have 100% of the background colour, you
> necessarily have 0% image colour, and vice versa.
>
> Emissive media, however, just /adds/ light without taking from the
> background. That is, it would require 100% of the background colour and
> 100% image colour.
>
> Some image file formats (such as OpenEXR) theoretically don't have this
> limitation, as they are specified to use a different transparency model,
> but many applications seem to apply the wrong transparency model to
> these. As a matter of fact POV-Ray is still one of them.
>
> As it happens, the next beta will include a change to make it behave
> properly regarding output of OpenEXR, and will also get input files of
> that type (and others using that transparency model) mostly right.
> (There are still bottlenecks with input files due to conversions between
> the transparency models, which cause trouble when transparency is
> /exactly/ 100%.)
>
>
> Thus, when using PNG output file format and/or the current beta, the
> only option you have is to introduce a good deal of absorption to make
> the emissive media show at all.
>
> With future betas, you may want to try OpenEXR output instead, if that
> is an option for you. (You'll still have to add a /bit/ of absorption
> though if you should happen to plan on using it as a texture in POV-Ray.)

Ah :( thanks. Using 3.7 beta 37. Guess I need some other way of simulating
athmosphere for planets I want to use on GIMP later. Any good ideas?


Post a reply to this message

From: clipka
Subject: Re: Problem with scattering media and .png alpha channel
Date: 2 Jun 2010 07:20:52
Message: <4c063e94$1@news.povray.org>
Am 02.06.2010 12:29, schrieb MadKairon:

> Ah :( thanks. Using 3.7 beta 37. Guess I need some other way of simulating
> athmosphere for planets I want to use on GIMP later. Any good ideas?

Render the scene two times: Once with +UA, once with -UA (and a black 
background).

Take the +UA render, and - preserving transparency - paint it 
pitch-black. Use this as a layer in front of your intended background 
image, with standard blending mode. This will suppress the background 
image where the opaque parts of the planet will go.

Take the -UA render, and put it in front of the other layers, using 
whichever GIMP layer blending mode will cause it to be /added/ to the 
layers below.

This should work even with scattering media (which has both 
emission-like and absorption-like components).


Post a reply to this message

From: MadKairon
Subject: Re: Problem with scattering media and .png alpha channel
Date: 2 Jun 2010 12:10:01
Message: <web.4c068228f0ecff7f4fb7f0280@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 02.06.2010 12:29, schrieb MadKairon:
>
> > Ah :( thanks. Using 3.7 beta 37. Guess I need some other way of simulating
> > athmosphere for planets I want to use on GIMP later. Any good ideas?
>
> Render the scene two times: Once with +UA, once with -UA (and a black
> background).
>
> Take the +UA render, and - preserving transparency - paint it
> pitch-black. Use this as a layer in front of your intended background
> image, with standard blending mode. This will suppress the background
> image where the opaque parts of the planet will go.
>
> Take the -UA render, and put it in front of the other layers, using
> whichever GIMP layer blending mode will cause it to be /added/ to the
> layers below.
>
> This should work even with scattering media (which has both
> emission-like and absorption-like components).

Thanks for the tip, will try it.


Post a reply to this message

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