Close the object and the frame rate decreases

When my camera pulls close to an object, the scene becomes stuck and the frame rate drops seriously. What is the reason?

It is likely caused by using PBR materials (MeshStandardMaterial / MeshPhysicalMaterial) on that object. These two materials are quite time-consuming to render, so the more pixels¹ on the screen include them - the longer it will take to render the entire screen on each frame.

If possible, for low-end devices consider using MeshLambertMaterial (for rough surfaces) / MeshPhongMaterial (for shiny surfaces) instead of PBR materials. You can also try limiting the amount of lights in the scene.

(¹ - or “fragments”; but it’s easier to imagine and understand with pixels :sweat_smile:)

But I use editor to load the same model, but there will be no such problem.

In that case it’s hard to say what may be causing it without seeing a codepen / live demo :sweat_smile:

Nevertheless, I’d still consider at least changing the material - just to check that’s not the issue.

:grinning:Can you access this address?

You can drag the model into the scene

Did you find any reason for the frame drop?

This is an internal IP address on your own local network. Nobody can access this besides yourself and people in your network (if your firewall allows it).

Perhaps you have too many lights? These increase the cost of the fragment shader, which does more work as you zoom in. But just guessing, a demo would be best.

1 Like

Can you access this address?

Is it accessible?

I can access this, but am not currently seeing any objects:

You can drag the model into the scene

I can’t tell what the framerate is and it doesn’t seem to decrease very much when I zoom in, on my computer, but general if you ‘fill the screen’ with MeshStandardMaterial (which is what this model uses) it is not unlikely that this will reduce your framerate. Lots of other things might contribute too, like your renderer configuration or the IBL, but I think it is a good idea to test cheaper materials as @mjurczyk suggests.

The frame rate is halved

I don’t notice any performance decrease, but where is the FPS counter?

Sorry, I just removed the dom of my frame rate monitor

I added the dom of frame rate monitoring. You can try to drag the object when the lens is close, and you can feel the frame rate drop obviously

It remains at a steady 60fps even when zoomed in, at least on my computer (2012 Macbook Pro). But not all computers are alike. The earlier comments are still the most likely way to improve framerate regardless of your computer — if MeshStandardMaterial is too expensive when it fills your screen, use a cheaper material like MeshPhongMaterial.