I’m not sure if this is bug or not but seems like it.
I’m not able to add multiple Color inputs to a
shader image generator. Steps to see this problem is go to
> file > new shader > image generator then click on
> + new port and select a
Color from the list. Then go to add a second
Color1 by clicking on
> + new port again and the second variable
Color1 overwrites the first variable
Color. Then try to add
> + new port again select
Real and this will overwrite the
Im not sure if this is by design or not but the compiler says something to the effect of their being a re declaration of
Color or what ever you name the variable. I have tried by assigning the input to variable and without and still get the same behavior.
It also happens with all other port types . every time you add a new variable uniform by clicking
> + new port it will erase whatever variable is already there and replace it with the new one. this happens when the shader is untitled. once I save it the library
Modules and then use the shader inside a composition like a subcomp and then edit the shader from the
Modules folder Im able to get multiple
Real float types for variables to work but not multiple colors.
What am I doing wrong ? I think it should be possible to add multiple inputs to an untitled blank shader.
Yeah, that one is no fun. Workaround: https://community.vuo.org/t/-/6872
well I tried the workaround and wasn’t able to get it to work with colors. now it seems my shader file is corrupt and Vuo is asking me to move it to the trash. I’m getting this error and I don’t even have a
Color1 variable in the file anymore.
Error compiling ISF node class /Users/dust/Library/Application Support/Vuo/Modules/dust.shader.fbm.fs:
Failed to parse shader — Regular non-array variable ‘Color1’ may not be redeclared (Vertex)
I tried using the variable names in the code before I published the ports and that didn’t work for the colors. I’m thinking maybe another workaround would be to open the shader in an external editor and manually add the uniforms to JSON blob at the top of the ISF file ? then try and open it in Vuo.
@jstrecker or @MartinusMagneson should weigh in on this. I did get colors to work but I don’t remember the details, shaders are not an every day thing for me. Probably something to do with the order in which things were added. I messed around a little with the JSON blob just like you mention but I think it ended up unnecessary?
well I have the book of shaders GLSL preview and Shader Toy GLSL previews installed as extensions in VS Code and they will let me pick colors in the editor when ever I add vec3 or in the viewer as a uniform input to Shader Toy preview so I can always use that to select the colors if I want.
It’s hard to select colors in RGB just using the numbers. Would be nice to be able to have them as inputs inside Vuo. I should probably just use HSB to RGB shader functions, that seems like an easier way to select colors. Or I could at least publish a float and use that as input to Hue with HSB to change the colors from outside the shader.
Shaders are not an everyday thing for me either but I have recently put in more effort to learn them. I did the book of shaders up until the end. making sure to implement the extra exercises. that book is incomplete and its been a few years now and they haven’t finished it so I supplemented it with some art of code tutorials on youtube for ray marching stuff, which was what I was hoping to learn from the book of shaders but they never completed the chapters on ray marching.
You very well should be able to have color ports in Vuo’s shaders!
Book of Shaders website and Art of Code Youtube channel are awesome resources…
Here’s the test comp where I got color ports to work.
shaderTest.vuo (2.94 KB)
thanks jersmi. to run that shader test you posted it requires the isf filter for me to run it.
Nodes not installed —
Circle Shader (isf.circleShader)
I would like to see a shader with color ports working in vuo. I looked into the JSON blob thing with ISF editor by Vid Vox you posted yesterday. It seems the color is declared of type color with defaults of three values for rgb. in Vuo the color variable is a vec4 with four values, I don’t know if that makes any difference or not. I haven’t got around to trying to edit the JSON blob externally yet.
Ah, sorry, forgot that – here you go. (It’s a very simple shader).
circleShader.fs.zip (1.18 KB)
well simple is good. this showed me it was possible to have color inputs. so I started simple as possible and was able to get multiple color inputs to work. i’m not exactly sure how. my observation with a simple gradient.
vec2 uv = gl_FragCoord.xy / RENDERSIZE.xy ;
vec4 color = mix(inputColor1,inputColor2,uv.x);
color = mix(color,inputColor3,uv.x);
gl_FragColor = color;
write the code and run it, let it error out by telling you that the variables are undeclared. publish the inputs in this case inputColor1, inputColor2, inputColor3. each time you add and publish the color input it will erase and over write the previous input port you published as described above. this looks wrong and acts wrong but soon as you run the code for a second time all three input ports you made will pop up from the dead and became available.
I also found that once your file is corrupted with this error.
Regular non-array variable ‘Color1’ may not be redeclared (Vertex)
that shader file is toast, no matter how many tries you won’t be able to add a color input. simply copy pasting your corrupt code to new file and then publishing the inputs fixes the problem. its a pain if you have lots of inputs but once the the file is corrupted no matter how many times you try you won’t be able to publish color inputs. that’s the reason it wasn’t working for me.
I could see them working in your code but couldn’t figure out why in my code, but it was because my file was corrupted. starting over simple with a gradient shader got me multiple colors inputs to work. i’m not sure why it has to erase and overwrite the inputs before they appear but was able to get the workaround to work finally. thanks