|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Is there a way to adjust the transparency without modifying the images
themselves? Thanks!
Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 11/7/2009 7:41 PM, SharkD wrote:
> Is there a way to adjust the transparency without modifying the images
> themselves? Thanks!
>
> Mike
Nevermind. It tells how to do it in the docs.
Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD schrieb:
> Is there a way to adjust the transparency without modifying the images
> themselves? Thanks!
Well, yes and no...
From the documentation:
------
You can give the entire image a filter or transmit value using filter
all Amount or transmit all Amount. For example:
image_map {
gif "stnglass.gif"
filter all 0.9
}
------
However, this does not /adjust/, but rather /override/ an image's alpha
channel. For more sophisticated tampering with the transparency, you'll
need to mix multiple variants of your image, governed by the image's
alpha channel, such as:
pigment {
image_pattern { png "foo.png" use_alpha }
pigment_map {
[0.0 image_map { png "foo.png" transmit all 0.2 }]
[0.5 image_map { png "foo.png" transmit all 0.3 }]
[1.0 image_map { png "foo.png" transmit all 0.7 }]
}
}
Note however that this will drastically increase the memory footprint
(in the example, the image is loaded 4 times); if this is an issue, you
may instead want to use functions and averaging to compose the image,
such as:
#declare PgFoo = pigment { png "foo.png" }
#declare FnFoo = function { pigment { PgFoo } }
pigment {
average
pigment_map {
[1.0
function { FnFoo(x,y,z).red }
color_map { [0 rgbt 0][1 red 4] }
]
[1.0
function { FnFoo(x,y,z).green }
color_map { [0 rgbt 0][1 green 4] }
]
[1.0
function { FnFoo(x,y,z).blue }
color_map { [0 rgbt 0][1 blue 4] }
]
[1.0
function { FnFoo(x,y,z).transmit }
color_map {
[0.0 transmit 4 * 0.2]
[0.5 transmit 4 * 0.3]
[1.0 transmit 4 * 0.7]
}
]
}
}
which does the same, but loads the image only once, probably at some
speed disadvantage.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 11/7/2009 8:35 PM, clipka wrote:
> SharkD schrieb:
>> Is there a way to adjust the transparency without modifying the images
>> themselves? Thanks!
>
> Well, yes and no...
>
> From the documentation:
>
> ------
> You can give the entire image a filter or transmit value using filter
> all Amount or transmit all Amount. For example:
>...
> However, this does not /adjust/, but rather /override/ an image's alpha
> channel. For more sophisticated tampering with the transparency, you'll
> need to mix multiple variants of your image, governed by the image's
> alpha channel, such as:
>...
> which does the same, but loads the image only once, probably at some
> speed disadvantage.
Thanks for the tip.
Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka <ano### [at] anonymousorg> wrote:
> Well, yes and no...
>
Just came across this post. THANKS, Clipka, for explaining some great
workarounds to this situation, which I'll be trying out ASAP. The inability to
use 'transmit all' with alpha-channel images has been a stumbling block for me
for quite awhile.
The funny thing is, it *does* work as intended with 'typical' image_maps (those
with no alpha channel, like .bmp or .jpeg images.) I would assume that transmit
all has a bug of some sort at present, since the docs seem to indicate that it
can be used successfully with *any* type of image_map. Further assuming that
it's a problem related to transparency in general(?)
Again, thanks!
Ken
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD <mik### [at] gmailcom> wrote:
> Is there a way to adjust the transparency without modifying the images
> themselves? Thanks!
>
I forgot to mention a rather simple technique I came up with awhile ago. (I'm
somewhat embarrassed to admit that I didn't remember it in relation to your
question until now--even though I use it quite frequently! Sometimes I forget
techniques I've used in the past, and end up 'reinventing the wheel'...)
It's probably not as visually correct as clipka's ideas, but works well enough
in many situations. It uses a simple pigment_map:
pigment{
average
pigment_map{
[1.0 png "my_image.png"] // has alpha-channel transparency
[1.0 rgbt <.5,.5,.5,1>] // fully transparent
}
}
Adjust the 'weighting' of the rgbt color to get the amount of transparency you
want. The drawback is that the 'color' of the rgbt pigment is slightly imposed
on the 'real' part of the image_map, depending on the 'weighting.' (Though NOT
on the *transparent* parts of the alpha-channel image--they remains fully
transparent.) Through experience, I chose rgbt <.5,.5,.5,1> (a 'transparent
gray') as it seems to have the least visual impact on the image_map.
Ken
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|