Hello,
I wrote a simple geometry shader that draws multiple instances of a model (in this case Ralph…), and I am getting this error when outputting more than twenty Ralph:
gp4gp: error: too many total output components.
Is it related to the Cg profile (gp4gp), or am I doing something wrong?
btw I’m seeing a setInstanceCount in the ShaderAttrib class as well - could really somebody put up a quick working snip to enjoy us? this is quite an interesting topic
I am not following at all… Mostly because I can’t find any decent online documentation about cg geometry shader and true instancing (I am not referring to panda3D docs).
So my guess at the moment is: are you calling n times for each vertex the shaders, where n is the number of instances? And if my guess is correct, how do you render one vertex multiple times drawing it once? As far as I know the geometry shader is the only one supposed to do this.
INSTANCEID is a Cg semantic. It should have been covered in the documentation, but it isn’t.
As my blog post states, you call setInstanceCount(n) once. This means that the vertex shader is executed n times, every time passing a different value for the varying integer assigned to INSTANCEID. Based on that, you can do different behavior based on different instances.
Use the gl_InstanceID or gl_InstanceIDARB (I’m not sure which) variable. This is not really a Panda3D-related question, though - I’m sure there are lots of resources on the Internet about this.