|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |