[NME]Is it possible to make a node chain that works as textureLod function?

I found a shader from shadertoy and want to convert it with NME, but i stucked when reaching this code line: textureLod(iChannel0, vec3(1.,1.,1.), 0.0), because there are no textureLod like nodes to use.

So i am wondering, is it possible to make a node chain with other advanced nodes that works like textureLod function?
An NME PG will be so helpful.

Can you show us the original shader on shadertoy? It would help us understand what is the effect the code wants to achieve. But from just looking at the line, the LOD isn’t even necessary, because a LOD of 0 is the same as the default texture.

Ok, there it is:Shader - Shadertoy BETA

Yeah, no need to use textureLod there with zero LOD, it’s equivalent to texture. I forked the shader just to show you can swap the two functions for the same effect: Fork Noise plas carolhmj 150 (shadertoy.com) (check line 3)

1 Like

It is only equivalent if do not set and mip interpolation on the texture.

Thanks.
In my case, the LOD parameter is not such important, texture function is enough.
But i also have other problems:

  1. Texture function need a vec3 parameter, but texture node only accept vec2(uv)
  2. How can i get the noise texture’s size(code line 13)?

There is my NME demo: Babylon.js Node Material Editor

I do not think we are supporting texture 3d or layered in nme so far. @Evgeni_Popov could you confirm ?

The 3d texture is only for the noise usage, or you pro guys have other solutions to get this effect?

Yeah, it’s only for noise.

No, we don’t support regular 3D textures, only reflection textures for which you can load a texture as a cube texture. But the lookup will be dependent on position/normal/world matrix, you can’t pass a straight Vector3 for the lookup.

There are plenty of shader code for noise functions on the Net, for eg: GLSL Noise Algorithms · GitHub

Note that it may be easier to use those functions once we add custom blocks to the NME (which should happen in the coming days) which will let you use custom glsl code directly.

1 Like

Ok, i`ll try your suggestion.
And the custom blocks will be awesome!

1 Like

Hi @kikoshoung just checking in, how’s your NME going? Anything we can do to help? :grinning_face_with_smiling_eyes:

Note that CustomBlock is now in:

3 Likes

Amazing !!!

Thank you all! @carolhmj @Evgeni_Popov @sebavan
I’ll try the CustomBlock feature in this week!
To implement a beautiful and random enough effect with pure NME blocks is hard(in this case), because i need to convert the complex noise code to blocks, it’s a huge work.
But this, is the best solution, absolutely!

1 Like

Here is my effect PG: https://nme.babylonjs.com/#VCA23P#3
image

Problem resolved.
Thanks again!

3 Likes