POV-Ray : Newsgroups : povray.newusers : transparent background : Re: transparent background Server Time
29 Jul 2024 00:25:42 EDT (-0400)
  Re: transparent background  
From: Alain
Date: 11 Mar 2007 08:14:37
Message: <45f400bd$1@news.povray.org>
Shawn nous apporta ses lumieres en ce 11-03-2007 00:50:
> Hi,
> 
> I'm trying to render a scene with mac megapov in which I want the output to
> be a PNG with transparency.  I set the output file option by checking the
> box labeled 'Add Alpha Channel', which presumably is equivalent to "+ua" on
> the command line.  However, I always end up with a black background, rather
> than a transparent one.
> 
> Any suggestions would be appreciated.
> 
> Thanks,
> Shawn
> 
> ---
> 
> #version 3.5;
> 
> camera {
> location <0, 0, 10>
> look_at <0, 0, 0>
> }
> 
> #declare cam_pos = <0, 0, 10>;
> #declare dist = 1.03;
> #declare thick1 = 0.05;
> #declare linetex = texture {pigment {rgb 0} finish {ambient 1}}
> #declare trans = transform {rotate 90*clock*y}
> 
> #macro scalepoint(center,amt)
>         transform {trans}
>         translate -center scale amt translate center
> #end
> 
> #macro atom(center,rad,thick)
>         union {
>                 sphere {center,rad transform {trans}}
>                 sphere {center,(rad+thick1) texture {linetex}
> scalepoint(cam_pos,dist)}
>                 }
> #end
> 
> #declare ATM_FINISH = finish {ambient rgb <1,1,1> }
> #declare textgrey = texture {pigment {slope {vnormalize(<1000,1000,1000>)}
> color_map{[0.625 color rgb <.45,.45,.45>][0.626 color rgb <.5,.5,.5>]}}
> finish {ATM_FINISH}}
> #declare textred = texture {pigment {slope {vnormalize(<1000,1000,1000>)}
> color_map{[0.625 color rgb <.8,0,0>][0.626 color rgb <.95,0,0>]}} finish
> {ATM_FINISH}}
> #declare textgreen = texture {pigment {slope {vnormalize(<1000,1000,1000>)}
> color_map{[0.625 color rgb <0,.8,0>][0.626 color rgb <0,.95,0>]}} finish
> {ATM_FINISH}}
> #declare textblue = texture {pigment {slope {vnormalize(<1000,1000,1000>)}
> color_map{[0.625 color rgb <0,0,.8>][0.626 color rgb <0,0,.95>]}} finish
> {ATM_FINISH}}
> 
> background { color rgb <10,10,10> }
> 
> fog {
>   fog_type   2
>   distance   4
>   color      rgbt <0,0,0,.1>
>   fog_offset 1
>   fog_alt    .0001
>   up <0,0,1>
> }
This fog let show 1/10th of the background, so you need to set the background to 
10 to be able to see it.
> 
> object {atom(<-2,-2,0> .4, thick1) texture {textgrey}}
> object {atom(<-2,2,0> .4, thick1) texture {textred}}
> object {atom(<2,-2,0> .4, thick1) texture {textgreen}}
> object {atom(<2,2,0> .4, thick1) texture {textblue}}
> 
> 
> 

Check out your fog: it fades to black and given the fact that you don't have 
anything behind the scene, you don't see the background, only your fog.
Solution: remove the fog. You can also remove the background directive, as it is 
no longer needed.

-- 
Alain
-------------------------------------------------
At least I thought I was dancing, 'til somebody stepped on my hand.


Post a reply to this message

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