x

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"

Reduce Lag during Terrain Generation?

I am currently using Perlin Sound for terrain generation, and I can successfully generate terrains. However, as I increase the map size, it's becoming laggy, as more procedural actors are spawned in the map.

I've tried optimizing the procedural generation by using getRenderedActors and getNotRenderedActors from here (which helps to detect which object is in the viewport, and which object isn't): https://answers.unrealengine.com/questions/21801/check-if-an-object-is-visible-by-a-camera.html, and setting actorHiddenInGame and actorCollisionEnabled for each procedural actor per tick. However, this doesn't really work, as it's still as laggy as usual.

I have been searching around for days with no luck. It would be great if I can get some recommendations on someone knows how runtime optimization for procedural generation works. I suspect it cannot be something that is done each tick for each procedural actor. Or else, am I doing the viewport object detection incorrectly?

Product Version: UE 4.18
Tags:
more ▼

asked Jun 27 '18 at 05:26 PM in C++ Programming

avatar image

Paul_LTC
35 4 5 11

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

1 answer: sort voted first

Just a tip on huge amount of meshes - try hierarchical instanced static meshes. It's great for static objects or foliage. You can easily add new instances. Uses a single draw call and is just a single actor. Though be vary that "remove" is actually "swap remove". Cause of it you wont get lag on instance removal, but does not have a consistent ordering of the instances.

more ▼

answered Jun 27 '18 at 06:12 PM

avatar image

Felix Leonhart
496 3 4 7

avatar image Paul_LTC Jul 07 '18 at 03:28 AM

Thanks Felix, you are my savior! Adding collision to the terrain with hierarchical static meshes requires quite a fair amount of effort, but now, I am able to generate a terrain 20 times larger with the same fps performance as before. Just a fair tip btw: Unlike what a lot of people said, collision can be added to HISM, by modifying its collision settings in the code.

avatar image Paul_LTC Dec 02 '18 at 07:00 PM

Just a heads up. After months of reserach, applying LoD drastically improved the runtime by at least 5 times as much, ironically, just by a few clicks of buttons (only if you are using static meshes in files to generate, does not apply to procedural meshes): https://docs.unrealengine.com/en-us/Engine/Content/Types/StaticMeshes/HowTo/AutomaticLODGeneration

(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