Custom script in node material editor

will be possible in the future to add custom scripts / function in node material editor ?

I think you’re talking about custom blocks? Here’s the documentation for them, I have a few simple blocks that I could post too for more examples if that’s what you’re after. :slight_smile:

2 Likes

This is exactly what i need !!! Thanks sm!!

Right on, here’s some more custom blocks you can check out too for more examples. :slight_smile: :beers:

2 Likes

can we reference a sampler2d or create a block for it?

You can use the Texture block for that. :slight_smile:

hmm not exactly what i needed, noticed in some posts that creating a sampler2d block is not yet implemented, so i had to do a hacky way to reference the sampler2d i needed

Thanks!

ImageSourceBlock should be what you are after.

It can be connected to multiple Texture blocks by their source input.

1 Like

Yes that’s what i ended up using :slightly_smiling_face:

Thanks sm!

Out of curiosity, can you share what you did/how you got it working? Were you able to pass the output from ImageSourceBlock into a custom block?

1 Like

Hello sorry for the late response, so basically you have to create an image source, and in the custom block json create a vec4 with whatever name your texture2d channel is, just make sure that you add “Sampler” to the name inside the texture2D function. Lets say your vec4 texture2d channel is noiseimage, in the texture2D function, re-write noiseimageSampler.

Connect your imageSourceBlock named(noiseimage, can be any name) to a textureBlock, now connect the rgba output to the input node in the custom json block which you already referenced in the custom block json.

Let me know if you have any questions.

Cheers