Closing in on a model with Lighting.j3md material causes huge fps drop (on a macbook pro)

Hello everyone,

I am observing an unexpected fps drop when simply getting closer and closer to a simple model with the Lighting.j3md material. I have vsync on, and it goes from a steady 59 fps down to even 5 fps if my model covers 80-90% of the screen. The material has a texture which is a .jpeg of size around 400x500 pixels (set on DiffuseMap).

The fps drop does not happen if I use the Unshaded.j3md material.

I am using the latest version of the macbook pro, which has an Intel HD Graphics 3000 with 384MB of DDR3 SDRAM graphics card. I have not yet tested on my Windows computer.

Is there something wrong here? The graphics card performs nicely when playing WoW or Starcraft 2. I will provide more information and code if needed.

Thanks,

-David

Does setting the “VertexLighting” boolean parameter on the material help?

Perfect! Thanks a lot.



Just to clarify to other readers, this is what I did:

[java]myMaterial.setBoolean("VertexLighting", true);[/java]



Momoko_Fan, would you like to explain why this helped?



-David

This helped because it is no longer doing per-pixel lighting. Apparently your graphics pipeline is really sweating hard with what is essentially fairly simple calculations per pixel.



Setting VertexLighting to true makes the vert shader to the lighting calculations on the vertex and it is simply “interpolated” in the fragment shader… ie: the values are stretched across the surface instead of being calculated at the pixel level. For flat surfaces near the camera this will look “worse”.

Really old shader cards generally suffer with this. For example GeForce 5 which is the first OpenGL2 card series, has a lot of performance issues with shaders.

I see. It is really surprising that it has so much problems with per-pixel lighting, but at least I know the remedy now :slight_smile:



Thanks again,

-David