POV-Ray : Newsgroups : povray.general : POV and alpha channel Server Time
10 Aug 2024 15:18:21 EDT (-0400)
  POV and alpha channel (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Steve Martin
Subject: POV and alpha channel
Date: 9 Dec 1999 09:24:22
Message: <384FBB37.F263E00D@usit.net>
I'd like to do some compositing with images from POV-Ray using the
alpha channel in the TGA file. Unfortunately (and I can't believe
I'm the first to notice this, so I assume it's something I'm either
not understanding or doing wrong), it seems that the alpha channel
in the rendered image file is "reversed" from what it should be
(i.e. 0 instead of 255 and vice versa). I rendered a simple test
sphere, no specified background, one light, very simple. When I
call the image up, I find that there is a hole in the middle of the
image right where the sphere ought to be... but I can see the black
background with no problem.

I thought perhaps it was something about TGAs, so I converted the
file to a GIF. Same thing... a black background with a hole in the
image where the sphere should be, exactly backwards from what I
expected.

(BTW, I'm using ImageMagick and POV3.1g on a RH6 Linux system do
do all this.)

Can someone tell me what I'm doing wrong?


Post a reply to this message

From: Jeff Lee
Subject: Re: POV and alpha channel
Date: 9 Dec 1999 10:03:45
Message: <384fc4d1@news.povray.org>
Steve Martin <sma### [at] usitnet> wrote:
>
> I'd like to do some compositing with images from POV-Ray using the
> alpha channel in the TGA file. Unfortunately (and I can't believe
> I'm the first to notice this, so I assume it's something I'm either
> not understanding or doing wrong), it seems that the alpha channel
> in the rendered image file is "reversed" from what it should be
> (i.e. 0 instead of 255 and vice versa).

The alpha value should be 0 if the pixel is fully transparent, 255 if
fully opaque, and the values in between for partial transparency -- is
this what you're getting?

(In other words, it's the opposite of the transparency component in an
rgbt colour specification.)


-- 
Jeff Lee         shi### [at] gatenet         http://www.gate.net/~shipbrk/


Post a reply to this message

From: Josh English
Subject: Re: POV and alpha channel
Date: 9 Dec 1999 11:36:24
Message: <384FDA88.4564009F@spiritone.com>
I had the same issue. Reverse the alpha channel and it will work just
fine.

Steve Martin wrote:

> I'd like to do some compositing with images from POV-Ray using the
> alpha channel in the TGA file. Unfortunately (and I can't believe
> I'm the first to notice this, so I assume it's something I'm either
> not understanding or doing wrong), it seems that the alpha channel
> in the rendered image file is "reversed" from what it should be
> (i.e. 0 instead of 255 and vice versa). I rendered a simple test
> sphere, no specified background, one light, very simple. When I
> call the image up, I find that there is a hole in the middle of the
> image right where the sphere ought to be... but I can see the black
> background with no problem.
>
> I thought perhaps it was something about TGAs, so I converted the
> file to a GIF. Same thing... a black background with a hole in the
> image where the sphere should be, exactly backwards from what I
> expected.
>
> (BTW, I'm using ImageMagick and POV3.1g on a RH6 Linux system do
> do all this.)
>
> Can someone tell me what I'm doing wrong?

--

Josh English
eng### [at] spiritonecom
ICQ: 1946299
"Stress is when you wake up screaming and realize you haven't fallen
asleep yet."


Post a reply to this message

From: Peter Popov
Subject: Re: POV and alpha channel
Date: 9 Dec 1999 17:23:32
Message: <oCpQOGIVlzZBcLgmBwlFsSHRKap1@4ax.com>
On Thu, 09 Dec 1999 09:22:47 -0500, Steve Martin <sma### [at] usitnet>
wrote:

>Can someone tell me what I'm doing wrong?

Nothing. POV treats alpha channels in the exact opposite manner to
what paint programs do. A POV generated image with an alpha channel
will work perfectly in POV but to use it properly in a paint program
you'll have to invert the alpha channel.


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Steve Martin
Subject: Re: POV and alpha channel
Date: 9 Dec 1999 22:14:24
Message: <38506FB8.94BD7AD8@usit.net>
> Nothing. POV treats alpha channels in the exact opposite manner to
> what paint programs do. A POV generated image with an alpha channel
> will work perfectly in POV but to use it properly in a paint program
> you'll have to invert the alpha channel.

Okay. Thanks. I'm glad it wasn't me. Is inverting the alpha channel
something I can do in POV-Ray, or am I going to have to figure out
how to do that in ImageMagick?


Post a reply to this message

From: Peter Popov
Subject: Re: POV and alpha channel
Date: 10 Dec 1999 00:25:02
Message: <5IxQOGQxD+3xYzelszHJqrt9e89C@4ax.com>
On Thu, 09 Dec 1999 22:12:56 -0500, Steve Martin <sma### [at] usitnet>
wrote:

>> Nothing. POV treats alpha channels in the exact opposite manner to
>> what paint programs do. A POV generated image with an alpha channel
>> will work perfectly in POV but to use it properly in a paint program
>> you'll have to invert the alpha channel.
>
>Okay. Thanks. I'm glad it wasn't me. Is inverting the alpha channel
>something I can do in POV-Ray, or am I going to have to figure out
>how to do that in ImageMagick?

You can do it in POV but it will be a hack. Get all your scene in one
big union and give it a black pigment. Then render the scene. You'll
get... nothing :) Well, black is black, but at least the alpha channel
will be intact. Next thing to do is put this image on a plane of
ambient 1 and make it face an orthographic camera positioned so that
the transformed image_map fits perfectly. Put a white plane of ambient
1 behind this plane and render this scene in the resolution of the
original scene. This will make all "transparent" objects white.

If what you need is exactly the opposite (I don't remember by heart...
no, please people no, ok, I'll re-read jut leave me alooooone...
OUCH!), then the union I mentioned in the beginning should be of
pigment { White } and finish { ambient 1 } , and there should be no
need of the plane behind the image (because the default background is
black anyway).

Of course, if you're uing Linux, why not use the GIMP to do this? :)


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Steve Martin
Subject: Re: POV and alpha channel
Date: 10 Dec 1999 07:39:31
Message: <3850F42D.4F6004B8@usit.net>
> You can do it in POV but it will be a hack.

Yeah, that's pretty much a hack, all right. Guess I'll have to
get my lazy carcass in gear and learn Gimp. <grin>


Post a reply to this message

From: Chris Huff
Subject: Re: POV and alpha channel
Date: 10 Dec 1999 07:51:19
Message: <chrishuff_99-DF7B6E.07514310121999@news.povray.org>
In article <3850F42D.4F6004B8@usit.net>, sma### [at] usitnet wrote:

> Yeah, that's pretty much a hack, all right. Guess I'll have to
> get my lazy carcass in gear and learn Gimp. <grin>

Maybe an invert_alpha command would be useful. I rarely use image_maps, 
though, and have never used the alpha channel.
I will have to look at the source to see how hard it would be.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: PoD
Subject: Re: POV and alpha channel
Date: 10 Dec 1999 12:50:56
Message: <38513E1F.4679D761@merlin.net.au>
Josh English wrote:
> 
> I had the same issue. Reverse the alpha channel and it will work just
> fine.
> 
> Steve Martin wrote:
> 
> > I'd like to do some compositing with images from POV-Ray using the
> > alpha channel in the TGA file. Unfortunately (and I can't believe
> > I'm the first to notice this, so I assume it's something I'm either
> > not understanding or doing wrong), it seems that the alpha channel
> > in the rendered image file is "reversed" from what it should be
> > (i.e. 0 instead of 255 and vice versa). I rendered a simple test
> > sphere, no specified background, one light, very simple. When I
> > call the image up, I find that there is a hole in the middle of the
> > image right where the sphere ought to be... but I can see the black
> > background with no problem.
> >
> > I thought perhaps it was something about TGAs, so I converted the
> > file to a GIF. Same thing... a black background with a hole in the
> > image where the sphere should be, exactly backwards from what I
> > expected.
> >
> > (BTW, I'm using ImageMagick and POV3.1g on a RH6 Linux system do
> > do all this.)
> >
> > Can someone tell me what I'm doing wrong?
> 
> --
> 
> Josh English
> eng### [at] spiritonecom
> ICQ: 1946299
> "Stress is when you wake up screaming and realize you haven't fallen
> asleep yet."

I've used the alpha channel with PNG output and it worked fine.
The PNG file format allows for the alpha channel to represent
either transparency or opacity.

Cheers, PoD.


Post a reply to this message

From: Steve Martin
Subject: Re: POV and alpha channel
Date: 10 Dec 1999 19:57:25
Message: <3851A11F.93274C23@usit.net>
> > > not understanding or doing wrong), it seems that the alpha channel
> > > in the rendered image file is "reversed" from what it should be

> I've used the alpha channel with PNG output and it worked fine.
> The PNG file format allows for the alpha channel to represent
> either transparency or opacity.

Well, how 'bout that! I rendered out to a PNG file (no other
changes), and it worked like a charm. That solves my problem!


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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