I have been looking at ways to optimize Cycles’ render times by faking light bounces, Global Illumination. The most common methods are baking the lighting and using ambient occlusion, but they have big problems.
-
Baking
[LIST] -
Lighting is static - glossy and Fresnel reflections don’t change while the camera moves
-
Doesn’t receive shadows
-
Ambient Occlusion
-
Doesn’t respect where the lights are
-
Doesn’t “conserve” energy at all (how much should be applied for a given lighting setup?)
[/LIST]
I’ve been thinking of ways that I could bake the Indirect lighting. Then, the direct lighting (including shadows) could be rendered on top of it. That would allow the camera to move while maintaining a good illusion. The lights could even move some, if you are careful.
Here are some things that I have learned from alpha testing.
REQUIREMENTS:
- Baking needs to be applied to an environment/set where characters are linked in. Therefore, the characters cannot have baked lighting. The environment/set needs to throw ambient color onto the characters.
- The realistic appearance of Cycles needs maintained.
HOW CYCLES WORKS
- The final image is (direct light + indirect light) X color
- If indirect light is ignored (no bounces), the final image is (direct light X color)
- Indirect light may be added: (direct light X color) + (indirect light X color)
- Cycles can bake just (indirect light X color) or (indirect light)
- Multiplying baked (indirect light) by the color input to the shader gives (indirect light X color)
[LIST] - Either way works
[/LIST]
SETUPThis is a GI lit scene. Suzanne will be the character, so I removed her and baked the (indirect light + color). If you want to clean up the noise in a graphic program, I suggest just baking the indirect light. The details are in the color pass and the direct lighting pass. So, removing the color makes cleaning up the light much easier. I didn’t clean up the noise. In all images using baking, I will render them with Suzanne place in the scene to show how it interacts with baked objects. I baked the lighting with 512 samples.
Samples: 256; time: 3m46s;
IDEAS
-
For good lighting of characters, more than one light bounce is needed. But, computing bounces on the environment when they are baked is a waste. So, a material may be restricted to no bounces by using the “Is Reflection” output of the light path node. This is how to do it.
-
Using an Add Shader node, add the actual shader to an emission shader of strength 1.0
-
Set the emission color to the baked indirect light X color
-
Put the Add Shader output into the top input of a Mix Shader node
-
Put the “Is Reflection Ray” output from the Light Path node into the Fac of the Mix Shader
-
This looks perfect from the camera’s perspective, but the environment doesn’t interact with anything in the scene.
Samples 256; time: 2m42s;
-
To add bounce light to the scene, use the emission shader with a strength of 2.0 for light rays that are reflections. However, this means that the actual shader will be illuminated by the emitted indirect light, but this indirect light is already being added in the material. So, we need to only use the emission shader for materials that don’t have baked lighting. Unfortunately, I haven’t figured out how the material with the baked textures can tell the difference between light bounced off itself and light bounced off of other objects. It needs to somehow ignore light bounced off of itself. And, it has to allow light to bounce off of itself to illuminate other objects and receive direct light. But, this is at least what it looks like to the character.
-
Add another Emission shader and set its strength to ???. Connect this to the top input of the Mix Shader. A strength of 3.5 worked for this scene, and I expect that it will depend upon the scene.
[INDENT=2][/INDENT]
Samples: 256; time: 3m15s