bake_texture
Bakes material or high-poly detail into an image texture for a UV-mapped object, then restores the render engine.
Instructions
Bake a texture map from an object's materials (or a high-poly source) into an image.
The object needs UVs (smart_uv_project) and a material. Cycles is used for the bake and the render engine is put back afterwards.
Args: object_name: Object whose UVs receive the bake (the low-poly one). bake_type: DIFFUSE (base colour, see diffuse_color_only), NORMAL, AO, ROUGHNESS, EMIT, COMBINED (fully lit), GLOSSY, TRANSMISSION, SHADOW, ENVIRONMENT, POSITION or UV. filepath: Image to write: .png, .exr, .tif or .jpg, in an existing directory. Use .exr or .png for normal maps. resolution: Square image size in pixels, 64 to 8192. source_object: High-poly object to bake from onto object_name (selected to active). Leave empty to bake the object onto itself. cage_extrusion: How far rays start outside the low-poly surface when baking from a source, 0.0 to 10.0. Raise it if the bake has holes. max_ray_distance: Furthest a ray may travel to hit the source, 0 for no limit, up to 10.0. margin: Pixels to bleed past UV island edges, 0 to 64, so mipmaps don't show seams. samples: Cycles samples for the bake, 1 to 4096. AO and COMBINED need more; DIFFUSE and NORMAL are clean at 1 to 16. diffuse_color_only: For DIFFUSE, bake the flat base colour (albedo) rather than lit colour. Game engines want this. normal_space: For NORMAL: TANGENT (game engines, normal map nodes) or OBJECT.
Returns: Dict with the file written, its size and the image name in Blender.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| margin | No | ||
| samples | No | ||
| filepath | Yes | ||
| bake_type | Yes | ||
| resolution | No | ||
| object_name | Yes | ||
| normal_space | No | TANGENT | |
| source_object | No | ||
| cage_extrusion | No | ||
| max_ray_distance | No | ||
| diffuse_color_only | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||