Ambient Occlusion with Mental Ray
Total Page:16
File Type:pdf, Size:1020Kb
Obsolete Method for applying AO to assets. As of CRYENGINE 3.6.x onwards, we would advise to not use this method of adding ambient occlusion information to your textures. CRYENGINE now handles the AO at run-time with such technologies as SSDO and SSAO". Ambient Occlusion with Mental Ray Objects with their own texture should always have some radiosity baked in. You can do this with a skylight, but this renders very slowly and always has a light direction in it. With Ambient Occlusion, on the other hand, the areas occluding each other are rendered more darkly and independently of a lightsource. You can use the render to texture function to bake the occlusion. First, open your render settings and set the renderers to mental ray: Then, create a material with a mental ray shader: Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 1 of 6 Assign Ambient / Reflective Occlusion to the Surface Shader Slot of the mental ray material. Adjust the parameters of the shader to get good results. The number of ray samples is the most important. Now, create an omni light. Go into its parameters and set "Affect Surfaces" to "Ambient Only" (under "Advanced Effects). Then enable the mental may light shader and instance the material surface shader on it (drag & drop): Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 2 of 6 Open the render to texture dialog ("0"). Select the object you want to bake. If it has overlapping UVs resulting from different material IDs, detach these parts before you proceed. Toggle Projection Mapping off and add a "LightingMap" under "Output". Select the desired texture resolution. Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 3 of 6 Don't apply the mental ray material to the object on which you want to bake the texture. Instead, apply a standard material to the object. The material is only created to instance the shader to the omni light, so you can modify the settings later. If you want to render the scene with a camera, apply the mental ray material to the object and you will see the ambient occlusion in the rendered image. Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 4 of 6 Click render, ignore all the mental ray warnings, and wait for the map to be finished. With low resolutions and ray samples, the texture for a medium-poly object are rendered in under a couple of minutes. With high quality settings it can take much longer. This is the resulting "Dirtmap". Multiply it over your diffuse map to get a convincing radiosity effect. It is also very useful as a layer mask for dirt or rust, since it tends to accumulate at the occluded parts of an object. If your texture renders out black, make sure that you assigned the correct renderer, and that all the settings are correct. Example object with dirtmap and 100% self illumination: Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 5 of 6 Confidential. © 2009-2015 Crytek GmbH. All Rights Reserved. Page 6 of 6.