|
|
Hello,
I am trying to take an HDR image and convert it to grayscale by
calculating the luminance of the pigment using all three color
components. Unfortunately when I do that the resulting gray color is
clipped at 1.0. Any higher values from the original image would cycle
between 0 and 1. Any way of getting around this issue? Maybe is the
macro I am using. I suspect is the color_map that clips it.
Code below for the lighting sphere I use:
sphere {<0,0,0>,15000
texture{
pigment{pigment_intensity(pigment {
image_map{hdr "Chelsea_Stairs_Env.hdr" interpolate 2 map_type 1} })}
finish{diffuse 0 ambient 0 emission 1 specular 0 phong 0 reflection{0}}
}
no_shadow
no_reflection
hollow
}
here is the macro I use:
#macro pigment_intensity(p1)
#local PR1 = function {pigment{p1}}
#local PR_FRed=function (x,y,z)
{0.2126*PR1(x,y,z).red+0.7152*PR1(x,y,z).green+0.0722*PR1(x,y,z).blue}
#local PR_FGrn=function (x,y,z)
{0.2126*PR1(x,y,z).red+0.7152*PR1(x,y,z).green+0.0722*PR1(x,y,z).blue}
#local PR_FBlu=function (x,y,z)
{0.2126*PR1(x,y,z).red+0.7152*PR1(x,y,z).green+0.0722*PR1(x,y,z).blue}
average pigment_map{
[function{PR_FRed(x,y,z)} color_map{[0 rgb 0][1 rgb <1,0,0>*3]}]
[function{PR_FGrn(x,y,z)} color_map{[0 rgb 0][1 rgb <0,1,0>*3]}]
[function{PR_FBlu(x,y,z)} color_map{[0 rgb 0][1 rgb <0,0,1>*3]}]
}
#end
Thanks for any help on this.
Post a reply to this message
|
|
|
|
Try something like this, set MAX_COLOUR to the highest value you expect
to see from the functions.
average pigment_map{
[function{PR_FRed(x,y,z)/MAX_COLOUR} color_map{[0 rgb 0][1 rgb
<1,0,0>*3*MAX_COLOUR]}]
[function{PR_FGrn(x,y,z)/MAX_COLOUR} color_map{[0 rgb 0][1 rgb
<0,1,0>*3*MAX_COLOUR]}]
[function{PR_FBlu(x,y,z)/MAX_COLOUR} color_map{[0 rgb 0][1 rgb
<0,0,1>*3*MAX_COLOUR]}]
}
Post a reply to this message
|
|