YertleTurtleGit / depth-from-normals

Estimates a depth mapping from a given normal mapping.
https://colab.research.google.com/github/YertleTurtleGit/depth-from-normals/blob/main/README.ipynb
GNU General Public License v3.0
70 stars 3 forks source link

"estimate_height_map" produces non-tileable height map from tileable normal map source #3

Open Solstice245 opened 2 months ago

Solstice245 commented 2 months ago

I used this script to get a height map from a texture I was working with and noticed that the resulting height map was not tiling correctly, and so I had to spend some time manually fixing the height map to make sure it tiles smoothly. If this could be fixed, I would find much more use for this, and I imagine others would appreciate it as well.

If you would like, I could attach a sample normal map where I observed this problem.

Solstice245 commented 2 months ago

Attempted to tile the input normal map 3x3 to see if I can crop out the middle and get a tileable result. The original normal map being 1024*1024, this operation was run on a 3072*3072 image. I noted during the execution that memory usage went up to almost 50GB, with overall memory usage on my PC going up to 98%.

This "trick" did NOT achieve the desired effect, if case you were wondering. The resulting height (in both cases I've run) seems "slanted" with the bottom left being lower, and the top right being much higher.

YertleTurtleGit commented 1 month ago

Hey @Solstice245 thanks for pointing that out. A small test normal map would be great. I thought I might fixed the issue with the latest changes, but that's probably not the case as far as I can see. For the meantime or in general, maybe that helps: https://github.com/EmbarkStudios/texture-synthesis?tab=readme-ov-file#api---07_tiling_texture