Unsolved Qt3D shader graph with uniform int array
-
To be able to color clicks on a 3D surface I'd like to pass a uniform vec3 array containing the clicks and one containing the colors to a shader graph but don't know how to do so. Taking from
QShaderLanguage
it doesn't look like arrays are supported out of the box. I cheated a bit and created a new node like so:{ "uuid": "{00000000-0000-0000-0000-000000000027}", "type": "input", "parameters": { "name": "colors[10]", "qualifier": { "type": "QShaderLanguage::StorageQualifier", "value": "QShaderLanguage::Uniform" }, "type": { "type": "QShaderLanguage::VariableType", "value": "QShaderLanguage::Vec3" } } },
The problem is that I don't get anything rendered, only when I remove the
[10]
part from the nodes, the respective edges and my custom prototype (which is supposed to color the clicks). There aren't any errors it's just that nothing gets drawn. There are more details in my stackoverflow question.I have figured out one configuration which raises a shader compilation error which outputs the faulty shader code:
... [I removed the uninteresting part] #line 11 uniform vec3 clicks[10]; uniform vec3 colors[10]; vec4 renderClicks(vec3 clicks[10], vec3 colors[10], vec4 currentColor) { return currentColor; } #line 15 out vec4 fragColor; void main() { fragColor = (((renderClicks(clicks[10], colors[10], (((((((phongFunction(ka, kd, ks, shininess, worldPosition, normalize(((eyePosition - worldPosition))), normalize(worldNormal))))))))))))); }
The problem is obviously that the name of the nodes are
clicks[10]
andcolors[10]
which get plugged into the function.Is there any way to to use a uniform vec3 array properly in a shader graph? Or do I have to fall back to e.g. using a
Texture1D
which I manually populate with the clicks and colors?