Jump to content

Terrain lag


Alienhead
 Share

Go to solution Solved by Alienhead,

Recommended Posts

  • 1 month later...

Here's a simple test that will produce roughly the same results.

terrtest.zip

A 512x512 terrain will result in about 263,169 polys being drawn (without LODs) so it's not nothing, and I would expect it to maybe be a bit more expensive than a model since a texture lookup is being performed in the vertex shader, and the fragment shader is more expensive than standard PBR shaders...but it may still be beneficial to take a closer look and determine exactly what the bottleneck is in this situation.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 weeks later...

I am testing this in code and the results seem well within what I would consider to be normal.

  • GPU: AMD 6600
  • No terrain: 4200 FPS
  • With terrain: 2700 FPS
#include "UltraEngine.h"
#include "ComponentSystem.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the display list
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    auto world = CreateWorld();
    world->SetAmbientLight(0);

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Create a camera
    auto camera = CreateCamera(world);
    camera->SetFov(70);
    camera->SetPosition(0, 10, 0);
    camera->SetClearColor(0.125);

    //Sunlight
    auto light = CreateDirectionalLight(world);
    light->SetRotation(45, 35, 0);
    
    //Create terrain
    auto terrain = CreateTerrain(world, 512, 512);
    //terrain->LoadHeightmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Terrain/512.r16");
    //terrain->SetScale(1, 100, 1);

    //Camera controls
    //camera->AddComponent<CameraControls>();

    world->RecordStats(true);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        window->SetText(world->renderstats.framerate);

        world->Update();
        world->Render(framebuffer, false);
    }
    return 0;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I tried the scene I created and uploaded above, and it produces the same results.

In order to investigate this further, I will need a specific scene or program I can test. My attempts to produce any problem are working as expected.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

28 minutes ago, Alienhead said:

I can no longer test this, the lag was happening when I was on an AMD GPU, I have no such stuttering with nvidia gpu's.

Okay, what GPU was it, for future reference?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...