[Closed] Exposure control with maxscript. Is it possible?
Yes. This is a HDR image.
I know that with amxscript real time is impossible.
Maxscript can operate with 32 bit HDR?
I think that I will try with some small images, for example 100x100px, to see what happens.
lo, thank you for the exposure formula.
Yes, GetPixels will return a color value of type float when the image is HDR.
This function will work for both LDR and HDR images.
fn applyExposure bmp expValue =
(
local m = 2.0 ^ (expValue as float)
local w = bmp.width
local h = bmp.height
for y = 0 to h-1 do
(
local pixels = getPixels bmp [0,y] w
pixels = for p in pixels collect (color (p.r * m) (p.g * m) (p.b * m) p.a)
setPixels bmp [0,y] pixels
)
return bmp
)
Works, but the realtime is possible with small images. For HDRI 300x150px the time is ~0.15 sec for every iteration. For 7144x3572px the time is 84 sec.
50%-100% usually. For the same resolution (80004000) at 32 bits per channel, VFB+ takes ~60ms on my machine, which includes loading pixels, applying a 43 color matrix (which is heavier than only exposure adjustment), and writing back pixels to an 8-bit display buffer.
It could be faster if the SDK offered methods to directly access the linear space pixels buffer instead of having to copy each row to an intermediate buffer.
Maybe, one day, I will learn how to use the C# or C++/SDK. For now will use Photoshop for thing like this.
Denis, is your script works with 32 bit HDRI images?
lo said that c#/dotNet can work only with 8 bit hdr images.
Technically, c#/dotNet can do anything, but GDI+ can only manipulate 8-bit images.
If you use a framework such as FreeImage.Net you can manipulate the images quite easily, but it will most likely involve 2 disk writes/reads to transfer the data back and forth, negating any potential performance gains.