Passing attribute inputs directly to fragment shader?


I know that attributes might not be related directly to fragment shader but come on… if shader nodes are meant to make life easier, would’nt it be possible to avoid passing an attribute to the vertex shader to have the fragment shader deal with it ?

might not be part of glsl specification, but what a pain…

ex : “Cannot have an attribute as input in a fragment shaderAmbientLightColor”

here AmbientLightColor has nothing to do with vertex shader but I gonna have to add the definition in
the shader node to avoid that error message

this is just ludicrous…

talking about that, I love shader nodes but

  • I humbly think the definitions are really redundant and so propne to errors and waste of time
  • everytime I use a shader node in a material file, I have to redefine its in/out mappings, but, in some case mappings are always the same no matter the usage

any advice/oppinion is welcome


Shader nodes generate shaders. Attributes are vertex shader inputs. If you want to pass data to your fragment shader you have to use a varying.

Also as said in the other post AmbientLightColor is a world material parameter and not attribute.
nothing forbids you to pass them directly to the frag shader.

Attributes are parameters defined for each vertex (inPosition, inNormal, etc…). How the system would be supposed to pass them directly to the frag shader?

The shader node system needs enhancement, especially the editor. I’ll work on it eventually, but your help is welcome.

yes I understand, it’s a wip…
just that @input @output is realy annoying, every time you add a variable… :slight_smile:

oooh, there is indeed no LightPosition in the Attr realm
my mistake :stuck_out_tongue:

strange the compiler does not complain about