HackerPoet / PySpace

GLSL Fractal Ray Marcher in Python
MIT License
1.15k stars 147 forks source link

Shader Compilation Error #16

Open lnorton89 opened 4 years ago

lnorton89 commented 4 years ago

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!

HackerPoet commented 4 years ago

This is a known issue, the colors don't currently work with variables yet. I'll hopefully push in a fix for this soon.

lnorton89 commented 4 years ago

Thanks for the update. Look forward to seeing your next commits.

lnorton89 commented 3 years ago

This is a known issue, the colors don't currently work with variables yet. I'll hopefully push in a fix for this soon.

I'm assuming this library is dead Since there hasn't been a commit over over a year?

Ayers-Kendall commented 3 years ago

This is a known issue, the colors don't currently work with variables yet. I'll hopefully push in a fix for this soon.

I'm assuming this library is dead Since there hasn't been a commit over over a year?

We could move it elsewhere and try to expand it if you want. I just found this and fixed the recording bug, and plan to expand my version of it to be a bit more generalized for colors and maybe having an initial selection menu as well