SpiderPig Posted February 9 Share Posted February 9 In this example without any instances I have an instance count of 5, If I create an instance of the box that count goes up to 7, not 6. Is this a bug or has it made more instances for the render thread and the world is tracking those too? I need to know because another project of mine my tree model increases the instance count by 4 for each instance even though it's one model. Just want to be sure if it's my model, or a bug, or a natural part of the engines workings. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto world = CreateWorld(); world->RecordStats(); auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetSweptCulling(true); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); camera->SetRotation(0, 25, 0); auto font = LoadFont("Fonts/arial.ttf"); auto ui = CreateInterface(world, font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0, 0, 0, 0); auto w_fps = CreateLabel("FPS : 0", 10, 10, 150, 30, ui->root); auto w_vertices = CreateLabel("Vertices : 0", 10, 30, 150, 30, ui->root); auto w_primitives = CreateLabel("Primitives : 0", 10, 50, 150, 30, ui->root); auto w_instances = CreateLabel("Instances : 0", 10, 70, 150, 30, ui->root); auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_cam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(2); ui_cam->SetClearMode(CLEAR_DEPTH); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); light->SetColor(5.0f); auto box = CreateBox(nullptr); //Comment out this line and instacne count is 5 //Leave this line uncommented and the instacne count is 7 auto inst = box->Instantiate(world); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { w_fps->SetText("FPS : " + WString(world->renderstats.framerate)); w_vertices->SetText("Vertices : " + WString(world->renderstats.vertices)); w_primitives->SetText("Primitives : " + WString(world->renderstats.polygons)); w_instances->SetText("Instances : " + String(world->renderstats.instances)); world->Update(); world->Render(framebuffer, false); } return 0; } Quote Link to comment Share on other sites More sharing options...
klepto2 Posted February 9 Share Posted February 9 If I remember correctly, the instance count measures the instances which get drawn in the current frame. In your case the instance increase might be 2 because 1 instance is rendered for the rendering and the other one is rendered for the shadowmap of the directional light. So in the stats you need to consider all render targets. 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Solution Josh Posted February 9 Solution Share Posted February 9 Try calling camera->SetDepthPrepass(false) and don't use any lights. 1 Quote 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 More sharing options...
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.