NodeMaterial - Radial Gradient

Hi All, Looking to create a radial gradient from the origin of a mesh (plane) to its outer boundary, with control via a color gradient node. Struggling to know where to start though, so any pointers would be really appreciated. Not been able to find anything similar on the forums and through searching.

Thanks!

Have made some progress with this: https://nme.babylonjs.com/#6V3181#1

It’s reliant on the mesh UV, but not sure there is a cleaner way?

That seems good to me! You can simplify it a bit, however:

https://nme.babylonjs.com/#6V3181#2

It depends on what you want the gradient to be centered on. You could also use the mesh.position to compute the input for the gradient if you want the circular gradient to be centered on the local (0,0,0) of the mesh (see link above).

1 Like

Ah! “Length” was the missing piece - thank you!