POV-Ray : Newsgroups : povray.general : How to make object be transparent with alpha channel in the final image? Server Time
25 Dec 2024 13:41:35 EST (-0500)
  How to make object be transparent with alpha channel in the final image? (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: Hor
Subject: How to make object be transparent with alpha channel in the final image?
Date: 10 Sep 2007 07:15:01
Message: <web.46e525f2cb83bb4e372f63560@news.povray.org>
Hello,

I have two solid objects overlapped with one another - both have visible and
invisible parts. I need to make the area which filled with visible part of
one object make transparent in the final image (using alpha channel, with
transparent background as well). Another object parts must not be visible
anywhere in this area.

What is the best way to get this effect? I found no solutions yet :(

P.S. Actually I need to do this with more than 2 objects (render separate
images and overlay them later), but I think that I will be able to
generalize the technique.

Thank you very much!!


Post a reply to this message

From: Alain
Subject: Re: How to make object be transparent with alpha channel in the final image?
Date: 10 Sep 2007 10:39:49
Message: <46e55735$1@news.povray.org>
Hor nous apporta ses lumieres en ce 2007/09/10 07:10:
> Hello,
> 
> I have two solid objects overlapped with one another - both have visible and
> invisible parts. I need to make the area which filled with visible part of
> one object make transparent in the final image (using alpha channel, with
> transparent background as well). Another object parts must not be visible
> anywhere in this area.
> 
> What is the best way to get this effect? I found no solutions yet :(
> 
> P.S. Actually I need to do this with more than 2 objects (render separate
> images and overlay them later), but I think that I will be able to
> generalize the technique.
> 
> Thank you very much!!
> 
> 
> 
By overlap, do you mean that they intersect one another, or that they visualy 
overlap without actualy intersecting?

-- 
Alain
-------------------------------------------------
Make yourself a better person and know who you are before you try and know 
someone else and expect them to know you.


Post a reply to this message

From: Hor
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 10 Sep 2007 14:20:01
Message: <web.46e58a40e65e5e0b2eeed0020@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> Hor nous apporta ses lumieres en ce 2007/09/10 07:10:
> >
> > I have two solid objects overlapped with one another - both have visible and
> > invisible parts. I need to make the area which filled with visible part of
> > one object make transparent in the final image (using alpha channel, with
> > transparent background as well). Another object parts must not be visible
> > anywhere in this area.
> >
> By overlap, do you mean that they intersect one another, or that they visualy
> overlap without actualy intersecting?

Only visually (2D projections). They do not intersect in 3D.


Post a reply to this message

From: William Tracy
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 10 Sep 2007 14:41:50
Message: <46e58fee$1@news.povray.org>
Hor wrote:
> Only visually (2D projections). They do not intersect in 3D.

pigment { color rgbt <1, 1, 1, 0.5> }

Does that do what you're looking for?

-- 
William Tracy
afi### [at] gmailcom wtr### [at] calpolyedu

You know you've been raytracing too long when you can remember the 4 
digit decimal equivelents to measurements down to 1 sixtyfourth of an inch.
     -- David Kraics


Post a reply to this message

From: Tim Attwood
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 10 Sep 2007 16:16:10
Message: <46e5a60a$1@news.povray.org>
> Only visually (2D projections). They do not intersect in 3D.
To render with alpha transparency you can use +UA in the
command line, and use an output type that supports alpha
tranparency (PNG, TGA).

You can then compose your object layers seperately.

Handling layer interation can be tricky (one object casts
a shadow on another), but you can manage this with
the no_image keyword.  It's OK in many cases to
ignore layer interactions anyways.


Post a reply to this message

From: Hor
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 10 Sep 2007 17:30:01
Message: <web.46e5b4878503f272eeed0020@news.povray.org>
Let me explain. Here is a simple example:

http://www.doublebrick.ru/~hor/rings.png

You'll see two rings there, blue and red. They are do not intersect in 3D,
but they projections to the image plane are overlapped with one another.
What I really need, is to make two separate images, one consists of visible
blue parts only, second one with red parts only.

William Tracy wrote:
> pigment { color rgbt <1, 1, 1, 0.5> }

If I make the object partially or even fully transparent, another object
parts which were clipped before, will be shown. In this example, if I make
the red torus trasparent, the complete blue torus will be shown. It is not
what I needed.

I need to find a way to completely "remove" the object from the final image,
clean its area with transparent color and do not show the objects
which are behind object erased. Something like this (red torus cleared
manually in GIMP):

http://www.doublebrick.ru/~hor/ring_blue.png

Tim Attwood wrote:
> You can then compose your object layers seperately.

Sorry, I didn't get your idea.

> Handling layer interation can be tricky (one object casts
> a shadow on another), but you can manage this with
> the no_image keyword.  It's OK in many cases to
> ignore layer interactions anyways.

It's OK for me to go without shadows. Unfortunately, no_image seems to work
like 100% transparency, all objects behind this are shown.


Post a reply to this message

From: William Tracy
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 10 Sep 2007 17:55:50
Message: <46e5bd66$1@news.povray.org>
Ooh, this is way different that what I was thinking of.

First off, why do you need to composite the images in postprocessing? 
There might be an easier way to do whatever you have in mind.

Otherwise, I'm thinking you could render the object you want "invisible" 
with:

texture {
pigment {color rgb 0}
}

So it just disappears into the background. (If you render with a 
different background color, just use the same color as the background, 
and use ambient 1.) Then, in your image editing program, grab the "magic 
wand" tool, select the background area, and delete it. (The exact steps 
vary depending on what software you use.)

Basically, instead of rendering to an image with an alpha channel, just 
cut out the background manually in Photoshop or whatever.

I can't think of a good way to do it entirely in POV.

-- 
William Tracy
afi### [at] gmailcom wtr### [at] calpolyedu

You know you've been raytracing too long when you decide to render a 
bird ... creating each feather separately.
     -- Quietly Watching


Post a reply to this message

From: Tim Attwood
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 11 Sep 2007 02:29:10
Message: <46e635b6@news.povray.org>
>> You can then compose your object layers seperately.
>
> Sorry, I didn't get your idea.

If the objects are separate you could render them separately,
but I now see from your example that they aren't really
separate.  With the overlapping rings which image would
be on top?  The way that you envision it either of the rings
might be.  In order to cut up your object you will need to
resort to further CSG or use clipped_by.
Example of cutting by depth...

difference {
   union {
      torus {0.5,0.1
         rotate <75,0,0>
         translate <-0.3,0,0>
         texture {pigment {Red}}
         interior_texture{pigment {Clear}}
      }
   torus {0.5,0.1
      rotate <-75,0,0>
      translate <0.3,0,0>
      texture {pigment {Blue}}
      interior_texture{pigment {Clear}}
   }
}
plane {z,-0.08 pigment {Clear} } // show rear part
//plane {z,-0.08 inverse pigment {Clear} } // show front part
}


Post a reply to this message

From: Hor
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 11 Sep 2007 07:35:00
Message: <web.46e67d218503f27372f63560@news.povray.org>
William Tracy wrote:

> So it just disappears into the background. (If you render with a
> different background color, just use the same color as the background,
> and use ambient 1.) Then, in your image editing program, grab the "magic
> wand" tool, select the background area, and delete it. (The exact steps
> vary depending on what software you use.)
>
> Basically, instead of rendering to an image with an alpha channel, just
> cut out the background manually in Photoshop or whatever.

Yes, thank you. Your suggestion seems to be the best working technique for
now - turn off any reflection for the object which need to be cleared and
delete it later in some image editing software. This way will be not
completely automatic (as I initially wanted), still possible.

Tim Attwood wrote:
> >> You can then compose your object layers seperately.
> >
> > Sorry, I didn't get your idea.
>
> If the objects are separate you could render them separately,
> but I now see from your example that they aren't really
> separate.  With the overlapping rings which image would
> be on top?  The way that you envision it either of the rings
> might be.  In order to cut up your object you will need to
> resort to further CSG or use clipped_by.

Thank you very much for explanation and example, although I'm not sure that
it will work in general case. It would be very complex to split objects and
calculate clipping planes. I need to process the scene of about dozen
objects of complex shape to make a set of images with picture of each
single object only. All objects are not intersected in terms of CSG. It is
2D image where their projections are overlapped.

Actually, the only thing which I needed, is to instruct POV-Ray to replace
every visible pixel of selected object(s) with alpha-transparent one. And I
still can not find the way how to do it.


Post a reply to this message

From: Alain
Subject: Re: How to make object be transparent with alpha channel in the final image=
Date: 11 Sep 2007 08:18:29
Message: <46e68795@news.povray.org>
Hor nous apporta ses lumieres en ce 2007/09/11 07:33:
> William Tracy wrote:
> 
>> So it just disappears into the background. (If you render with a
>> different background color, just use the same color as the background,
>> and use ambient 1.) Then, in your image editing program, grab the "magic
>> wand" tool, select the background area, and delete it. (The exact steps
>> vary depending on what software you use.)
>>
>> Basically, instead of rendering to an image with an alpha channel, just
>> cut out the background manually in Photoshop or whatever.
> 
> Yes, thank you. Your suggestion seems to be the best working technique for
> now - turn off any reflection for the object which need to be cleared and
> delete it later in some image editing software. This way will be not
> completely automatic (as I initially wanted), still possible.
> 
> Tim Attwood wrote:
>>>> You can then compose your object layers seperately.
>>> Sorry, I didn't get your idea.
>> If the objects are separate you could render them separately,
>> but I now see from your example that they aren't really
>> separate.  With the overlapping rings which image would
>> be on top?  The way that you envision it either of the rings
>> might be.  In order to cut up your object you will need to
>> resort to further CSG or use clipped_by.
> 
> Thank you very much for explanation and example, although I'm not sure that
> it will work in general case. It would be very complex to split objects and
> calculate clipping planes. I need to process the scene of about dozen
> objects of complex shape to make a set of images with picture of each
> single object only. All objects are not intersected in terms of CSG. It is
> 2D image where their projections are overlapped.
> 
> Actually, the only thing which I needed, is to instruct POV-Ray to replace
> every visible pixel of selected object(s) with alpha-transparent one. And I
> still can not find the way how to do it.
> 
> 
Try this:
- Use an orthografic camera along the z axis
- Make the oculting object(s) stretch in the z direction (scale<1,1,1000>), 
cuting off the parts that pass behind other objects. Removing an appropriately 
placed box could be enough.
- Difference that stretched and cut object from every objects that it ocult.
difference{
	union{ All_Other_Objects }
	object{ Your_Stretched_&_Cut_Oculting_Object }
	}
- Render with +ua as PNG (+fn).
- Repeat for each objects.

Finaly, draw each images one on top of the other over your background.

Is that for some presentation where you need to switch on and off selected parts 
of the image?

-- 
Alain
-------------------------------------------------
   The other day I came home and a guy was jogging, naked. I asked "Why?"  He 
said "Because you came home early."
	Rodney Dangerfield


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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