The Mask Map Generator is a Unity tool that streamlines the process of creating a Mask Map by combining information from four input textures: Diffuse Map, Normal Map, Metallic Map, and Ambient Occlusion Map. This tool is essential for realistic material rendering in 3D environments. It provides a user-friendly interface for inputting textures, generating the Mask Map, and saving the result.
The generated Mask Map stores material properties such as metallic, ambient occlusion, and smoothness values, which can be utilized in shaders to enhance visual quality. The tool checks for input map validity and provides feedback through the Unity console.
Key features include:
- Input textures: Diffuse Map, Normal Map, Metallic Map, and Ambient Occlusion Map
- User-friendly interface within Unity's editor
- Generate Mask Map button with error checking
- Mask Map generation with specific rules
- Save Mask Map as a PNG file
- File management and feedback through the Unity console
This tool simplifies the process of generating a Mask Map, making it easier to achieve realistic material rendering in 3D environments.
Input Textures:
- Diffuse Map: Represents the color information of the material
- Normal Map: Contains surface normals for simulating bumps and crevices
- Metallic Map: Defines the material's metallic properties
- Ambient Occlusion Map: Encodes ambient occlusion information for shading
User Interface:
- User-friendly interface within Unity's editor
- Input a desired 'Texture Name' and select the four input maps using object fields
Generate Mask Map:
- Checks if all input maps are provided and have the same dimensions
- Displays error messages if any criteria are not met
Mask Map Generation:
- Creates a new Texture2D with the same dimensions as the input maps
- Extracts specific information from each pixel in the maps:
- Metallic Value: Extracted from the red channel of the Metallic Map
- Ambient Occlusion Value: Extracted from the green channel of the Ambient Occlusion Map
- Smoothness Value: Calculated based on the Normal Map
- Combines these values to create the Mask Map pixel color
Saving the Mask Map:
- Allows the user to specify a folder for saving the Mask Map as a PNG file
- Prompts the user to confirm whether to overwrite a file with the same name
File Management:
- Checks if the target folder exists and creates it if not
- Encodes the Mask Map as a PNG image and saves it to the specified path
- Immediately recognizes the saved file through AssetDatabase.Refresh()
Feedback:
- Provides feedback to the user through the Unity console, indicating whether the Mask Map generation and saving processes were successful or if any errors occurred
Mask Map Generator: Simplify Material Rendering - Asset Store





