POV-Ray : Newsgroups : povray.general : transparency gradient? : Re: transparency gradient? Server Time
12 Aug 2024 11:13:21 EDT (-0400)
  Re: transparency gradient?  
From: Ken
Date: 15 Feb 1999 18:57:22
Message: <36C8B40C.90E30E9E@pacbell.net>
Marc Schimmler wrote:
> 
> I'm just wondering if it is possible to make an object which
> transparency that changes with it's height?
> Imagine a cylinder which is nearly total transparent at it's bottom and
> and fully opaque at the top.
> 
> Any help appreciated from indenters as well as from non-indenters!!! ;-)
> 
> Thanks in advance,
> Marc

Note: for the purpose of this response I am going to refer to
transperancy as clear just because it's easier to type :)

You are on the right track with the gradient idea. The thing you
have to watch out for with mixing solid pigments with clear pigments
is that the pattern function will blend the solids in with the clear
parts making them much less clear. TO get around this you have to
carefully design you color map around this limitation.

An untested example:

                              cylinder{
                             <0,-1,0>,
                            <0,1,0>,
                           1
                          pigment{
                         gradient y
                       color_map{
           [0.0 rgbf<1,1,1,1.0>]
           [0.0 rgbf<1,1,1,1.0>]
           [0.2 rgbf<1,1,1,0.8>]
           [0.2 rgbf<1,1,1,0.8>]
           [0.4 rgbf<1,1,1,0.6>]
           [0.4 rgbf<1,1,1,0.6>]
           [0.6 rgbf<1,1,1,0.4>]
           [0.6 rgbf<1,1,1,0.4>]
           [0.8 rgbf<1,1,1,0.2>]
           [1.8 rgbf<1,1,1,0.2>]
           [1.0 rgbf<1,1,1,0.0>]
                                 }
                      translate -.5
                                    }
                                      }


How is my indenting now people ?

Anyway if you study the example you will see that I have bracketed each
map entry with a duplicate entry. This causes a sharp demarcation of
pigment color, clearness, and stops the bleeding from adjacent entries.
This example may be too sharp in it's cutoff points for what you want.
To correct this let each value in the color map entry extend a bit
higher than the one before it. If that doesn't work for you then just
start randomly playing with values and see what happens. Exploration
is a mighty powerfull teacher and there are few substitutions that will
replace it.


-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

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