|
|
Hello,
I'm looking for a proper way to convert an HDR image into a function and
then back into a pigment.
The problem:
HDR images, when used as functions, produce color banding due to
clipped (wrapped) color values. This is the typical behavior of
functions, and should be expected.
My solution:
Divide the image function by 255 and multiply each channel's color by 255:
#declare F_IMG =
function{
pigment{
image_map{ hdr "some_img.hdr" }
}
}
average
pigment_map{
[1
function{ F_IMG(x,y,0).x/255 }
color_map{[0 rgb 0][1 rgb x*255*3]}
]
[1
function{ F_IMG(x,y,0).y/255 }
color_map{[0 rgb 0][1 rgb y*255*3]}
]
[1
function{ F_IMG(x,y,0).z/255 }
color_map{[0 rgb 0][1 rgb z*255*3]}
]
}
I have constrasted the result against a PNG image using a reflective
sphere, and also with with my lb7b file for adding glare to images. This
solution seems to preserve the original range and intensity of the HDR
image.
So my question is this: does this method seem alright to you? Is there a
better way? Is my math faulty?
Sam
Post a reply to this message
|
|