POV-Ray : Newsgroups : povray.binaries.images : alpha channel not work Server Time
8 Jul 2024 06:52:22 EDT (-0400)
  alpha channel not work (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: liujg
Subject: Re: alpha channel not work
Date: 6 Aug 2014 21:55:00
Message: <web.53e2dc22c9af290999daad1c0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 6-8-2014 9:51, clipka wrote:
> > The door image does have an alpha channel, but that channel is not used
> > at all: Each and every pixel is fully opaque. There's nothing POV-Ray
> > can do about that.
>
> My conclusion too.
>
> liujg: If you use GIMP, load your image there, go to Colours/Colour to
> Alpha... and set Black as your Alpha channel colour. Save your new image
> and try again.
>
> I think you have defined an alpha channel but not the transparency colour.
>
> Thomas
This is my pov

camera {
  location <0, 15, -40>
 direction <0, 0,  1>
  right x*1.33
 look_at <0,15,0>
}
background {
  color rgb < 0.60, 0.70, 0.95 >
}
light_source {
  <0,28,0> // position of a coner of the light plane
  rgb<1.0,1.0,1.0>
  area_light <3, 0, 0>, <0, 3, 0>, 2, 2 // light plane's edges; m by n bulbs
 adaptive 1 // if on, some rays will not be traced
 jitter // randomization of bulb's positions, emulating fuzzy shadow edges
}
object {
      mesh2{
         vertex_vectors{
                      5

                        <-500, 0, 30>, < 500, 0, 30>,<500,  500, 30>, < -500,
500, 30>  , < 0, 250,  30>

                       }
             uv_vectors{
                       5
                         <-25.0, -25.0>,< 25.0, -25.0> ,  < 25.0,  25.0>,
<-25.0,  25.0>,  <0.0, 0.0>
                       }
           face_indices{
                       4,
                        <0,1,4>, <1,2,4>,<2,3,4>, <3,0,4>

                       }
             uv_indices{
                     4,

                        <0,1,4>, <1,2,4>,<2,3,4>, <3,0,4>

                        }

            }
     texture{
         pigment{
       uv_mapping
        image_map { png "DHKX0221.png"  map_type 0   interpolate 2 }
       // image_map {sys "BACKGND4.BMP" map_type 0   interpolate 2 }
                }
         finish {
      specular 0.3
      roughness 0.01
                }
            }
 // translate <1,  2, 5>
}
How can I modify it.
Thank you!


Post a reply to this message


Attachments:
Download 'render result.png' (121 KB)

Preview of image 'render result.png'
render result.png


 

From: liujg
Subject: Re: alpha channel not work
Date: 6 Aug 2014 22:20:01
Message: <web.53e2e1c0c9af290999daad1c0@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 6-8-2014 9:51, clipka wrote:
> > The door image does have an alpha channel, but that channel is not used
> > at all: Each and every pixel is fully opaque. There's nothing POV-Ray
> > can do about that.
>
> My conclusion too.
>
> liujg: If you use GIMP, load your image there, go to Colours/Colour to
> Alpha... and set Black as your Alpha channel colour. Save your new image
> and try again.
>
> I think you have defined an alpha channel but not the transparency colour.
>
> Thomas
camera {
  location <0, 15, -40>
 direction <0, 0,  1>
  right x*1.33
 look_at <0,15,0>
}
background {
  color rgb < 0.60, 0.70, 0.95 >
}
light_source {
  <0,28,0> // position of a coner of the light plane
  rgb<1.0,1.0,1.0>
  area_light <3, 0, 0>, <0, 3, 0>, 2, 2 // light plane's edges; m by n bulbs
 adaptive 1 // if on, some rays will not be traced
 jitter // randomization of bulb's positions, emulating fuzzy shadow edges
}
object {
      mesh2{
         vertex_vectors{
                      5

                        <-500, 0, 30>, < 500, 0, 30>,<500,  500, 30>, < -500,
500, 30>  , < 0, 250,  30>

                       }
             uv_vectors{
                       5
                         <-25.0, -25.0>,< 25.0, -25.0> ,  < 25.0,  25.0>,
<-25.0,  25.0>,  <0.0, 0.0>
                       }
           face_indices{
                       4,
                        <0,1,4>, <1,2,4>,<2,3,4>, <3,0,4>

                       }
             uv_indices{
                     4,

                        <0,1,4>, <1,2,4>,<2,3,4>, <3,0,4>

                        }

            }
     texture{
         pigment{
       uv_mapping
        image_map { gif "DHKX0221.gif"  transmit 0, 1.0}
                }
         finish {
      specular 0.3
      roughness 0.01
                }
            }
 // translate <1,  2, 5>
}
Such as can render to have result picture,but I change image_map { gif
"DHKX0221.gif"  transmit 0, 1.0}to image_map { png "DHKX0221.png"  transmit 0,
1.0}. The povray will have a parse error ,keyword "transmit"cann't use with non
color_map image.Why? Thank you.


Post a reply to this message

From: clipka
Subject: Re: alpha channel not work
Date: 7 Aug 2014 01:00:55
Message: <53e30807@news.povray.org>
Am 07.08.2014 03:44, schrieb liujg:
> clipka <ano### [at] anonymousorg> wrote:
>> I'm rather surprised that you do get transparency at the sides of the
>> door; are you using object geometry for this?
>>
>> The door image does have an alpha channel, but that channel is not used
>> at all: Each and every pixel is fully opaque. There's nothing POV-Ray
>> can do about that.
>>
>> So whatever you did to try and create a partially transparent image, it
>> doesn't seem to work.
> This is my pov
...
> How can I modify it for use the channel.
> Thank you!

I think you didn't get the point: The /image/ doesn't use the alpha 
channel it has. To make it work, you have to modify the image you are using.


Post a reply to this message

From: clipka
Subject: Re: alpha channel not work
Date: 7 Aug 2014 01:12:22
Message: <53e30ab6@news.povray.org>
Am 07.08.2014 04:19, schrieb liujg:

>          image_map { gif "DHKX0221.gif"  transmit 0, 1.0}
>                  }
>           finish {
>        specular 0.3
>        roughness 0.01
>                  }
>              }
>   // translate <1,  2, 5>
> }
> Such as can render to have result picture,but I change image_map { gif
> "DHKX0221.gif"  transmit 0, 1.0}to image_map { png "DHKX0221.png"  transmit 0,
> 1.0}. The povray will have a parse error ,keyword "transmit"cann't use with non
> color_map image.Why? Thank you.

