How to optimize viewport frames?

I made a shop ui for my game. Every item has a viewport frame inside which shows the items model, each of those viewport frames has a script which makes the camera spin around the model. And my issue is that soon as i start adding more things to the shop the Viewport frames will start to drop performance, So how would i go about Optimizing them or in best case pausing rendering entirely when they are out of view?

The ui im talking about:

3 Likes

I’m also interested in this topic, because I have a shop with 8-12 rotating viewport items visible. On my PC the performance is fine, although it does take a second until items start rotating smoothly when they’re loaded for the first time.

1 Like

Maybe only spin the object that the mouse is hovering on.

1 Like

I dont think that would do much really, as the code still needs to check the expression constantly.
I will still try it and see if it helps.

Maybe it’s a little late and maybe this is not quite the solution you’re looking for, but why don’t you make it so when the player sees only images of the items and when they click the item they get a viewport frame to preview it, so that you’ll only have a single viewport frame and display it with different items in it. The truth is, I don’t know if it’s possible to optimize them but that would be a way to work around that.