Lightweight (Batch) Icon Generator - User Guide
Lightweight Icon Generator is a powerful utility for generating icons from 3D models in Unity. It allows you to set up a camera in your scene, configure various settings, and capture high-quality icons with ease. It also supports batch mode, allowing you to generate and save icons for hundreds of models in just a few clicks. This guide will walk you through the steps of using Lightweight Icon Generator effectively. If you need to contact the developer, you may email him at [email protected] or dm him at https://twitter.com/abmarnie.
Getting Started
- Attach the IconGenerator component to a Camera in your scene.
- In the Inspector, you will find various configurable settings for IconGenerator. The component will only work while enabled, but it should be disabled or removed before building your project (to avoid leaving the IconGenerator Preview in the build).
Your First Icon
Follow these steps to generate an icon:
- Save Directory: Set the folder where the generated icons will be saved. It should be relative to the “Assets/” folder. For example, if you enter “Icons”, then the output will be saved in “Assets/Icons”.
- Filename: Enter the desired output filename for the icon (excluding the file extension). A filename must be provided, or else icon generation will fail.
- Click the "Save Icon" button to generate and save the icon.
Advanced Settings
You can access advanced settings for more control over icon generation:
- Filename Prefix: Specify a prefix to add to the output filename. This is useful if you want a consistent naming convention for your icons, e.g., “icon_nameoficon.png”.
- Filename Postfix: Add a postfix to the output filename. This is useful if you want a consistent naming convention for your icons, e.g., “nameoficon_icon.png”.
- Overwrite File: Choose whether to overwrite an existing output file with the same filename. If this is off, then new icons with the same path will be numbered to prevent overwrite, e.g., “iconname.png”, “iconname1.png”, “iconname2.png”.
- Icon Resolution: Set the resolution (size) of the generated icon. The maximum support resolution is 8k.
- Icon Filetype: Choose the file format for the generated icon (e.g., png, jpg, etc).
Target Focus
IconGenerator can be set up to focus on a specific Target, opening up new options which are especially useful for generating icons for individual 3D models. The Target must have a MeshRenderer component attached. Simply drag and drop a your desired Target GameObject (which has a MeshRenderer component) from the scene hieararchy into the Target reference. The following options will appear:
- Use Target As Filename: By enabling this option, the name of the Target GameObject will be used as the filename for the generated icon. This means the output icon will be named after the Target GameObject, which can be useful for organization and identification.
- Isolate Target: If enabled, the camera’s culling mask will be changed when generating icons so that only the Target will be rendered to the screen; all other renderers in the scene will be ignored. This is especially useful when you want to generate icons that only showcase the selected Target without any distractions.
- Use Transparent Background: By enabling this option, the Camera’s ClearFlags and Background will be changed when generating icons to allow for transparent backgrounds. Often combined with “Isolate Target” for full effect.
- Use Unlit Shader: Enabling this option will apply an unlit shader to the Target GameObject during icon generation. The unlit shader means that lighting and shadows will not affect the Target, resulting in a flat appearance. This option is ideal for generating icons for objects that don’t require complex lighting effects, such as UI elements or simple props.
Camera Positioning
If there is no Target, you can move and position the camera freely like you normally would. But if there is a Target, the camera will be locked in place and cannot move. However, the following options for camera positioning become available:
- Camera Offset: Adjust the camera position relative to the target. Use negative Z values to get closer to the Target.
- Camera Distance: Control the distance between the camera and the target.
Batch Mode
To streamline the process of generating icons for multiple models or prefabs at once, the batch mode of IconGenerator allows you to specify certain settings and then generate icons in bulk. Here’s a more detailed explanation of the steps involved in batch icon generation:
- Use Batch Mode: First, ensure that the “Use Batch Mode” option is enabled in the Inspector. This will display the batch icon generation settings and hide the options related to individual icons.
- Model Directories: In batch mode, you can specify specific folders in your project that contain the models or prefabs for which you want to generate icons. The icon generation will be limited to the models located in these selected directories (and their subdirectories). Only models/prefabs which have a valid MeshRenderer will be used.
- Name Contains (Optional): If you want to further filter the models to be processed, you can specify a substring that the model filenames should contain. Only models whose filenames include this substring will be considered for batch icon generation. This option is useful when you want to generate icons for specific sets of models that share a common naming pattern.
- Model-Relative Save Directory: Enabling this option allows you to save the generated icons relative to each model’s location. Instead of having all the icons saved in a single directory, each icon will be saved in the same directory as its corresponding model. This is helpful for maintaining a neat and organized folder structure, especially when dealing with numerous models.
- Output Rotation: You can set the amount of rotation applied to each model before generating its icon. The output rotation allows you to control the orientation of the models in the icons, providing a consistent and visually pleasing presentation.
- Batch Generate Icons: Once you have selected the target model directories and set the desired options, click the “Batch Generate Icons” button. The IconGenerator will then process each model in the specified directories, create icons for them, and save the icons in the designated folders.
- Review and Fine-Tune: After the batch icon generation process, review the generated icons to ensure they meet your expectations. Depending on the consistency and variety of models, you may need to go back to fine-tune some settings or adjust the output rotation to achieve the best results.
Misc Usage Tips
Here are some misc usage tips to enhance your IconGenerator experience:
- Hover over any setting’s name to see a tooltip with additional information.
- Create a “photobooth” scene with manually placed background/foreground props for customized icon generation.
- For transparent icons, enable both “Render Only Target” and “Use Transparent Background” options and save in .png format.
- Enable “Use Unlit Shader” when generating icons for items to avoid lighting complications.
- You can zoom in closer to the target by adjusting the Offset.z value to be negative, or by setting Camera Component’s “FieldOfView.”
- For batch icon generation, ensure your models/prefabs are oriented correctly (forward is +Z) for consistent results. Use “Output Rotation” to quickly adjust rotation if needed.
Conclusion
Following these guidelines will help you make the most out of the IconGenerator tool and create stunning icons for your Unity project! Happy icon generation!