In .gif image files, for each pixel only a single value in the range 
0..255 is stored: This is an index into a table of RGB colours (the 
so-called "palette").

The syntax

     image_map { gif "DHKX0221.gif"  transmit 0, 1.0}

tells POV-Ray that each pixel referring to the first entry of the palete 
should be treated as being transparent.


PNG files (normally) don't use a palette, but store RGB colours for each 
pixel, so the above approach does not work.


Post a reply to this message

From: liujg
Subject: Re: alpha channel not work
Date: 7 Aug 2014 21:15:00
Message: <web.53e423b8c9af2909397e8cbb0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 07.08.2014 04:19, schrieb liujg:
>
> >          image_map { gif "DHKX0221.gif"  transmit 0, 1.0}
> >                  }
> >           finish {
> >        specular 0.3
> >        roughness 0.01
> >                  }
> >              }
> >   // translate <1,  2, 5>
> > }
> > Such as can render to have result picture,but I change image_map { gif
> > "DHKX0221.gif"  transmit 0, 1.0}to image_map { png "DHKX0221.png"  transmit 0,
> > 1.0}. The povray will have a parse error ,keyword "transmit"cann't use with non
> > color_map image.Why? Thank you.
>
> In .gif image files, for each pixel only a single value in the range
> 0..255 is stored: This is an index into a table of RGB colours (the
> so-called "palette").
>
> The syntax
>
>      image_map { gif "DHKX0221.gif"  transmit 0, 1.0}
>
> tells POV-Ray that each pixel referring to the first entry of the palete
> should be treated as being transparent.
>
>
> PNG files (normally) don't use a palette, but store RGB colours for each
> pixel, so the above approach does not work.
SO How can I use PNG files which contains alpha channel to be treated as being
transparent in some area.
Thank you .


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: alpha channel not work
Date: 7 Aug 2014 23:45:01
Message: <web.53e446c9c9af290914ed8b7f0@news.povray.org>
> > PNG files (normally) don't use a palette, but store RGB colours for each
> > pixel, so the above approach does not work.
>
> SO How can I use PNG files which contains alpha channel to be treated as being
> transparent in some area.

Your problem is not how to use the alpha channel in POV-Ray, your problem is
that your alpha channel inside the PNG image does not specify any transparent
parts. The alpha channel inside your PNG image currently says all pixels are not
transparent. You need to change the alpha channel inside your PNG image to
specify which parts of the PNG image are to be transparent.

To modify the all-non-transparent alpha channel inside your PNG image, you need
to open your PNG image inside an image editor that supports PNG images with
alpha channel. Then you modify the alpha channel inside the PNG image using the
image editor to specify which parts of the image are transparent. You can only
modify the PNG image inside an image editor. You cannot modify the PNG image
inside POV-Ray.

