nodeGeometry connector error and a question on mapping height

I’ll prefix this by saying that I am pretty new to Babylon and 3D modeling so please feel free to direct me to further reading as I’m sure this has been covered before.

I have been playing around with the node geometry and have a stylistic planet model which can be viewed here.

My first questions is about line 142, when uncommented it creates an error and I’m not 100% sure where I am going wrong as it works in NGE without issue.

seg.output.connectTo(ground.segments);

My second is about the white to black gradient I have, I was hoping to get a smooth increase from white to black as the height increases which I can then to link through to a node material later, however I’m struggling to map this correctly as most examples I have seen online work with a flat plane.

Any assistance is greatly appreciated.

Hello and welcome! :grin:

It looks like the output of seg is of type geometry, while the input of segments should be an int, so it’s weird they work on NGE at all… do you have the link to the material in NGE itself?

About your second question, I’ll ping @PatrickRyan who is an expert in Node Geometry :slight_smile:

1 Like

Thank you for the reply.

I used the generate code button on NGE itself, perhaps this is where the issue lies as when I saved as JSON and used the JSON parse to create the node geometry it worked as expected.

I created a playground with the node geometry loading from JSON here:

Here is the NGE

Oh, I was mistaken, I’m sorry! I had taken GeometryInputBlock to mean the output is a geometry, but this is the general input block, so it should be connecting with the segments input. Let me investigate further.

1 Like

I see what’s happening :slight_smile: There’s an issue with automatic type detection when connecting the blocks, it goes away if you explicitly define the type of seg: Planet Height. | Babylon.js Playground (babylonjs.com). I’ll work on a fix for the auto detection too.

1 Like

I see, are there benefits to explicitly declaring the type like this?

Thank you for your help with the automatic type detection issues.

I have managed to do what i was looking for with a node material instead of a node geometry.

Glad that NME worked for you! In any case, I pushed a fix to the code generation here: Fix code generation in GeometryInputBlock. by carolhmj · Pull Request #14600 · BabylonJS/Babylon.js (github.com) so it doesn’t happen again.

2 Likes