PDA

View Full Version : Display gamma corrected image in an interface...


antonv
10-26-2006, 08:22 PM
Hi all,

I've run in a small issue here with how images are displayed in an interface. Basically,
I'm working in linear space with a 2.2 gamma and in a script interface I have a thumbnail of the last rendered image. My issue is that I am not saving the thumbnail with gamma burned in and because of that the interface displays it very dark, but if the same image is displayed in the VFB it looks ok. It seems like max does not apply the gamma to the images displayed in an interface...

So my next thought was to find what gamma value I'm using and use that when displaying my thumbnail but I've run into another issue. Through maxscript you can only get the gamma value but you cannot see if it's enabled or not, or at least I didn't find it in the reference.

Anybody has any experiece with this or any ideas on how to get that info?

I've found a reference on how to see if your render was submitted with gamma enabled but just for the network renderer...


Thanks,
Anton

antonv
10-27-2006, 09:23 PM
Got it guys,

It's a bit slow but works for my purpose.
What I did was to create a new bitmap where each pixel has it's gamma adjusted to the value I want with the getPixels/setPixels commands and use it to display in my interface.

The formula I used for gamma correction is "color = 255*(color/255)^(1/gamma)" if someone is interested.

Thanks,
Anton

ypuech
10-27-2006, 11:27 PM
Hi,

You can speed up your code using some optimizations : get and set an entire line instead of pixel by pixel for example. Look at "How To Make It Faster?" and "Never get a single pixel when you can get a whole line" advice.

Also, if you're using 3ds max 9 you can use GDI+ classes from .Net Framework with the dotNet connection. But it's more difficult and it's not sure that your code will be faster.

antonv
10-28-2006, 07:12 PM
Thanks for the answer Yannick!
I'm was already doing the whole line at once but it's still quite slow.
For the second idea with the GDI+ it's not possible right now as we are still on max 8.

Thanks again,
Anton.

CGTalk Moderation
10-28-2006, 07:12 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.