Once you have specified, using the image editor, which parts of the PNG image
are transparent, the image editor will save a valid alpha channel for your PNG
image. This alpha channel, created by the image editor, needs to specify the
transparent parts of the image, meaning the data in the alpha channel will be
different for transparent and non-transparent parts of the image. All this is
done in an image editor, it is not done in POV-Ray.

After you have specified the transparent parts of the image using your image
editor, you can save the modified PNG image and use it in POV-Ray. But as said,
you need to use the image editor first. This is not a problem with POV-Ray or a
problem using POV-Ray. This is a problem with your PNG image that does not
contain transparent areas in its alpha channel. Its alpha channel currently says
all pixels are non-transaprent. You need to specify which pixels are transparent
inside the PNG image using an image editor.


Post a reply to this message

From: clipka
Subject: Re: alpha channel not work
Date: 7 Aug 2014 23:50:07
Message: <53e448ef$1@news.povray.org>
Am 08.08.2014 03:11, schrieb liujg:

>> The syntax
>>
>>       image_map { gif "DHKX0221.gif"  transmit 0, 1.0}
>>
>> tells POV-Ray that each pixel referring to the first entry of the palete
>> should be treated as being transparent.
>>
>>
>> PNG files (normally) don't use a palette, but store RGB colours for each
>> pixel, so the above approach does not work.
> SO How can I use PNG files which contains alpha channel to be treated as being
> transparent in some area.
> Thank you .

You did everything right on the POV-Ray side: Normally you would simply use:

     image_map { png "DHKX0221.png" }

*BUT*, what we're trying to tell you all along:


     Your *IMAGE* is *BROKEN*.
     =========================

     It does *NOT* contain a /useful/ alpha channel.


Whoever created this image did something wrong when trying to add an 
alpha channel to the image. The alpha channel is there, but the 
information in there says, "all pixels are opaque; there are no 
transparent portions in this image."

How to fix this depends on your image manipulation program, and really 
has nothing to do with POV-Ray at all.


Post a reply to this message

From: clipka
Subject: Re: alpha channel not work
Date: 8 Aug 2014 00:09:48
Message: <53e44d8c@news.povray.org>
Am 08.08.2014 03:11, schrieb liujg:

> SO How can I use PNG files which contains alpha channel to be treated as being
> transparent in some area.
> Thank you .

Try this image to see how it /would/ work in POV-Ray if only your image 
had a proper alpha channel.


Post a reply to this message


Attachments:
Download 'dhkx0221_.png' (703 KB)

Preview of image 'dhkx0221_.png'
dhkx0221_.png


 

From: Kenneth
Subject: Re: alpha channel not work
Date: 10 Aug 2014 02:25:01
Message: <web.53e70fc2c9af2909c2d977c20@news.povray.org>
>
> SO How can I use PNG files which contains alpha channel to be treated as being
> transparent in some area.
> Thank you .

Here is a 'visual guide' to the problem you are having. It compares your .png
image to Clipka's corrected version. Your all-white alpha channel simply needs
the proper 'mask shape'-- which is missing.  ;-)


Post a reply to this message


Attachments:
Download 'comparison.jpg' (101 KB)

Preview of image 'comparison.jpg'
comparison.jpg


 

From: Patrick Elliott
Subject: Re: alpha channel not work
Date: 11 Aug 2014 00:22:36
Message: <53e8450c@news.povray.org>
Oh, and to add to what everyone else has said, one thing that annoys the 
hell out of me is how Photoshop handles "backgrounds". If the background 
has alpha, your fine, if it doesn't, then you can have a "layer" with 
it, but once you export that it something like png, the result merges 
the solid background, while still "seeming" to have alpha in it. There 
is a way around this, but, sadly, it isn't as simple as, say, setting 
the color to alpha, then using a fill tool (you can do that in Paintshop 
Pro, or could, in older versions, and I think it also has/had a direct 
replacement thing you could do). Photoshop treats all colors, no matter 
how transparent they are, as something to "paint over" the background, 
not replace. This means that you can never add transparency to 
background, where the background doesn't already contain it, it will 
just be ignored.

So, to get alpha in an image that doesn't have it you need to make a 
copy of the "background" layer, which is what will eat the alpha layer 
when it merges into the png. This new layer can now have sections 
"edited out" making them transparent. Then, delete the unneeded 
background. When saved, it should result in nothing ending up "under" 
the parts you want to be see through.

But, so long as the background doesn't contain, and never did contain, 
any alpha, the png will never show any either, when created. The 
background will simply "fill in" any holes you have in the image, in 
your case, with black.

-- 
Commander Vimes: "You take a bunch of people who don't seem any 
different from you and me, but when you add them all together you get 
this sort of huge raving maniac with national borders and an anthem."


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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