[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