Distance-Based Smart-Uvs Addon For Blender
Distance-Based Smart-UVs Addon for Blender
Distance-Based Smart-UVs is a Blender addon that allows you to perform Smart UV unwrapping and automatically scales UV islands based on their distance to the camera. This ensures optimal texture distribution, giving more texture space to areas closer to the camera and optimizing your 3D models' visual quality.
Features
-
Automatic UV Scaling Based on Distance:
Close: UV islands of faces within the close distance threshold are scaled by a user-defined factor (default is 2.0x).
Medium: UV islands of faces within the medium distance threshold are scaled by a user-defined factor (default is 1.5x).
Far: UV islands of faces within the far distance threshold are scaled by a user-defined factor (default is 1.25x).
Very Far: Faces beyond the far threshold remain at their original scale.
-
Customizable Thresholds and Scale Factors:
Set your own distance thresholds to define what is considered close, medium, or far.
Adjust the UV scaling factors for each distance group to suit your project's needs.
-
Single UV Map Management:
The addon creates or utilizes a single UV map for all unwrapping and scaling operations, ensuring a clean and organized UV layout.
-
Smart UV Project Integration:
Utilizes Blender's Smart UV Project for efficient and intelligent unwrapping of selected faces.
-
UV Packing and Optimization:
After scaling, all UV islands are automatically packed to fit within the 0-1 UV space, optimizing texture space usage.
-
User-Friendly Interface:
Accessible from the 3D Viewport's sidebar under the UV tab.
Easy-to-use panel with adjustable parameters and a single button to execute the operation.
Add-On Settings and Customization
-
Distance Thresholds:
Close Threshold: Maximum distance considered 'Close'.
Medium Threshold: Maximum distance considered 'Medium'.
Far Threshold: Maximum distance considered 'Far'.
-
UV Scale Factors:
Close Scale: UV scale factor for faces within the close threshold.
Medium Scale: UV scale factor for faces within the medium threshold.
Far Scale: UV scale factor for faces within the far threshold.
-
UV Settings:
UV Map Name: Specify the name of the UV map to create or use.
UV Margin: Adjust the margin between packed UV islands during the packing process.
How to Use the Tool
-
Installation:
Download the
distance_based_smart_uvs.py
file.In Blender, go to Edit > Preferences.
Click on Add-ons and then Install....
Navigate to the downloaded
.py
file, select it, and click Install Add-on.Enable the addon by checking the box next to Distance-Based Smart-UVs.
-
Preparation:
Ensure you have an active camera in your scene.
Select the object you want to unwrap and scale UVs for.
-
Using the Addon:
In the 3D Viewport, press N to open the sidebar if it's not already open.
Navigate to the UV tab.
Locate the Distance-Based Smart UVs panel.
Adjust the distance thresholds and scale factors as needed.
Click the Distance-Based Smart UVs button to execute the operation.
-
Result:
-
The addon will:
Calculate the distance from each face to the camera.
Assign faces to distance groups based on the thresholds.
Perform Smart UV Project unwrapping for each group.
Scale the UV islands according to the specified scale factors.
Pack all UV islands into the 0-1 UV space.
-
Important Notes
-
Performance Considerations:
This tool is optimized for use on objects with a manageable polygon count.
High-poly objects may experience longer processing times due to the calculations involved.
-
Custom UV Map Name:
If you specify a UV map name that doesn't exist, the addon will create it.
If the UV map already exists, the addon will use it for the operations.
-
Adjusting Thresholds and Scales:
Experiment with different thresholds and scale factors to achieve the desired texture distribution.
Larger scale factors will allocate more texture space to closer faces.
-
Undo Support:
The addon supports Blender's undo system. If you're not satisfied with the result, you can press Ctrl+Z to revert the changes.
Add-On Hotkey and Settings
-
Accessing the Tool:
The addon is accessed through the UV tab in the 3D Viewport's sidebar.
There are no default hotkeys assigned; interaction is through the UI panel.
-
Customizing Preferences:
You can adjust default values for thresholds and scale factors in the addon preferences.
Tweak settings to match your workflow and project requirements.
Feedback and Support
-
Bug Reports:
If you encounter any issues or bugs, please report them to my mail: haller.samuel0@gmail.com
Provide a detailed description of the problem and steps to reproduce it.
Including screenshots or sample
.blend
files can help in diagnosing the issue.
-
Feature Requests:
Suggestions for new features or improvements are welcome.
Share your ideas on the mailadress mentioned before.
While development time is limited, all suggestions will be considered.
Known Issues / Limitations
-
Modifier Stack:
In Edit Mode, the tool operates on the original mesh data without modifiers.
Consider applying modifiers if you want them to affect the UV calculations.
-
Single Object Processing:
Currently, the addon operates on one object at a time. Ensure that only the desired object is selected when running the addon.