Reducing the cost of objects in this scene?

Edit: Solved =D

I’m building a library which is going to have the architecture and furniture rendered with Lightmass, and the books as moveable, non-realistically lit objects. The books appear to be very heavy to render when looking at a large amount of them (framerate drops of 20-30fps from 120, and from 75 to 40-50 in VR) and I’m wondering what solutions I have to make them lighter in the scene.

The books are imported as blocks from Maya, each block is about 5-10 books in a different pattern with different size books (for example, the green highlighted objects in the Maya screenshot is about the size of each uasset), and I’m positioning them in UE4 so I can randomise their positions a little bit.

The books were giving the scene the exact same performance hit before being LOD’d twice, so I’m confident it’s not merely a polycount issue. Turning antialiasing off does not help, and turning screen space reflections off doesn’t help.

I’m wondering what the specific cause is and what the solution might be - my guess would be that it’s just the number of uassets causing a slowdown? In which case would the solution be to, instead of making blocks of books in Maya and positioning them in UE4, to position them in Maya and export whole shelves of books as a single uasset, so there’s less ‘objects’ in the scene but the same amount of books?

Some other info -

the books aren’t casting dynamic shadows, they’re not simulating physics, they’re not being lit as static objects, and there’s no special effects on them or anything (black outline is a texture)

Help with optimising this scene (without reducing the number of books!) would be very much appreciated!

-How many materials do you use for 1 book mesh?
-how many tris do you have in your scene?
-what happens when you switch their mode to static? :slight_smile:

There’s 6 materials per book mesh.
In Statistics, Sum Tris is 1,322,106. Though this is an entire building, which the library is only one room of. Is there a way to see polys rendered in the current frame?
I haven’t actually tried static lighting them yet, since my light build times are already through the roof. If I switch them to static, it won’t be enough to see changes in performance right away, correct? I’d have to build lighting on everything? In which case I’d have to post results later tonight or tomorrow.

Edit: I took a screenshot of some stats when standing in the area of the room where most books are on-screen. I don’t have a rendering guy yet so I don’t have much of a clue as to what these mean, but hopefully they’re useful to you.


Edit 2:

That Mesh draw calls number is huge compared to walking around the rest of the building. Is this because of the number of books x the materials applied to them?

YES…6 materials per book mesh is a lot…I would suspect you’ll get quite a bit better performance if you reduce that to even 2 much less 1…
Make sure you’re using a Material Instance as well for the books…I imagine you are but thought I’d mention it…

Also when I build lighting it helps a ton with my FPS…Go to your “world settings” and then “lightmass” and set Static Lighting Level Scale to 5 (heck even 10)…as long as you’ve set your Lightmass Importance Volume you’re build time will reduce drastically and you’ll be able to see if your performance reduces after building lighting…Change it back to 1 (or smaller) when you are building for real/show though…

Last idea/resort - Create the library like destructible meshes are made …build a book shelf and it’s books as 1 mesh…then replace it with the movable books version (and all of the different book meshes in the same place as the Whole version) as you interact with it…I don’t know the nature of your project though so this may not work if you’re going to slowly move all the books around or something cause by the end it’d be back to the way you have it now with a ton of meshes everywhere…

anyways nice start to a scene…hope it all works out…

Hey thanks President,

I can do what I was planning to do with with a single shader or two and texture sheets, I was just a dummy and applied shaders with different colours for quick visualisation while forgetting about draw calls. I’m currently building much larger blocks of books in Maya to export as single meshes, so hopefully that in combination with using less shaders does the trick. I’ll update the thread.

A side note about your lighting tip, how might doing that increase in-game performance if the all the lighting is static? I can understand it reducing build times, but wouldn’t it result in the same cost at run-time?

No idea why it helps a ton on one of my levels…but if I change anything and don’t build lighting my FPS drops a ton…(my dumb guess is that it’s running dynamic lighting until you build lighting so it’s more costly)…

If books wont be interactable consider merging them into larger chunks. You can use the Actor Merging(Editor Preferences > Experimental) tool inside the editor if you like.

That is exactly what’s happening. Preview lighting is dynamic before being baked. Static lighting is completely free, Stationary lights are a little expensive, and dynamic lights are literally 10x more expensive than stationary (according to documentation). VR is doubling up every dynamic light in your scene while playing, so be very careful about that.

Yeah, lower the number of materials to 1 and that will help immensely. When you have a lot of solid colors, what I do is just make colored swatches on a single texture in photoshop and then it’s very easy to UV map the part of the mesh to the correct color. That way you only use a single texture.

I had no idea this was a feature, thanks for the tip!

Yup yup, done and done :stuck_out_tongue: Mesh draw calls reduced from 3100 to about 550 for the scene, hits a solid framerate now. Thanks a lot of the tips everyone.