Help please…I am new to writing in the shader language, and have mangaged to mostly do what I want in the shader side, but cannot figure out how to pass a custom array from panda3d…It seems to only accept float4 or matrices or textures. Does anyone know how to pass an array to the shader from python? According to documentation, it seems possible on the shader side.
I don’t think its possible (yet), but I’m not sure.
You can try looking in this thread, which discusses how to pass an array of lights to the shader:
Although I can’t be sure because I’ve mainly dealt with OpenGL/GLSL shaders rather than Panda/Cg shaders, I don’t think arrays will work, especially if you mean variable length arrays.
There are a couple of alternatives though. You can simply pass a large number of normal variables to an array, plus a counter variable. If you need to pass more data than is possible with this method, you can try to pack data into a 1D (or 2D) texture and treat the texture data like an array of values, which requires fairly straightforward conversion of array indices into texture coords in your shader.