Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.... !alt textalt textalt text

I'd appreciate any advice!

Product Version: UE 4.9
books_01.png (274.8 kB)
books_02.png (1.1 MB)
books_03.png (1.0 MB)
more ▼

asked Apr 09 '16 at 01:20 AM in Blueprint Scripting

avatar image

6 1 2 1

avatar image jayice Apr 09 '16 at 01:42 AM


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 IwSpline, 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 IwSpline, 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 IwSpline 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,


IceWare Inc


avatar image endspire Apr 09 '16 at 02:02 AM

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.

avatar image jayice Apr 09 '16 at 02:12 AM


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!


IceWare Inc.


avatar image endspire Apr 09 '16 at 02:17 AM

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

avatar image jayice Apr 09 '16 at 02:20 AM

More than welcome!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Apr 09 '16 at 01:45 AM

avatar image

1.8k 66 27 90

avatar image endspire Apr 09 '16 at 02:04 AM

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.

avatar image Jacky Apr 09 '16 at 12:16 PM

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.

avatar image endspire Apr 09 '16 at 11:00 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question