How to (optimally) generate a lot of books for a library

Hi, I’m relatively new to UE4, and I’ve been having a hard time trying to optimize a blueprint. I’ve been trying to create a blueprint that lets me generate a lot of books along a spline with a random material, rotation, and scale to help me populate a library. I got it to work, but now I’m facing the problem that I need a lot of books and I’m afraid that this isn’t optimized enough. Instead of generating as a static mesh, I’m generating them as Instanced Static Mesh components, but I’ve read that this doesn’t do much for reducing draw calls.

I guess my question is, how do I optimize my blueprint so that I don’t accidentally crash a computer? I’m attaching a screenshot of my blueprint (sorry that its so small and messy), a screenshot of what it does, and a screen shot of the shelves that i need to fill… !

I’d appreciate any advice!


Using instanced static meshes, reduces drawcalls dramatically, there is no way around it. Take a look at this when your running the game.

  1. Press Tilde “~” - will open up a command line for you.
  2. In the command line, enter => stat scenerendering

You will get a display up, that in the second section down, shows “Drawcalls” and right above it, will show something called “Present”, if the “Present” is very high, then you probably need to rebuild lighting. (as a side note, there is only one way to look at performance with UE4, and that is when lighting has been rebuilt, if lighting needs to be rebuilt, there is no need to even try to figure out performance.)

My product , has a switch in the details pane for blueprints, to switch between Instanced Static Mesh, and Static Mesh. The difference in draw calls is dramatic.Using , I just quickly went in and generated a little over 3000 Static meshes, which yielded the following from Stat Scenerendering

Drawcalls - 2000+

Clicked the button in to switch to Instanced Static mesh

Drawcalls 60

The spline I populated, had 5 Static Meshes/Instanced Static Meshes, at each control point on the spline, and I just told the product to fill an area with control points, in order to get you a feel for it.

Personally if I was you, I would be thinking about setting up 20 or so “random” books (just the materials, using the same Static Mesh (which is not the same as the Static Mesh component you are probably attaching to the spline), Then using instanced static meshes, so I could have all the variations, and then just randomly choose the next material/static mesh, to populate on the spline.

Anyway, hope this helps,

In my opinion your blueprint looks great and you’re doing the right thing.

In terms of the large scale library, you could fake randomize things by just having 3 or 4 large sections of shelves that are placed randomly, as opposed to do every single books. You would pre generate those in your preferred 3D modeller. You could do that where the user can’t see too closely.

Not every book has to be uniquely placed. You could also reuse the same shelf row at various locations.

Hope this helps.

Thank you so much for your reply! I didn’t know about the stat screen rendering, and this will help a lot. What do you think is a high draw call number? I’m pretty sure my script is calling every book, since the draw call is around the number of books I have in an almost empty scene.

Thank you very much for you answer! I think your idea is probably what I should be doing. This is probably a case of me trying to make things easier and accidentally making it harder. I think I can still reuse the blueprint, but just have it generate much larger sections of the books.


There is really no “high” drawcall number, it’s all relative. On my computer, with 16GB, running a movie in the background over the net, having VS2015 open, and in the Unreal editor, when I generated the 3000+ static meshes, I could feel it, when I entered the Play In Editor mode, to get the stats for you. Switched to instance static mesh, and I couldn’t. But then I only have a NVidia 750 GTX, for a video card, with a quad core amd processor.

But yes, your right, say it’s 20,000 drawcalls, and present time goes over 100 milliseconds… Well that’s probably going to even bring a titan to it’s knees.

Basically the best thing to do, is program to the lowest level you wish to support, and then optimize for that. Say someone on a laptop, 4GB of memory, running a little dual core processor, with an intel video chipset. That would be lowend enough. Especially the chipsets that intel sells.

If you take a look at the number of books, and it’s close to equal on the number of calls, revisit your code to make sure, your getting the instanced static mesh. The thing is, from looking at your bookshelf, you have a lot of variation in color, etc. Instanced Static Meshes don’t support that, all the mesh/materials must be the same. Now if your generating, a number of different kinds of ISM(s), then your good to go. But for ISMs, when y ou change one value, for even one of them, they all change. Which has it’s uses as well. Want to change 3000 objects color in world at one shot? ISM(s) is the way to go.

When you press tilde “~” and enter “stat” you will saw a lot of other things you can look at for performance. One I like, is “stat unit”, which shows you information about the gpu/cpu, etc. I use that instead of “stat fps”

Hope this helps!


Yes, this has been very helpful! I really appreciate all of the advice you’ve given!

More than welcome!

You can also use Actor Merging tool(Editor Preferences > Experimental > Actor Merging. Then you can access it in Window tab) to merge the contents of a BP into a single static mesh.

Oh, I didn’t know about that! Thank you very much!

It’s actually not that easy. You need to use special services. Like me, I really want to figure it out, but because of college I can’t make it. Because of this, I just ask on the service to write a book report for me. It is much more convenient and faster. Because I just can’t keep up with this training. They immediately provide me with important information and delete all unnecessary information. Thanks to such services, we can get distracted by what is really interesting to us.

Merging multiple static meshes and their materials to form one mesh with a single material is far more efficient than instanced meshes. (the more instances the more superior merging is by comparison)
And I’m made to understand there are runtime tools that sort of mimic those tools found in the editor.

I’ve never been able to find anything like that, but if it is true, it might be worth digging into.