POV-Ray : Newsgroups : povray.advanced-users : HDR images as functions: is this right? : Re: HDR images as functions: is this right? Server Time
27 Jun 2024 14:11:48 EDT (-0400)
  Re: HDR images as functions: is this right?  
From: Alain
Date: 27 Jan 2011 14:47:46
Message: <4d41cbe2$1@news.povray.org>

> 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

A factor of only 255 seems like very small, given that you can easily 
find HDR images with a range of 50 000:1 and more.
If the Sun does show in the image and you have dark details in deep 
shadows, the range can easily shoot past 1 million to 1.




Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.