Procedural generated height map not working with code-based node material?

I’m attempting to generate a terrain, but I’m facing difficulties in doing so.
The procedural generated height map passed to code-based node material is not incorporating plane elevation in the code. Am I missing something?

(Node material code starts at line 107 and ends at line 554. At line number 591, nodeMaterial is set to the current material of the ground.
ground.material = nodeMaterial;)

The elevation functions properly in the Node Material Editor (Babylon.js Node Material Editor), but inexplicably, it fails to work in the code.

Hi @SNM and welcome to the forum

It’s a bit difficult to follow what the code does :slight_smile: 700LoC is a bit long. Did you try to load the shader .json or a snippet and get the block from there instead of using the generated code?

1 Like

I greatly appreciate your response. However, I managed to resolve the issue by decreasing the width and height of the plane (ground mesh) while increasing the subdivision.
I fixed it by setting the width and height to 10 units each and the subdivisions to 200.

BABYLON.MeshBuilder.CreateGround("plane", {width: 10, height: 10, subdivisions: 200}, scene);

Thanks once again. Thank you very much for replying back.:slight_smile:

1 Like