Derivative Map from Height Maps
source link: https://github.com/justinmeiners/derivative-map-tool
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
Derivative Map from Height Maps
A command line tool for computing derivative maps from height maps. Despite lots of articles describing the process, I couldn't find an actual tool to do it. The idea for how it should work is obvious, but there are some gotchas to get it to match standard tools, such as normalizing the range of derivatives, and using the Sobel Operator to compute higher quality derivatives.
No dependencies required besides standard library.
About Derivative Maps
Derivative maps are a bump mapping alternative to tangent space normal or height maps. The key advantage is that it uses screen space derivatives so you don't need to compute and store model tangent space.
See Rory, Whigham, Mikkelsen 1 and Mikkelsen 2. Blender was also a helpful reference.
Compression
If you are planning to use DXT compression, I recommend following general guidelines as those for normal maps. DXT 1 typically is very poor, especially if you want to pack another map in the other channel you will get cross channel compression. I got good results using DXT 5 with roughness in alpha, derivative in red and green, and leaving the blue empty. See Waveren (PDF) for an in-depth discussion.
LICENSE
GPL 3.0 - It's intended to be used as a tool in your pipeline, or as a reference to write code under your own license. If it is helpful to you either way, I would appreciate a citation, although this is not required.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK