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"

Performances with 100K+ duplicated mesh (instances)

Hello everyone,

Basically, I'll have two simple models (rack and pallet), that just need to be spawned multiple times and stay at their position (no move, no animation, no shadow). The only thing I need to be able to do is raycasting on the pallets (each pallet will contain some information that I need to retrieve on raycast).

Here is what I've done: - No collision / overlap / physics - No shadows - 2 materials (which are just two different unlit colors) - Instanced the static mesh - Disabled ticks on my actor which creating my instances

I tested it (you can find the code below), and I have 5 FPS for 100,000 instances of my model (which is 670 triangles, 1300 vertices, 70kb). It seems very low to me (the model is simple), do you have any idea/advice that could enhance this result ? I would like to get a 20/30 FPS..

Here is my code:

     PrimaryActorTick.bCanEverTick = false;
     // Defaults parameters value
     ObjectsCountX = 10;
     ObjectsCountY = 10;
     ObjectsCountZ = 10;
     USceneComponent* SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
     RootComponent = SceneComponent;
     // Retrieve the mesh of the bomb and define it as the root
     //static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshAsset(TEXT("/Game/Geometry/Meshes/1M_Cube"));
     static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshAsset(TEXT("/Game/Geometry/Meshes/Rack/Rack6"));
     if (MeshAsset.Succeeded())
         StaticMesh = MeshAsset.Object;
     // Retrieve the materials
     static ConstructorHelpers::FObjectFinder<UMaterial> Matterial0Asset(TEXT("/Game/Geometry/Meshes/Rack/Rack_M0"));
     static ConstructorHelpers::FObjectFinder<UMaterial> Matterial1Asset(TEXT("/Game/Geometry/Meshes/Rack/Rack_M1"));
     if (Matterial0Asset.Succeeded())
         Material0 = Matterial0Asset.Object;
     if (Matterial1Asset.Succeeded())
         Material1 = Matterial1Asset.Object;
     InstancedMeshes = CreateDefaultSubobject<UInstancedStaticMeshComponent>(TEXT("InstancedMeshes"));
 // Called when the game starts or when spawned
 void AGenerationDirector::BeginPlay()
     if (StaticMesh != nullptr)
         // Set Static Mesh
         // Set Materials
         if (Material0 != nullptr && Material1 != nullptr)
             InstancedMeshes->SetMaterial(0, Material0);
             InstancedMeshes->SetMaterial(1, Material1);
         for (int x = 0; x < ObjectsCountX; x++)
             for (int y = 0; y < ObjectsCountY; y++)
                 for (int z = 0; z < ObjectsCountZ; z++)
                     FTransform InstanceTransform = GetTransform();
                     InstanceTransform.SetLocation(FVector(x*300.f, y*150.f, z*200.f));
         InstancedMeshes->AttachToComponent(RootComponent, FAttachmentTransformRules(EAttachmentRule::KeepWorld, false));

I'm not an expert in 3D modelling so I took a model from the Sketchup library and converted it to OBJ, maybe it's too big for what I'm trying to achieve.. ? You can find it here.

Product Version: UE 4.15
more ▼

asked Jun 20 '17 at 11:09 PM in C++ Programming

avatar image

26 6 9 13

avatar image Ninjin Jul 08 '17 at 12:18 AM

Hey, could you make something achievable with the advice I gave you? If so, can you make sure to mark your question as resolved? <3

alt text

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

1 answer: sort voted first

You do realize you are drawing 100,000 * 1300 vertices = 130,000,000 vertices? ;P

You should use hierarchical instanced static mesh and make sure to use billboards for the highest LOD. <3

more ▼

answered Jun 21 '17 at 01:30 AM

avatar image

4.1k 88 38 152

(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