Shader modifiers - Custom global functions not working

My shader.frag file is not working with functions like "multiply".

float time = u_time; 
float multiply(float n) { 
return n*2.0; 
}; 
vec3 color = vec3(1.0,0.0,0.0); 
_surface.diffuse = vec4( color, 1.0 );


if I remove the multiply function everything works fine. According to the documentation of SCNShadable this should be possible, shouldn't it? It doesn't work with the method described in the SCNShadable docu. https://developer.apple.com/documentation/scenekit/scnshadable


What am I doing wrong? Thank you.

Answered by franhu in 258761022
Accepted Answer
Shader modifiers - Custom global functions not working
 
 
Q