Help with Flexible GLSL Shader for Multiple Gradients and Meshes

Hi everyone,

I’m working on a GLSL Gradient shader and I need some advice on making it more flexible and user-friendly. My goal is to allow the shader to handle multiple gradients and, ideally, be capable of rendering multiple meshes. But here my luck end, and the shaders doesn’t render anything, but also no error to point me in the right direction.

I’ve been able to get the shader to work with a two gradients (hardcode). Currently, it can handle a single or two gradients a few gradient types (Linear and Radial) . It can compute gradients between specified start and end points, apply falloff effects, and blend colors using several blend modes. Pretty nice if i say so myself ;), I’ve include that code in the attached file (38.7 KB)

on the left, the working gradients, with at the 4 corner points a assigned color. The one on the right … well… obviously it doesn’t render


  1. But I’m running into issues when trying to extend it to handle multiple gradients (as in a combined list of start and end Points, Colors and Radii) . I’ve include my attempt in the attached gh file
  2. Additionally, I would like to enable grafted input so that one shader node can render multiple meshes with different gradient settings. This will surely optimize things and make it scalable and user friendly

Why ?

Methods like SprayMesh or ConstructMesh i’ve tried, but either offer less control and require extremely high-resolution meshes to avoid visible faces, which is not practical. I don’t need to bake the mesh, i’ve print the result, so shaders are fine.

PS: @stevebaer @nathanletwory why do I need to ‘preview’ a mesh node (doesn’t matter which one) in order to show the rendered Shader gardient?

There are few gradient samples I wrote as the ghgl samples. They can be found at