Vladimir Sabantsev Posted June 28 Posted June 28 Hello, I'm trying to distribute my additional cameras rendering across different frames to boost performance. Unfortunately, setting Camera::SetRealtime(false) doesn't have any positive effect on the frame count. In case of the following example I get FPS drop from 600 to 480 when I add 12 inactive cameras for depth cubemap capture: #include "Leadwerks.h" namespace lwe = Leadwerks; int main(int argc, const char* argv[]) { auto displays = lwe::GetDisplays(); auto window = lwe::CreateWindow("Leadwerks", 0, 0, displays[0]->size.x, displays[0]->size.y, displays[0], lwe::WINDOW_FULLSCREEN); auto framebuffer = lwe::CreateFramebuffer(window); auto world = lwe::CreateWorld(); auto light = lwe::CreateDirectionalLight(world); auto sphr_c = lwe::CreateSphere(world); auto cone_0 = lwe::CreateCone(world, 0.5f, 1.f, 64); auto sphr_0 = lwe::CreateSphere(world); auto cube_0 = lwe::CreateBox(world); auto cone_1 = lwe::CreateCone(world, 0.5f, 1.f, 64); auto sphr_1 = lwe::CreateSphere(world); auto cube_1 = lwe::CreateBox(world); auto cube_f = lwe::CreateBox(world); auto clnd_0 = lwe::CreateCylinder(world, 0.5f, 1.f, 64); cube_f->SetScale(100.f, 1.f, 100.f); cube_f->SetPosition(0.f, -3.001f, 0.f); light->SetRotation(60, 0, 0); light->SetColor(0.5f); world->SetAmbientLight(0.05f, 0.1f, 0.1f); sphr_c->SetScale(0.3f); cone_1->SetScale(1.5f); cone_0->SetPosition( 0.f, +1.f, +2.f); sphr_0->SetPosition(+2.f, +1.f, 0.f); cube_0->SetPosition(+1.f, +2.f, +1.f); cone_1->SetPosition( 0.f, -1.f, -2.f); sphr_1->SetPosition(-2.f, -1.f, 0.f); cube_1->SetPosition(-1.f, -2.f, -1.f); clnd_0->SetPosition(-2.1f, -2.f, -1.f); #if 1 std::vector<std::shared_ptr<lwe::Camera>> extra_camera_vec; auto texture_1 = lwe::CreateTexture(lwe::TEXTURE_CUBE, 1024, 1024, lwe::TEXTURE_DEPTH, {}, 6); auto texture_2 = lwe::CreateTexture(lwe::TEXTURE_CUBE, 1024, 1024, lwe::TEXTURE_DEPTH, {}, 6); for (uint32_t i = 0; i < 6; ++i) { auto texbuff = lwe::CreateTextureBuffer(1024, 1024, 0, true); texbuff->SetDepthAttachment(texture_1, i); auto camera = lwe::CreateCamera(world); camera->SetRenderTarget(texbuff); camera->SetRealtime(false); extra_camera_vec.push_back(camera); } for (uint32_t i = 0; i < 6; ++i) { auto texbuff = lwe::CreateTextureBuffer(1024, 1024, 0, true); texbuff->SetDepthAttachment(texture_2, i); auto camera = lwe::CreateCamera(world); camera->SetRenderTarget(texbuff); camera->SetRealtime(false); extra_camera_vec.push_back(camera); } #endif auto main_camera = CreateCamera(world); while (!window->Closed() && !window->KeyDown(lwe::KEY_ESCAPE)) { world->Update(); world->Render(framebuffer, false, 9999); } return 0; } In my project this performance drop is much more noticeable - from ~600 to ~120 no matter if SetRealtime is true or false on pretty much the same scene, but I'm not sure what else contributes to it. I would expect inactive cameras to have virtually no effect on performance. 1 Quote
Recommended Posts
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.