How can I add a Heightmap to a Meshtexture?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gamemap

In SpatialMaterial I found the Depth section (In Godot 4.0 Height), but I don’t know how to add the image correctly to Godot.
Is a result like this possible?

:bust_in_silhouette: Reply From: klaas

Hi,
this looks like parallax occlusion mapping with some sort of conturing.

https://www.gamedev.net/tutorials/programming/graphics/a-closer-look-at-parallax-occlusion-mapping-r3262/

The conturing is the effect that the contur of the object is cut out from the tecture.

Yes, godot has support for pom in its standard spatial shader and you are free to implement it in a custome shader.
But it has no build in support for that conturing-effect and since godot has no easy access to the render pipeline you can not effectivly build this into a shader (you need a backface depth-prepass for that).

To use pom in the spatial shader goto “Depth” and provide a black and white depth texture. Then enable “Deep parallax”. Your mesh has to provide binormals to work and it does not work in combination with triplanar mapping.

Thanks for your good explanation!

I just found a Godot project by Bastiaan Olij at this Github Pr, which can also help me understand what textures are needed and how to set them up.

Gamemap | 2021-07-07 09:32