# UV Baking#

The Layer 3d gives you the ability to bake materials using a UV projection. This feature is extremely useful if you want to bake a high definition mesh to a low resolution one (using projection baking) or bake a complex and computationally expensive texture graph into an image map.

Beauty pass baked using the UV map of the geometry

Instead of rendering the scene from the viewpoint of a camera, the image is rendered using the UV map of one or multiple geometries. As the baking is simply a special mode of Layer 3d, not only it's the same workflow but you also have access to all the features available in normal renders such AOVs, baking image sequence etc...

Attribute Description
Enable Uv Bake When enabled, the rendering engine renders the 3D Layer using the UV map of the selected Scene Object.
Uv Bake Geometry Set the geometry that will be baked.
Uv Bake Slot Define which UV slot is used for the baking
Uv Bake Range Set the UV window used during baking (left, bottom, right, top)
UV Bake Eye Direction Define the direction of rays during shading.
Uv Bake Projection Mode Enables and specify the mode of the projection baking.
Uv Bake Projection Normal Specify which surface normal should be used during projection baking
Uv Bake Projection Offset Set the distance from which the ray is launched from the geometry. An offset of 0 means the ray is sent directly from the surface normal.
Uv Bake Projection Distance Set the maximum distance used when probing for another geometry. This feature is very useful if you wish to clamp the probing ray length. A distance of 0 means the maximum distance is infinite.

## Eye Direction#

Uv Bake Eye Direction defines the direction of rays during shading.

Mode Description
Normal In Normal mode, rays (shadow, GI, reflection etc...) are traveling from the surface along the direction of the surface normal.
Camera In Camera mode, rays (shadow, GI, reflection etc...) are traveling from the camera to the surface.

## Projection Baking#

Clarisse provides a powerful UV baking mode called Projection Baking. Projection Baking allows you to bake the properties of a geometry to another one. For example it can be used to transfer textures or bake full shading of high-res geometries to a lower ones.

### How does it work?#

The projection baking projects a ray from a specified geometry along its surface normal. If the ray ends up hitting a destination geometry, the geometry fragment gets shaded. The result of the shading along with AOVs are finally stored in the UV map. By default, Uv Bake Projection Mode is set to Disabled.

Mode Description
Disabled Disable projection baking.
Inside The ray probing for a geometry is sent from inside the baked geometry in the reverse direction of the surface normal.
Outside The ray probing for a geometry is sent from outside the baked geometry in the same direction of the surface normal.
Inside & Outside 2 ray are sent to probing for geometries: one from outside and one from inside, the final result being the closest hit.

In the following example, we'll bake a high resolution model onto a proxy version.

|

Projection baking texture result using proxy UV map

Proxy version with projection baking texture applied on

## AOVs Baking#

To export AOVs simply add the AOVs you wish to compute using the AOV Editor as you would on a Layer 3D. It is also possible to use Light Path Expressions to bake material properties such as shading normal, roughness etc... Please refer to Lobes Common Constants.

UV Edge padding is a feature that allows to bleed the UV texture using a dilation filter. This post process is used to expand the borders of UV geometries to improve image filtering and mip-mapping reducing interpolation artifacts occurring on discontinuities.

Important

The dilation filter of the UV Edge Padding is based on the alpha channel. It has no effect if the alpha channel of the texture is filling the texture.

## UV Baking Script#

Clarisse provides a convenient Python script that greatly simplifies the workflow of UV baking by automatically handling UDIMs, AOVs, sequences and edge padding. It can be found in the Rendering tab of the default application shelf. To successfully run it you must select the Scene Object you wish to bake. This script also allows you to bake beauty along with AOVs if properly set in the specified Layer 3D.

Important

As the script supports sequences it needs to change the application timelime to set the proper current frame. It is then highly recommended to close any opened/displayed 3D View/Image View before running this script. If you fail to do so, any images displayed in the Image View will also get evaluated.

Note

AOVs are always stored in individual images named after the AOV name.

UV Baking Script Tool

Attribute Description
UV Slot Choose which UV slot you wish to use for UV Baking. By default it uses the first one defined by the Scene Object.
Uv Range Define the range in UV coordinates of the baking (left, bottom, right, top) . When Enable UDIM Baking is on, this defines the number of UDIM textures that will be baked. Use the Texture UV View to find the correspondence between UV range coordinate and UDIM coordinate convention.
Enable UDIM Baking When enabled outputs multiple images using the specified UV Range and name them accordingly using the UDIM naming convention.
Eye Direction Define the direction of rays during shading.
Projection Mode Enable and specify the mode of the projection baking.
Projection Normal Specify which surface normal should be used during projection baking
Projection Offset Set the distance from which the ray is launched from the geometry. An offset of 0 means the ray is sent directly from the surface normal.
Projection Distance Set the maximum distance used when probing for another geometry. This feature is very useful if you wish to clamp the probing ray length. A distance of 0 means the maximum distance is infinite.
Uv Edge Padding Set the number of pixel used to expand the borders of UV geometries to improve mip-mapping and image filtering.
Layer 3d Set the Layer 3d that gets used as rendering context for lighting, reflections etc... during baking
Resolution Set the resolution of the baked image.
LUT Set the LUT that will be applied to the baked image
Apply LUT on Aovs Define if the LUT should be applied to AOVs.
First Frame Set the first frame
Last Frame Set the last frame
Frame Step Set the fame step
Save As Define the filename of the image. The frame number isn't automatically appended to the image name. It must be specified using # character.
For example:
/path/to/my/bake.####.png will resolve to /path/to/my/bake.0001.png, /path/to/my/bake.0002.png...

When enabling UDIM make sure to add the tag <UDIM> in the filename. During rendering the <UDIM> will be replaced by the proper UDIM naming convention
Format Define the file format used for the image. The image file format extension (like .png) is automatically appended at the end of the image name.