Some news. I’ve commented almost everything out in the code and started uncommenting things until I get a slowdown. And I did. Here’s where:
colStage = TextureStage("col")
colStage.setMode(TextureStage.MModulate) self.decal.setTexture(colStage, tex)
If I do it this way, I get ~450 frames for a scene composed of 1 base model and 25 decals (being copies of the base model with no clipping planes assigned ATM). If I add a normal map stage to it, it drops further, oscillating around 350 and 400 frames.
However, if I do this instead:
I get ~750 frames for the same scene.
Adding normal map to the second variant hinders performance to ~400 frames again.
Can anyone help me on this? Is there something I missed from the manual about texturing?
After further experimenting on the setTexture(tex, 0) variant, I got more interesting results. As I said, the performance for 25 decals, one texture and no clip planes for this variant is 750 frames.
But after adding clip planes, it went down to 350 frames. Quite surprising considering what they’re supposed to do… I guess they cause shader recreation in every frame.
I’ve also experimented with Transparency, which I’ve initially disabled for testing. Obviously, it also causes loss in performance, but in a different way.
In all other cases (using new texture stage and/or using clip planes), the framerate drops to this 350-450 frames and stays there, no matter what. In case of transparency, if I enable it when using setTexture(tex, 0), the framerate drops only when all 25 geoms are visible (for instance, when looking down on the whole stack), but when I move the camera so the objects are out of the view frustum or just hidden by backface culling, the framerate goes back up to ~800 frames. With new texture stage and/or clip planes, it doesn’t.
This is all the information I’ve gathered so far. I’ll be very very grateful if anyone can help me on this. Thanks.