GLSL compilation error

Hi There!

I’m using an adapted Shadertoy GLSL and I keep getting what seems to be a straightforward compilation error:
ERROR: /container2/project1/glsl2_pixel:10: ‘’ : syntax error, unexpected FLOATCONSTANT, expecting COMMA or SEMICOLON

I’ve tried putting the code into a new node and messing with the syntax and overall code a little, even the math:

const float F3 = 1.0 / 3.0;
const float G3 = 1.0 / 6.0;

No luck. Thoughts?
Code below


uniform vec3 iResolution;
uniform float iTime;

const vec3 inkColor = vec3(0.01, 0.01, 0.1);
const vec3 paperColor = vec3(1.0, 0.98, 0.94);

const float speed = 0.0075;
const float shadeContrast = 0.55;

const float F3 = 0.3333333;
const float G3 = 0.1666667;

vec3 random3(vec3 c) {
    float j = 4096.0 * sin(dot(c, vec3(17.0, 59.4, 15.0)));
    vec3 r;
    r.z = fract(512.0 * j);
    j *= 0.125;
    r.x = fract(512.0 * j);
    j *= 0.125;
    r.y = fract(512.0 * j);
    return r - 0.5;
}

// ... (rest of the shader code)

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = 1.0 - fragCoord/iResolution.xy;
    vec2 coord = 1.0 - uv * 2.0;
    uv.x = 1.0 - abs(1.0 - uv.x * 2.0);
    vec3 p = vec3(uv, iTime * speed);

    float blot = fbm(p * 3.0 + 8.0);
    float shade = fbm(p * 2.0 + 16.0);

    blot = (blot + (sqrt(uv.x) - abs(0.5 - uv.y)));
    blot = smoothstep(0.65, 0.71, blot) * max(1.0 - shade * shadeContrast, 0.0);

    fragColor = vec4(mix(paperColor, inkColor, blot), 1.0);
    fragColor.rgb *= 1.0 - pow(max(length(coord) - 0.5, 0.0), 5.0);
}

void main()
{
    vec2 fragCoord = iResolution.xy * (gl_FragCoord.xy / iResolution.xy);
    vec4 fragColor;

    mainImage(fragColor, fragCoord);
    gl_FragColor = fragColor;
}

Hi there,

It looks like F3 and G3 are constants that perhaps TouchDesigner is already declaring. It seems to happen with F[2-4] and G[2-4]. Not when using lowercase letters or a different letter. Perhaps Derivative knows better what’s happening? :slight_smile:
To make it work now, you could change the name of the variable. ‘f3’ and ‘g3’ for example.

Cheers,
Tim

Thank you! It seems there were a couple variables that weren’t passing things along. I appreciate the help!