Cool. How do I get some instance specific value (such as the index of the currently rendering instance) in the shader? This does not appear to be documented anywhere I can find, and without it, hardware instancing is useless. I’m using cg shaders by the way. Mainly I just want the name of the shader input, and any semantic if one is needed.
You can just bind an arbitrary integer scalar input that is ignored by Panda (e.g. l_ or o_) to the INSTANCEID semantic. The gp4vp documentation is supposed to cover it, but it doesn’t, unfortunately.
It’s not a Panda-specific input, so it doesn’t go into the list of possible Cg shader inputs. Also, setInstanceCount is entirely unrelated to the shader mechanism (even though its on ShaderAttrib), so documenting it there would be inappropriate.
I’ve been hearing that recently. I’m looking forward to it!
rdb, with that I’m getting:
error C5108: unknown semantics “INSTANCEID”
I have a NVIDIA GeForce 9600M GT card, which I believe should support instancing, but the error implies otherwise. Odd. Perhaps a driver issue? I’m on OSX 10.5 btw. I can try upgrading to 10.6. My other OS installs are in virtual machines with questionable graphics support, so they are not of much help here.
Any suggestions?
You need to compile the shader under a recent profile. For starters, set “basic-shaders-only #f” in your Config.prc. If that still doesn’t work, you might need to add a “//Cg profile gp4vp” (or so) line.
I’m already using basic-shaders-only #f, and adding a “//Cg profile gp4vp” line has no effect on my shader. Is there a special place I’m suppose to put said line?
I still get the: error C5108: unknown semantics “INSTANCEID”
It must be failing to use the correct profile somehow, or the profile is somehow broken for me.