Thursday, May 23, 2013

Class01 - Physically Correct Lighting, Linear Color Workflow, and HDR images




Rules to follow when working in Physically Correct Lighting
Always begin with these rules, even when test lighting on a sphere, then later you can break some guidelines as you get closer to final render.

1) Proper real world scale - leave the Maya default unit at cm, make your grid equal meters.
2) All lights must have quadratic decay rate, light intensities can get very high.
3) Be sure we are rendering to a 32 or 16 bit floating point format such as HDR or EXR.
4) Verify that our render window is set to display 32 bit float, and Image display is Linear sRGB.
5) Must use gamma corrected (gamma = 0.4545) textures or Color Management = ON in Maya.

additional suggestions that help give photorealistic resulting renders

6) Use accurately scaled area lights, make them mental ray ON, always raytrace shadows.
7) Use the mia_materials because they have BRDF and physically accurate shading.

Physically Correct Lighting
Summary: 1)computer monitors and images have gamma correction natively, 2)we must adjust our software (maya render view window) to compensate for this, 3) ignoring these details will result in non-accurate lighting falloff and highlights.


Our graphics programs like Maya, Mental Ray, and Nuke all use Linear math, but our display hardware uses non-linear (logrithmic math), or gamma correction, commonly 2.2 also known as sRGB.  Therefore our images from all digital cameras, photoshop, and internet jpegs are all gamma corrected, meaning they have an inverse 1/2.2 (or 0.4545) correction curve baked into the image file, so they look nice on our monitor.  The problem happens when we feed these gamma corrected images into Maya as textures, and they are not linear.  We can adjust the gamma of each one in the shader networks, or use the new Maya Color Management tools.  Even without textures, this is important when you are lighting images because evaluating your renders in the wrong colorspace could get you unrealistic light decay, and blown out highlights, whereas you really want to do 3D and compositing work in a Linear colorspace where lighting has a greater falloff and softer highlights.
Demo:  open a new maya, set your grid to be one meter (a baseball bat or parking meter), import in bunch of spheres and area lights, try some test renders to look at falloff, change render to EXR and 32bit float, discuss the quality of light as exposure is changed.  Second open the file with a texture mapped sRGB plane, render that and discuss Color Management.
Lets make sure Maya is also working in this Linear workflow.
-Render Panel -> Display -> 32bit floating point HDR
-Render Options -> Frame Buffer -> RGBA float 4x32bit
Conclude: 1) we must work in real world units meters 2) must use quadratic light falloff 3) must maintain Linear Color workflow 4) must evaluate renders with the render view gamma corrected sRGB, or 2.2 (5) consider using all mia shaders
Summary of the Solution:
1)Everything you put into a 3D render, textures, backgrounds, or in our case HDR images for lighting, make sure they are linear, that means no change to our HDR images, but we need a 0.45 gamma correction on all non-linear textures, procedurals, and plain solid color in shaders.  As of now, Color Swatches are not color managed in Maya.
2)When looking at our test renders in the Render View window, be sure to view them with the Viewer gamma correction of 2.2 or sRGB.  They will look good to our eyes, but that is not what we render.  Rather we render out Linear, floating point, and bring into Nuke, doing whatever comp is needed, all in Linear 32-bit color space, (always working with this temp screen gamma correction ON in Nuke), then render out result and safely bake in a gamma correction for final comp.
Color swatches are not color managed. To maintain a linear workflow, single color swatches in shaders, procedurals, utility nodes and lights should be converted to a linear color. A simple way to approximate this conversion is to attach a Gamma Correct node (Window > Rendering Editors > Hypershade > Maya > Utilities) to any Color attribute of a rendering node, then set the Value attribute of the Gamma node to the desired color and set all three Gamma values (RGB) to 0.455.

Some good descriptions of Linear Color Workflow details.
What is a High Dynamic Range Image (Photoshop and Nuke)
Summary: 1)what makes an image High Dynamic Range, 2)how to create an HDR in photoshop from an exposure wedge, 3)how to verify an image is 32bit float in Nuke, 4)what are some different types and formats of HDR images.
Hdr image has very dark darks, and very bright whites.
It is not the colorful images seen on flickr, those are tonemapped images that started as HDR.  Our HDR images are floating point images rather then integer, which allows storing a nearly unlimited dynamic range in a compact way.  When we get from the internet or create our HDR images we will always verify that they are floating point, and we will strive to get more details in the shadows and highlights.  We will focus on EXR format, the 32bit floating point format created and used by ILM on all of their movies.
Open the two wedge images that I took here in Rio, then open the result in Nuke.  Open the two test images from OpenEXR test images.  They are 16bit float and 32bit float.
Verify they are float because Nuke has input colorspace LUT is default Linear.
Nuke works in a native 32bit per channel linear RGB color workspace
formats hdr and exr, Paul Debevic ICT light probe
where to find free HDR images
Three HDR styles are (1) latitude longitude (lat long) (2)vertical cross or cubic (3)light probe
DEMO: open up some sample HDR images, show linear and sRGB, show light intensity with eye dropper, open a wedge of images in Photoshop, show how we will get details from the lights and darks, do a quick HDR create,
CONCLUDE: we are going to work with EXR, latlong, verified 32bit floating pt HDR images

1 comment:

  1. Top 3 casinos for Filipino players | ChoegoCasino
    You'll find a wide array 카지노사이트 of 제왕카지노 options for Filipino players and the game can be played for free and online with just one click at ChoegoCasino.com. 메리트카지노

    ReplyDelete