material-maker icon indicating copy to clipboard operation
material-maker copied to clipboard

Add improved normal2height node

Open Qendolin opened this issue 10 months ago • 5 comments

Add my normal2height node to the base library. The default node works fine for very simple geometric shapes, but for real normal maps it produces very strong streaking artifacts. This improved node is based on Materialize's height from normal generator.

Probably the sampling sequence and performance can still be improved. But it's not bad. Also I haven't done any spell checking. I'll keep this as a draft until initial feedback.

Normals Simple Improved Reference
normal_to_height_compare_normal_map_convert_2_map normal_to_height_compare__3_old normal_to_height_compare__5_new N/A
normal_to_height_compare_normal_map_convert_2_roof_normal normal_to_height_compare__4_roof_old normal_to_height_compare__5_roof_new normal_to_height_compare__7_roof_ref
normal_to_height_compare_normal_map_convert_2_window_normal normal_to_height_compare__3_window_old normal_to_height_compare__5_window_new normal_to_height_compare__7_window_ref

Qendolin avatar Feb 12 '25 13:02 Qendolin

I'm not really sure if it makes sense to keep the existing, simple node

Qendolin avatar Feb 13 '25 18:02 Qendolin

I should note that the strength and base height parameters don't work exactly like in the existing node. It's just a simple value * strength + base

Qendolin avatar Feb 13 '25 19:02 Qendolin

One issue I've found is that high sample counts (4k or more) often result in crashes with textures above 512 resolution. However this is more of an issue with MM than this node in particular. If Iterate Buffers exposed the iteration number, I could use them to spread the calculation across multiple invocations and the crash could likely be avoided.

Qendolin avatar Feb 13 '25 20:02 Qendolin

I have a version in the works that uses an iterate buffer. That makes it more stable. And I've improved the quality further. Future Work (not in this PR): See how awesome bump does it.

Qendolin avatar Feb 16 '25 01:02 Qendolin

From my side this PR is done

Qendolin avatar Mar 05 '25 22:03 Qendolin