A collection of scripts I have written for CG-related work
This script converts a set of green
(2 channel) normal maps, as often used in games, as PNG images into blue
(3 channel) normal maps. It calculates the blue channel using the provided formula: blue_channel = sqrt(1 - clamp(red_channel^2 + green_channel^2))
.
- Python 3.x
- Python Imaging Library (PIL) package (pip install Pillow)
- Place the script in the same directory where your PNG images are located.
- Run the script.
- The script will create a new folder called
output
and place the converted normal maps in there.
This script removes duplicate image nodes from the node tree of all materials. It does this by comparing the names of the nodes and removing the duplicates.
- Blender 2.8x
- Put the script in the
scripts/addons
folder of your Blender installation. - Enable the addon in the preferences.
- It can then be found under
File > Clean Up > Node Uniqueizer
.
This script is quite specific to the unpacked game files of The Last Of Us 2. It reads in the .ascii
files spit out by the map extractor created by daemon1. I modified it such that it doesn't create a material for each mesh / submesh (which can result in thousands of duplicated materials and image nodes), but creates a single file for each shader, for which it reads in all texture files referenced in the .ascii
.
- Blender 2.8x
- Put the script in the
scripts/addons
folder of your Blender installation. - Enable the addon in the preferences.
- It can then be found under
File > Import > ASCII (.ascii)
.