PFX newbie question

I modified the IntroducingPOD training project. My meshes load fine, and after merging code, which came from both the Shaders example and the IntroducingPFX examples, I now have an effect being applied. The problem is…



I have several materials in my scene, but only one (keep it simple) has an effect applied. I can’t figure out why all of the meshes are rendered with the one material that has the effect applied, not their assigned material. The cardboard boxes are rendered with the car material (and the effect). The floor is also rendered with the car material and effect.



Am I supposed to define all of the textures/materials for my 40+ meshes in the effect file, like the MagicLantern training course? By the way, the MagicLantern training course is the only training course that I’ve found so far that uses multiple meshes (from a POD) along with an effect. I read the PFX reference document (1.7) and I’m still not clear how to handle this scenario. When I do add another effect, what is the best practice? That is, Do I use one PFX file, like MagicLantern, or do I use multiple, like the Shader example?



Thanks for your help.

Hi Blamejane.

It’s really up to you whether you use multiple PFX or multiple effect blocks inside a single PFX. It would probably be more efficient to use just a single PFX as there’s less parsing, but it’s really up to the developer.



You’re correct that MagicLantern is probably the best training course for you to take a look at in this instance, although as you’ve noted it uses only a single PFX rather than multiple.



If you open your POD file in PVRShaman, does it have the same effect as your scene (i.e all objects have the same effect)? The POD format allows assigning material per mesh, so it’s possible to do. Remember that you’ll have to define your own shaders for the meshes that you don’t want to have a PFX applied. Is it possible that you’ve called CPVRTPFXEffect::Activate() and haven’t deactivated this via glUseProgram(x)?



Hope this helps.

Hi Arron, thanks for you support.



When I open in PVRShaman, everything looks great. That is, I have various textures applied to my meshes, and one mesh has the effect applied. So I must be doing something wrong programmatically; thanks for the tip. It IS possible that I have called CPVRTPFXEffect::Activate() without deactivating. Didn’t even occur to me d’oh!



I’m gonna check into that and read up a little more. Again, thanks very much for the hint/direction, that’s what I was hoping for.