• About us
  • Contact Us
  • Terms and Conditions
  • Forum
  • Materials
  • Shaders
  • Tools
  • Video
  • Learn
  • Gallery
My Mental Ray

Navigation

  • Main Page
  • Cookbook

MYMR WIKI Tools

  • Creating pages
  • Markup n styles
  • Page protection
  • Help

 

Toolbox

  • Upload file
  • Special pages
  • Printable version
  • Permanent link
Article    Discussion    View source    History   
Personal tools
  • Log in / create account

Gamma example

From Wiki

Jump to: navigation , search

You are here: mental ray cookbook / gamma example

Here is a simple test case, illustrating why not using gamma is incorrect. We will create two images that only differ in the amount of light used and compare then afterwards.

Contents

  • 1 Image 1
  • 2 Image 2
  • 3 Measure it
  • 4 Conclusion

Image 1

  1. Set Gamma=1 in 3ds max
  2. Take a standard material that is white. Turn off all exposure controls and everything. Just plain oldschool mode.
  3. Choose your favourite renderer - don't care which one.
  4. Make a plane using this material.
  5. Put an Omni light with no falloff fairly far above the plane.
  6. Set the light intensity to 0.2
  7. Render this. Right click on the pixel. You should be seeing pixels of intensity "0.2" reported by the 3ds max pixel slurper thingy in your image
  8. Save this as 'point-two.jpg'
  9. Load the file in Photoshop or your favourite app.
  10. Look at a pixel. It will have a raw pixel intensity of about 51 in the 0-255 scale

With me so far? Good.

Image 2

  1. Start with the final scene from above
  2. Copy the light, so we now have two lights side by side
  3. Render again
  4. Right click on image. You should be seeing pixels of intensity "0.4"
  5. Save as 'point-four.jpg'
  6. Load in Photoshop
  7. Look at a pixel. It will have a raw pixel intensity of about 102 on the 0-255 scale

All fine and dandy, you say. What is the problem, you say. Isn't this perfectly linear?


Measure it

  1. Ok, now bring out your light meter. Yes, really. A photographic spot meter measuring cd/m^2.
  2. Now measure the screen luminance of 'point-two.jpg'
  3. Then measure the screen luminance of 'point-four.jpg'

Tell me what you see. 'point-four.jpg' should have twice the luminance of 'point-two.jpg', right? Surely adding two lights of the same intensity should be twice as bright? That happens in any real world photographic situation.

Here's what you will find: The image 'point-four.jpg' measures almost FIVE TIMES AS BRIGHT as image 'point-two.jpg' FIVE TIMES (or 4.6 to be exact)!!!

If you can't understand that that is WRONG no matter how you slice it, then you can just stop reading here. ;)

The point with a linear workflow is that (just as an example, this applies to all light math) adding two lights that would yield twice the luminance in the real world really comes out as pixels of twice the luminance when MEASURED off the computer screen. It's about accuracy.


Conclusion

Now... what is the "correct" thing, you may wonder?

Well, the reality is that

  • light intensity of "0.2" should NOT map to the raw 8-bit pixel intensity of "51"
  • light intensity of "0.4" should NOT map to the raw 8-bit pixel intensity of "102"

The right result is that

  • the intensity "0.2" maps to the gamma corrected raw 8-bit pixel value of 122
  • the intensity "0.4" maps to the gamma corrected raw 8-bit pixel value of 168

"What" I hear you say. "168" isn't even close to twice of "122"

EXACTLY, my friend. But if you measure those pixels with a spot photometer, pixels of value 168 has twice the luminance in cd/m^2 to pixels of value 122

Therein lies the problem. The mistaken assumption that your raw 8 bit pixel values on your computer screen are linear to actual pixel luminance. THEY ARE NOT.

Which means any software that does not take that into account correctly (i.e. applies Gamma) will be W R O N G.

Retrieved from "http://mymentalray.com/wiki/index.php/Gamma_example"
Copyright © 2008 My Mental Ray Community. All Rights Reserved.
No part of this website may be reproduced unless for personal use without prior written permission from The My Mental Ray Community.