 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hello !
For a Web-Image I need to make the background transparent. What's the
best way to do it ? Is there something like a "build-in"-transparent
background ?
Martin
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Fri, 22 Sep 2000 15:59:27 +0200, Martin wrote:
>For a Web-Image I need to make the background transparent. What's the
>best way to do it ? Is there something like a "build-in"-transparent
>background ?
You can use +UA while outputting to a format that supports alpha
transparency (PNG or TGA). You'll need some sort of external program
to convert to transparent GIF (gag, spit). Be aware that support for
transparent TGA is spotty; even Photoshop (version 4 anyway) doesn't
support them correctly.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Proudly not helping RIAA and SDMI steal my rights --
http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Martin" <mar### [at] thomatechnik de> wrote in message
news:39CB65BF.B5C9F0B6@thomatechnik.de...
> Hello !
>
> For a Web-Image I need to make the background transparent. What's the
> best way to do it ? Is there something like a "build-in"-transparent
> background ?
>
I'm sure there's a way to do this directly in POV, but the easiest way is:
a) make your background a solid colour not in use elsewhere in your image.
b) open the finished image in a paint prog (example here is psp).
c) reduce colours to 256
d) pick the background colour with a dropper or similiar tool and either set
this as the second pallette colour or make a mental note of its index value
(this will show up in the pallette toolbar next to an "I" when the dropper
hovers over the colour).
e) use the "colors" menu to set pallette transparency to this value.
f) save image as either gif or png (png is better for ethical reasons, gif
for cross-browser compatibility)
One point is that you should be careful in POV to pick a background colour
that won't dither when reduced to 256. Pure black, white, green, red or blue
are good for this, but other colours will also work.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Output to png and use the +ua command line option. Every ray that doesn't
hit any object will affect the alpha channel.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ron Parker wrote:
> You can use +UA while outputting to a format that supports alpha
> transparency (PNG or TGA). You'll need some sort of external program
> to convert to transparent GIF (gag, spit). Be aware that support for
> transparent TGA is spotty; even Photoshop (version 4 anyway) doesn't
> support them correctly.
Hey, cool. That could prove very useful!
When using aa, does POV aa the alpha channel too so you can have a smooth
transition to the background?
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"David Fontaine" wrote:
> When using aa, does POV aa the alpha channel too so
> you can have a smooth transition to the background?
Yes, but unfortunately the *colour* isn't antialiased correctly.
When alpha is on, POV-Ray still use the background colour when it calculates
AA'ed pixels. It shouldn't. It's like it takes the background into account
twice - both in the colours and in the transparency. It should only do it in
the transparency.
Say you have a red sphere on a black background. The AA'ed pixels should
have the same red colour as the sphere but with some transparency. But
instead they are a darker red with some transparency because they are mixed
with the black background colour.
Result: When you use the alpha channel together with antialiasing, objects
will seem to have a very thin halo around them with the same colour as the
background colour you originally used.
But a much bigger problem is the way POV-Ray handles (semi-)transparent
objects. They are handled as though they were solid.
I'm not saying it's a bug. Maybe it's just an (in my opinion) unwanted
feature. But I would certainly appreciate it if somebody would fix it!
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated July 23)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Rune <run### [at] iname com> wrote:
: When alpha is on, POV-Ray still use the background colour when it calculates
: AA'ed pixels. It shouldn't. It's like it takes the background into account
: twice - both in the colours and in the transparency. It should only do it in
: the transparency.
: Say you have a red sphere on a black background. The AA'ed pixels should
: have the same red colour as the sphere but with some transparency. But
: instead they are a darker red with some transparency because they are mixed
: with the black background colour.
Then you'll wonder why the edges don't look antialiased when you look
at the image with a program that doesn't support the alpha channel (or
when povray itself shows the image).
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" wrote:
> Rune wrote:
>
> : Say you have a red sphere on a black background.
> : The AA'ed pixels should have the same red colour as the
> : sphere but with some transparency.
>
> Then you'll wonder why the edges don't look antialiased
> when you look at the image with a program that doesn't
> support the alpha channel (or when povray itself shows
> the image).
That is correct, and that is the way it should be (in my opinion).
(Not the wondering part but the rest.)
When you have turned the alpha channel on in POV-Ray, one must expect it to
be first priority that the image works correctly *with* alpha channel
support.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated July 23)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Rune <run### [at] iname com> wrote:
: When you have turned the alpha channel on in POV-Ray, one must expect it to
: be first priority that the image works correctly *with* alpha channel
: support.
What is the correct behaviour?
For example, let's suppose that we are calculating a pixel which is
located at the crossing of the edges of two objects.
One object is red (<1,0,0>) and takes 50% of the pixel area. The other
object is green (<0,1,0>) and takes 25% of the pixel area. The last 25%
of the pixel is background.
What should be the RGBA values for that pixel?
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Sun, 24 Sep 2000 01:18:33 +0200, "Rune" <run### [at] iname com>
wrote:
>When you have turned the alpha channel on in POV-Ray, one must expect it to
>be first priority that the image works correctly *with* alpha channel
>support.
Rune, the way POV works *is* the correct way. If you don't like it,
you can always remove the black/white matte or defringe it in
PhotoShop. It will take care of removing the leftovers from the
background based on the alpha channel intensity.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" wrote:
> What is the correct behaviour?
>
> For example, let's suppose that we are calculating a pixel
> which is located at the crossing of the edges of two objects.
> One object is red (<1,0,0>) and takes 50% of the pixel area.
> The other object is green (<0,1,0>) and takes 25% of the pixel
> area. The last 25% of the pixel is background.
> What should be the RGBA values for that pixel?
After the method *I* think is correct:
Colour: 0.67*red + 0.33*green => <0.67,0.33,0.00>
Alpha: 0.50*1 + 0.25*1 + 0.25*0 => 0.75
When you in a paint program put a background colour behind the image layer
the final colour value of the pixel will be like this:
image_colour*0.75 + background_colour*0.25
If the bg_colour is black the final colour will be: <0.50,0.25,0.00>
But if the background colour is white the colour will be: <0.75,0.50,0.25>
So no matter what colour you put behind your image the antialiasing will
work nicely without leaving any hint of what background colour you
originally used in POV-Ray. That is what I think is correct behaviour.
I'll make some images that shows what I mean and post them to
povray.binaries.images...
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated July 23)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Peter Popov" wrote:
> Rune, the way POV works *is* the correct way. If you don't like it,
> you can always remove the black/white matte or defringe it in
> PhotoShop. It will take care of removing the leftovers from the
> background based on the alpha channel intensity.
Why is an external program necessary to remove the traces of the background
I used in POV-Ray? I don't have PhotoShop.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated July 23)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Peter Popov wrote:
>
> On Sun, 24 Sep 2000 01:18:33 +0200, "Rune" <run### [at] iname com>
> wrote:
>
> >When you have turned the alpha channel on in POV-Ray, one must expect it to
> >be first priority that the image works correctly *with* alpha channel
> >support.
>
> Rune, the way POV works *is* the correct way. If you don't like it,
> you can always remove the black/white matte or defringe it in
> PhotoShop. It will take care of removing the leftovers from the
> background based on the alpha channel intensity.
>
At the edges of objects the rgb values of the object are AAed with the
background colour. When I turn on transparency, it's because I want the
background to represent _nothing_, how can nothing have a colour? There
should be no leftovers to remove.
PoD.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"PoD" wrote:
> At the edges of objects the rgb values of the object are AAed
> with the background colour. When I turn on transparency, it's
> because I want the background to represent _nothing_, how can
> nothing have a colour? There should be no leftovers to remove.
Exactly. The background presence should be stored in the alpha
channel only. Not in the red, green and blue components.
I have posted an image to povray.binaries.images and a bug report
to povray.bugreports
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated August 7)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Sun, 24 Sep 2000 22:19:02 +0200, Rune wrote:
>Exactly. The background presence should be stored in the alpha
>channel only. Not in the red, green and blue components.
>
>I have posted an image to povray.binaries.images and a bug report
>to povray.bugreports
It might have been premature for a post to .bugreports (we'll see; if it's
approved, it wasn't premature :) ) but for what it's worth, I agree that it
should work the way you describe rather than the way it works now.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Proudly not helping RIAA and SDMI steal my rights --
http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <slr### [at] fwi com> , ron### [at] povray org (Ron
Parker) wrote:
>>I have posted an image to povray.binaries.images and a bug report
>>to povray.bugreports
>
> It might have been premature for a post to .bugreports (we'll see; if it's
> approved, it wasn't premature :) ) but for what it's worth, I agree that it
> should work the way you describe rather than the way it works now.
I replied to the image post in povray.binaries.images and suggested to post
it as bug report :-)
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Sun, 24 Sep 2000 12:15:59 +0200, "Rune" <run### [at] iname com>
wrote:
>Why is an external program necessary to remove the traces of the background
>I used in POV-Ray?
These are not traces of the background. These are the actual colors of
the pixels. If the edge of red sphere on a blue background takes only
10% of a pixel, then this pixel will have a color of <0.1,0,0.9> . If
you make it <1,0,0>, antialiasing will be totally useless as no
jaggies will be reduced.
>I don't have PhotoShop.
I only used it as an example.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Sun, 24 Sep 2000 22:19:02 +0200, "Rune" <run### [at] iname com>
wrote:
>"PoD" wrote:
>> At the edges of objects the rgb values of the object are AAed
>> with the background colour. When I turn on transparency, it's
>> because I want the background to represent _nothing_, how can
>> nothing have a colour? There should be no leftovers to remove.
>
>Exactly. The background presence should be stored in the alpha
>channel only. Not in the red, green and blue components.
So, when anti-aliasing, how should POV treat rays that hit the
background? Ignore them?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Tue, 26 Sep 2000 22:09:14 +0300, Peter Popov wrote:
>On Sun, 24 Sep 2000 22:19:02 +0200, "Rune" <run### [at] iname com>
>wrote:
>
>>"PoD" wrote:
>>> At the edges of objects the rgb values of the object are AAed
>>> with the background colour. When I turn on transparency, it's
>>> because I want the background to represent _nothing_, how can
>>> nothing have a colour? There should be no leftovers to remove.
>>
>>Exactly. The background presence should be stored in the alpha
>>channel only. Not in the red, green and blue components.
>
>So, when anti-aliasing, how should POV treat rays that hit the
>background? Ignore them?
No, average them in as pure alpha. Rune has the right idea.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Proudly not helping RIAA and SDMI steal my rights --
http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Peter Popov" wrote:
> If the edge of red sphere on a blue background takes only 10%
> of a pixel, then this pixel will have a color of <0.1,0,0.9> .
> If you make it <1,0,0>, antialiasing will be totally useless
> as no jaggies will be reduced.
The jaggies will disappear when you view the image in a program that
supports the alpha channel. I think my post in povray.binaries.images shows
very well the advantage of the method I describe and the disadvantage of the
current method.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated August 7)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Peter Popov" wrote:
> So, when anti-aliasing, how should POV treat rays that hit
> the background? Ignore them?
For antialiased pixels where only some of the rays hit the background I have
already explained what to do. However, for antialiased pixels where *all*
the rays hit the background we have a special case.
Since the pixel is 100% transparent technically the colour is indifferent.
Of course POV-Ray has to assign a colour anyway, and that is the colour that
is shown in programs that doesn't support the alpha channel. An obvious
choice to assign to those pixels would be the background colour specified by
the user. But remember that this colour should only be used in pixels that
are 100% background (= 100% transparent).
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated August 7)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Tue, 26 Sep 2000 23:40:17 +0200, "Rune" <run### [at] iname com>
wrote:
>"Peter Popov" wrote:
>> If the edge of red sphere on a blue background takes only 10%
>> of a pixel, then this pixel will have a color of <0.1,0,0.9> .
>> If you make it <1,0,0>, antialiasing will be totally useless
>> as no jaggies will be reduced.
>
>The jaggies will disappear when you view the image in a program that
>supports the alpha channel. I think my post in povray.binaries.images shows
>very well the advantage of the method I describe and the disadvantage of the
>current method.
*If and only if* you know the background color. And how about
sky_sphere? Say you want your sky reflected in a metal sphere and then
you want that metal sphere masked out, how will you proceed?
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 26 Sep 2000 15:57:28 -0400, ron### [at] povray org (Ron Parker)
wrote:
>>So, when anti-aliasing, how should POV treat rays that hit the
>>background? Ignore them?
>
>No, average them in as pure alpha. Rune has the right idea.
Rune proposes that they should be ignored in the color channels and
only the alpha channel carried information about them. This would make
more sense if a) the background color is stored in the image somehow
(I like Rune's idea about 100% transparent pixels) and b) sky_sphere
is not used. I dont' really know how this will affect fog, global
media and rainbow effects. I am pretty sure it will mess the former
two up, though.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Peter Popov wrote:
>
> On 26 Sep 2000 15:57:28 -0400, ron### [at] povray org (Ron Parker)
> wrote:
>
> >>So, when anti-aliasing, how should POV treat rays that hit the
> >>background? Ignore them?
> >
> >No, average them in as pure alpha. Rune has the right idea.
>
> Rune proposes that they should be ignored in the color channels and
> only the alpha channel carried information about them. This would make
> more sense if a) the background color is stored in the image somehow
> (I like Rune's idea about 100% transparent pixels) and b) sky_sphere
> is not used. I dont' really know how this will affect fog, global
> media and rainbow effects. I am pretty sure it will mess the former
> two up, though.
>
a) Only meaningfull if you do not want any alpha.
If I request the alpha channel, the background is only a
placeholder for the directview in POV. If I intended
to have a picture with an alpha channel, you can assumed
that I will be able to use it in the generated picture.
So 100% transparent pixel does not need to adapt their
color to the background of the pov-script.
b) If sky_sphere is used, how can you have any alpha information ?
I do not understand how it could happen (No ray reach infinity,
they hit the sky_sphere first, hence, I suppose, no transparency
in the alpha channel.)
So basically, I currently agree with Rune & Ron Parker.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Peter Popov" wrote:
> Rune proposes that they should be ignored in the color channels
> and only the alpha channel carried information about them.
> This would make more sense if a) the background color is stored
> in the image somehow
I don't understand why. You don't come with any arguments. Try to provide an
example to demonstrate what you mean. I have made both an image example and
in the reply to warp a mathematical demonstration of why my method makes
more sense. You haven't commented on either of those. Please tell me exactly
why they are wrong.
> and b) sky_sphere is not used.
The sky_sphere works in the alpha channel the same way as a solid object so
it makes perfectly sense to use it.
> I dont' really know how this will affect fog, global media
> and rainbow effects. I am pretty sure it will mess the former
> two up, though.
Keep in mind that my original point was only about how the alpha channel
worked together with anti-aliasing, not how it works in general. I'd like to
go on and discuss those aspects later, but first I'd like to know why you
think my method is wrong in general.
Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated August 7)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 27 Sep 2000 06:37:45 +0300, Peter Popov wrote:
>On 26 Sep 2000 15:57:28 -0400, ron### [at] povray org (Ron Parker)
>wrote:
>
>>>So, when anti-aliasing, how should POV treat rays that hit the
>>>background? Ignore them?
>>
>>No, average them in as pure alpha. Rune has the right idea.
>
>Rune proposes that they should be ignored in the color channels and
>only the alpha channel carried information about them. This would make
>more sense if a) the background color is stored in the image somehow
>(I like Rune's idea about 100% transparent pixels)
Why do you want the background color stored in the image? By asking for
alpha, you're asking that the background color be irrelevant. Programs
that ignore the alpha channel aren't working properly and should be
ignored themselves. In effect, you're asking for a background color of
pure alpha, which should override the setting in the global_settings block.
and b) sky_sphere
>is not used. I dont' really know how this will affect fog, global
>media and rainbow effects. I am pretty sure it will mess the former
>two up, though.
Fog at least will always preclude any background from showing through.
Global media and rainbow can mix with alpha just as easily as they can
with a real background.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Proudly not helping RIAA and SDMI steal my rights --
http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Rune, Ron, J. and any others I've forgotten.
Practice shows that "they can't all be wrong." I'll agree with you for
now and if, when I have more time to think over it, I come up with
arguments stronger than yours, I'll post them. Until then, you got me
convinced.
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usa net
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"J. Grimbert" wrote:
> b) If sky_sphere is used, how can you have any alpha information ?
> I do not understand how it could happen (No ray reach infinity,
> they hit the sky_sphere first, hence, I suppose, no transparency
> in the alpha channel.)
Rays don't hit sky_spheres - they go to infinity where the sky_sphere is
Background & skysphere are the same thing.
--
Bye
Pabs
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |