Hi!
As the title says, I use some runtime generated bump maps.
I create them in Start(), modify their pixels, and then put them in the materials with SetTexture().
But these maps are not marked as Normal Maps, because that is an Editor feature.
What I need is a kind of “Mark as Normal Map” simulation for runtime use.
Some days ago I did something like this:
- Override TextureImporter settings by creating an AssetPostprocessor subclass, marking by default that texture as Normal Map
- Create the texture to be treated as bump map
- Apply a color conversion with a custom Diffuse2Normal() function
- Save it as a PNG image in Assets/…
- AssetDatabase.Reload();
- Load from AssetDatabase the newly created asset
- Put it in the right material
And that worked well, but it was too slow, worked only in the editor and forced me to save the texture on the hard disk. The problem is that I don’t generate one texture, but dozens.
I want to store the textures in memory, not on the hard disk.
So, I need something working in both editor and build… Just like this:
- Create the texture to be treated as bump map
- Apply a color conversion with a custom Diffuse2Normal() function
- Programatically mark it as Normal Map
- Put it in the right material
I read about a special normal map encoding called DXTnm. I suppose that marking as Normal Map from the editor does this conversion. Maybe reproducing it is the solution?
I’d appreciate any suggestion, thank you! ![]()




