Fix #35004: fireflies with .tif image in cycles, try to avoid extreme values when

openimageio can't detect premul/straight alpha correct.
This commit is contained in:
Brecht Van Lommel
2013-04-17 14:47:58 +00:00
parent 0fc4f4b791
commit cf0e457e52
4 changed files with 31 additions and 7 deletions

View File

@@ -48,6 +48,7 @@ shader node_environment_texture(
string filename = "",
string projection = "Equirectangular",
string color_space = "sRGB",
int is_float = 1,
output color Color = 0.0,
output float Alpha = 1.0)
{
@@ -66,9 +67,13 @@ shader node_environment_texture(
/* todo: use environment for better texture filtering of equirectangular */
Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha);
if (isconnected(Alpha))
if (isconnected(Alpha)) {
Color = color_unpremultiply(Color, Alpha);
if (!is_float)
Color = min(Color, 1.0);
}
if (color_space == "sRGB")
Color = color_srgb_to_scene_linear(Color);
}