TextureBaker
Last updated
Last updated
Compatibility: URP, , ,
The TextureBaker is a powerful tool designed to streamline the process of creating texture atlases and combining materials into a single material. By consolidating textures and materials, the TextureBaker helps optimize rendering performance and reduce draw calls in your Unity projects.
The Texture Baker feature is disabled by default and needs to be manually enabled in your project settings. Follow these steps to enable the Texture Baker:
Navigate to the directory: /TeoGames/Mesh Combiner/Settings/Resources/
Locate the URP Texture Baker
scriptable object.
Add the URP Texture Baker
scriptable object to your Baker Settings:
Make sure that material baking is enabled on combiner: .
Here is example how baker setting may looks like when it's configured:
Base Map: Represents the main color texture.
Normal Map: Contains surface normal information for advanced lighting effects.
Emission Map: Specifies emissive areas of the material, emitting light in the scene.
Metallic Map: Defines the metallic properties of the material.
URP Lit
URP Simple Lit
URP Unlit
The URP Texture Baker comes with default configurations tailored to work with specific textures and shaders. However, you have the flexibility to customize these configurations according to your project requirements. Here are the key configuration options available:
Used for rendering solid objects that do not transmit light. Materials with a render queue value less than 3000 are selected for baking.
Used for rendering objects that transmit light or have semi-transparent properties.
A list of textures that will contain the output material. These textures will be assigned to the output material.
Each entity in the Textures list has the following fields:
Texture Name: The property name in the output shader where the texture will be assigned.
Format: The texture format.
Liner: Indicates whether the texture uses linear color space
Default Color: Specifies the default color of the texture. This color will be used if the source material doesn't have a texture.
Is Diffuse Texture: Indicates whether the texture is a diffuse texture. Only one texture should be checked. Note: Material will not be baked if there is no default texture on it.
Filter Mode: Determines the texture filtering mode
Keywords: Specifies keywords that will be enabled if the texture is used
A list of shaders that will be accepted by the material baker. If a source material is based on one of the specified shaders, it's properties will be used to map the source material properties to the output material.
Each entity in the Shaders list has the following fields:
Shader: The source shader.
Properties: A list of mappings from the source shader to the target shader.
Texture Name: The target shader's texture name, which should correspond to one of the Textures entities.
Property Name: The source shader's property name.
Specifies the size of the output texture (e.g., 1024x1024, 512x512, etc.)
Specifies the maximum size of the input texture. Input textures larger than this size will be downscaled to match this value.
Specifies keywords that will be enabled on the output material in any case.
The Texture Baker functionality operates through a series of steps to efficiently combine materials and create texture atlases. Here's how it works:
Input Material Check. The Texture Baker first checks each input material to ensure it meets specific conditions:
It should use one of the specified shaders.
It should have a default texture assigned.
Baking Process:
Once the input materials pass the validation checks, the Texture Baker proceeds to scale and bake all configured input textures into output textures.
Each input texture is scaled and positioned uniformly within the output texture, ensuring consistency in size and placement across all textures.
After the baking process is complete, each source material is replaced with the generated material containing the baked textures.
Atlas Management:
As textures are baked into the output texture, the Texture Baker monitors the atlas space usage.
When the output texture reaches full capacity, the Texture Baker automatically creates a new atlas to accommodate additional textures.
This automatic atlas creation ensures efficient use of texture space and prevents texture overflow.
The experimental nature of the Texture Baker feature entails several known limitations that users should be aware of. Here are some of the identified limitations:
Tiling and Offset Not Supported: Currently, the Texture Baker does not support tiling and offset functionality. Users should refrain from relying on tiling and offset configurations when using the Texture Baker.
Inability to Handle UVs Larger than 1: The Texture Baker is not equipped to handle UV mappings larger than 1. Users should ensure that UV mappings for textures do not exceed the boundaries of 1 to avoid unexpected behavior.
Note:
Users should exercise caution and thoroughly test their projects when utilizing the Texture Baker feature, as it may exhibit unexpected behavior due to its experimental status.
Feedback on encountered limitations and issues is valuable for improving and refining the Texture Baker functionality in future updates.