A error when using custom block in NME Editor

The error happens in my custom function SampleTextureCube11, but I can’t figure it out why.
Here is the NME: Babylon.js Node Material Editor

Adding @Evgeni_Popov who knows way more about NME than me

The ImageSource block does not currently handle samplerCube, only sampler2D and sampler2DArray.

You can create an issue in the github repo so that we can keep track of it.

Still have error after replacing samplerCube with sampler2D:https://nme.babylonjs.com/#RGGE6V#1

texture2D uses a 2D coordinate vector for the sampling:

void SampleTextureCube11(vec3 direction, sampler2D textureSampler, out vec4 result) {
   result = texture2D(textureSampler, normalize(direction) );

normalize(direction) is a 3D vector.

Got it. I’ve added some codes to handle samplerCube, and it runs well in my branch. I want to contribute my codes. Is it the correct way to make a PR directly to master or other feature branch? BTW I run npm run test locally and there are some failed cases, but it seems not related to the part I’ve changed.

I usually create a branch with all the modifications linked to a PR. This way, it’s easier to manage, especially when you have several PRs in progress!

Then you can create a PR from this branch: after uploading your changes to your forked repo, if you browse your repo in Github, you’ll see that it offers to create a new PR from the changes.