Add an import option to correct a heightmap texture's baseline or normalize it#100226
Add an import option to correct a heightmap texture's baseline or normalize it#100226Calinou wants to merge 1 commit into
Conversation
5bf47cd to
57bbd9f
Compare
57bbd9f to
480dc44
Compare
480dc44 to
861eb4a
Compare
|
Do you need asset pipeline team approval or rendering team for this? |
|
Both. |
|
While I can understand the rationale behind this, I'm concerned this touches a lot of the rendering, and ti adds an hint, hint height, which does operations on a texture and changes a texture type. The most common usage for height maps imo is not parallax but generic heightmaps to displace mesh vertices. If this feature is specifically for parallax, it should be called parallax and not generic height. I would like to understand a bit more the demand for the feature. I know it's common for engine devs to talk to devs behind the scenes and bring forth their proposal, but I don't see this as a common usecase to warrant the added complexity. Of course what I see is partial and I'm happy to be corrected :) I wonder whether fixing textures from polyheaven is what we should be looking at. We should probably look into quixel's library and talk with rodzilla, material maker's author, and see how this work with substance painter textures. Chances are polyheaven is not our largest userbase. |
…malize it Automatic detection is implemented in the BaseMaterial3D shader. It can be integrated in custom shaders by adding `hint_height` to the relevant sampler uniforms or setting the texture mode to Height Map in VisualShaderNodeTextureParameter. When a texture is detected to be used as a heightmap, it'll switch to the Correct Baseline mode automatically, which reduces parallax issues without requiring manual adjustments to the heightmap scale. If you want to further improve quality (or reduce the number of deep parallax steps without impacting quality), you can use the Normalized mode which requires adjusting the heightmap scale used in the material. When doing so, the required heightmap scale multiplier is printed on import so you can get the same effective heightmap scale as before.
861eb4a to
1ef48c8
Compare
This feature is meant to work with Godot's own parallax mapping specifically, rather than terrain textures imported as heightmaps. I suppose I could rename the hint to
This PR works with any texture source, but some sources are more impacted by this issue than others. However, like many things in 3D art, the problem this PR resolves is a difficult thing to initially become aware of. I've seen many reports of poor parallax mapping quality with users not knowing why their POM materials don't look as good as it could, or users increasing the deep parallax layer count to 64 (which is very expensive), while they could just have modified the heightmap texture instead to improve quality. Speaking of experience, it took me several years to realize that stretching the range of the heightmap texture improves parallax quality and ensures the material doesn't distort more than needed when the camera moves. While the documentation already mentions this subject briefly, we could further improve the documentation to show some examples of good parallax maps. We could also document how to correct existing suboptimal parallax maps (possibly using an ImageMagick command - I couldn't figure out a one-stop way to do it in GIMP). |
and Rework BaseMaterial3D deep parallax implementation and add new features #97646.
Automatic detection is implemented in the BaseMaterial3D shader. It can be integrated in custom shaders by adding
hint_heightto the relevant sampler uniforms or setting the texture mode to Height Map in VisualShaderNodeTextureParameter.When a texture is detected to be used as a heightmap, it'll switch to the Correct Baseline mode automatically, which reduces parallax issues without requiring manual adjustments to the heightmap scale.
If you want to further improve quality (or reduce the number of deep parallax steps without impacting quality), you can use the Normalized mode which requires adjusting the heightmap scale used in the material. When doing so, the required heightmap scale multiplier is printed on import so you can get the same effective heightmap scale as before.
Testing project: test_texture_heightmap.zip
Preview
Watch in fullscreen to better spot the differences.
Disabled vs Correct Baseline
Left: Disabled, Right: Correct Baseline
Notice how there's less visible "warping" on the right as the camera moves.
disabled_vs_correct_baseline.mp4
Correct Baseline vs Normalized
Left: Correct Baseline, Right: Normalized
Pause the video in front of the bricks; notice how there are fewer stairstepping artifacts on the right.
correct_baseline_vs_normalized.mp4