Skip to content

Shader Compilation Error #16

@lnorton89

Description

@lnorton89

I'm trying to automate some parameters and I'm having trouble figuring out my issue. I'm getting shader compilation errors when overriding keyvar[3] with with the converted output of my generator. I'm editing the infinite_spheres fractal and trying to automate the first parameter in color:

obj.add(Sphere(0.5, (1.0, 1.0, 1.0), color=('3',0.9,0.5)))

These are the differences in frag_gen.glsl between working and non working:

*****
frag_gen.glsl
        newCol = vec4(vec3(_3,0.9,0.5), de_sphere(p - vec4(vec3(1.0,1.0,1.0), 0), 0.5));
***** 
frag_gen.glsl.broken
        newCol = vec4(vec3(0.9,0.9,0.5), de_sphere(p - vec4(vec3(1.0,1.0,1.0), 0), 0.5));
*****

As you can see the first argument in vec3() is _3 but I'm not sure why. This is how I'm overriding keyvars[3]:

  def rangeMap(x, in_min, in_max, out_min, out_max):
     return (x-in_min) * (out_max-out_min) / (in_max-in_min) + out_min

  sine = float(-1 * math.sin(step) * 2)
  keyvars[3] = rangeMap(sine, -2, 2, 0.2, 0.9)

My first thought was some sort of type error but I've tried removing the float on the sine variable as well as several other type conversions with no luck. Any ideas?

Thanks for the cool fractals!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions