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"

Shaders keep compiling endlessly

I haven't converted my project yet to 12, but considering this problem existed in all prior versions I assume it's still there.

The problem I have is Compiling. Compiling, and more compiling. It starts when I open any level I made (especially when the level has a terrain or foliage in it) UE4 needs to compile about 5000 - 8000 shaders and takes roughly an hour before it's done doing so. In the meantime, the scene is rendered useless because all objects are gray and the lighting looks off so I can only start working after this has been completed.

Then it becomes more annoying when I am finally able to paint on any landscape I made. Every time I paint a new layer on a new terrain tile, it again needs to compile about 400 - 1500 shaders. Taking about 10 minutes per layer and while it's doing so, the tile I'm painting on is again rendered gray until the compiling is done. These tiles are about 10 x 10 meters if not smaller and I'm working on a terrain with the size of about 2 x 2 kilometers. That means if I wanted to paint just one layer on the entire terrain I need to wait more than 600 hours, or almost a month. And then I have about 8 layers. I can watch my kids grow by the time the compiling is done, and I don't even have kids.

So about 80% of my time spent in the UE4 editor is wasted on waiting for shaders to compile. It really ruins the workflow not to mention my motivation or creativity and I doubt other people are fine developing this way.

Does anyone know what I'm doing wrong here? I'm using the Landscape AutoMaterial asset for most painting and my scenes aren't that complex. The issue extends to regular terrain painting as well and foliage assets. I figure there must be some way to have all shaders compile just one time and not after every single change or load.

I already contacted the author of the LAM asset but the conclusion was that it was normal. How could one properly design a terrain with so many interruptions?

Any help is really appreciated.

Product Version: UE 4.11
more ▼

asked Aug 23 '16 at 11:48 AM in Rendering

avatar image

Mr Robville
32 18 23 22

avatar image Matthew J Aug 23 '16 at 05:03 PM

Hello Mr Robville,

This is completely out of my area of expertise as I'm not knowledgeable in how shaders are compiled, but I'm moving your post to the Rendering section as you're more likely to get a response to this there.

avatar image Mr Robville Aug 23 '16 at 05:07 PM

Oops I must have put it in the wrong field, my apologies! Thanks for putting this question in the right area.

avatar image Mr Robville Aug 23 '16 at 05:14 PM

To put things more visually, this is pretty much what I'm looking at 80% of the time. I simply applied a new layer to a bunch of tiles, and off I go to have some dinner. If this was an isolated shader compilation I would have simply done a quick brush over the entire landscape with all layers to have all shaders compile in one go and start properly painting the landscape once that's done after a month, which is tedious but doable, but every time I open the map it needs to compile the shaders again.

The problem is not isolated to a single (possibly corrupted) project. This screenshot is from a quick test map in which I imported a heightmap. Say if this were a fully detailed island with vegetation and everything, I'd have to wait hours for it to load up if this already takes so much time. This can't be right.

alt text

compiling.png (1.3 MB)
avatar image Mr Robville Sep 06 '16 at 07:00 AM

Anyone any ideas?

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

1 answer: sort voted first

You should not have a shader recompile on every load or edit. Landscape recompile will happen when you add or remove a layer from terrain component and only if there is no corresponding shader variation exists for given layer combination. Landscape shader compile times will grow significantly with every terrain layer you have in material. From my experience, anything above 12 is impractical in terms of editing terrain. I haven't worked with LAM, but i'd expect its shaders initial compile to take roughly 10-15 minutes on medium hardware. As a side note, enabling tessellation on landscape materials seems to increase compile times roughly by a factor of 2, for me at least.

But yeah, as I said, you should not have any kind of recompile when loading map. Ensure that nothing is stopping UE4 to properly save Derived Data Cache. It could be the reason why you are getting recompiles on every load.

more ▼

answered Sep 06 '16 at 09:29 AM

avatar image

7.8k 130 31 293

avatar image Mr Robville Sep 09 '16 at 08:52 AM

Thanks a lot for your reply. I believe LAM uses more than 12 layers. Some of which use Tessellation. I haven't checked UE's ability to properly write data yet. Thanks for the tip. I'll also try making a simple landscape material myself to see how it performs compared to LAM. Maybe it's possible to paint the entire landscape using very basic shaders and once I consider the terrain ready enough I then add all the effects I want and wait for the whole compilation process afterwards.

(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