[Radiance-general] Tonemapping code...
Erik Brännlund
[email protected]
Thu, 27 Sep 2001 15:18:06 +0200
Hi!
I have tried to implement the tonemapping but the radiance site seems to
be down so I can't looak at all the code. All I have is tonemap.*. I
have managed to get something which compiles and runs but I seem to get
a linear mapping.
Either my code is wrong, likely.
Or the data I send into the mapping is wrong, even "likelier".
This is how it is done.
Read an HDR file
Convert RGBE data like this
Procedure rgbe2float(var red, green, blue : Double; rgbe :
rgbetype);
var
f : double;
begin
if (rgbe[3] <> 0) then
begin //nonzero pixel
f := power(2,rgbe[3]-(128+8));
red := rgbe[0] * f;
green := rgbe[1] * f;
blue := rgbe[2] * f;
end
else
begin
red := 0;
green := 0;
blue := 0.0;
end;
end;
For all pixels in image
Get RGB as float values
Convert to XYZ
Y := Y * 100;
If Y = 0 then
Y := 1e-4
AddToHist(Y);
ComputeMap
For all pixels in image
Get RGB as float values
Convert to XYZ
Y := Y * 100;
If Y = 0 then
Y := 1e-4
Map(X, Y, Z);
Am I totally wrong here or?
Many thanx in advance/Erik