How to create a procedural voronoi texture in code (not in nme)?

similar to this example, how do i make a voronoi texture (need to use it to move some vertices around but too difficult to do in nme so will do in normal code, just need to find a way to input position and get respective voronoi noise output, or even a lookup texture array)

How familiar are you with shadercode? Are you doing it on a mesh or a texture (3d or 2d)?

This is family easy just need to know what your end goal is.

It’s easier to do dynamic textures then shader materials, but the shader code is quite similar each way, it’s just the implementation is different. (You can even mix the two)

Probably this link may be helpful - Babylon.js/voronoiNoiseBlock.ts at fdbf393d1d7699dc7cc69cec1dca0819ebd2622a · BabylonJS/Babylon.js · GitHub

i know how to work with node trees but i dont know shadercode at all. My end goal is to input many vectors into a function or a object and get respective voronoi texture value at that location/pixel.

I think @Cedric had an amazing implementation ? but not sure if I recall correctly

You could also look into our voronoi block to extract the shader part you need ?

I used Voronoi for mesh destruction but it was not 2D.
Looking at implementation in the block or on is a good start I start.

1 Like

I saw it but im confused, which language is all the shader code written in?

GLSL language.
Some docs are here - Introduction to Shaders | Babylon.js Documentation