- Home /
Modifying textures like TextureImporter does with normal maps importer, but run a custom shader
I was wandering if it is possible to create a tool that runs a texture through some custom shader and saves it in a new one, in the editor.
Pretty much like unity can make a normal map from a height map.
Right now I'm reading the information from a texture at runtime and converting a height map with my fragment shader to UV offsets and applying the results. This does not need to be done at runtime so I want a solution to bake the results into a texture.
Answer by Marino86 · Nov 23, 2013 at 12:14 PM
I solved it myself by inheriting the AssetPostProcessor and overwriting the texturePostProcessor for a particular folder.
class DuDvGenerator : AssetPostprocessor {
void OnPostprocessTexture ( Texture2D texture ) {
// Modify Texture here and apply.
}
}
Note that this script must be under a folder called "Editor".
Your answer

Follow this Question
Related Questions
Baked textures effected by main color 0 Answers
Crash on Bake Selected 0 Answers
Show texture (image box) in inspector with custom editor [C#]? 3 Answers
Lightmapping takes long time 1 Answer
Baking data and move project 1 Answer