SpiderPig Posted July 15, 2023 Share Posted July 15, 2023 I can't figure this one out. I was playing around with exporting from Blender and it displays on screen but only shows 1 LOD and no meshes for that LOD. It's worth mentioning it has no materials or images, not sure why that'd make a difference though. EDIT : It might be the newer GLTF export in blender. The files that work are with "Khronos glTF Blender I/O v1.4.40" and the ones I've uploaded that don't work are "Khronos glTF Blender I/O v3.6.27". #include "UltraEngine.h" #include "Components/Mover.hpp" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 5, -8); //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto model = LoadModel(world, "Models\\PineLarge_001.gltf"); //Only one LOD and no meshes. //Output says LOD_1 was loaded but then deleted int l = 0; for (auto lod : model->lods) { auto m = 0; for (auto mesh : lod->meshes) { Notify("lod : " + String(l) + ", mesh : " + String(m), ""); m++; } l++; } //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; } PineLarge.zip Quote Link to comment Share on other sites More sharing options...
Josh Posted July 15, 2023 Share Posted July 15, 2023 Did you open this in the model viewer? Maybe there is an extra node in the hierarchy? 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...
SpiderPig Posted July 15, 2023 Author Share Posted July 15, 2023 I didn't I loaded it straight into my project. I also compared it to other similar files that work and it seemed to be the same. Hard to tell really. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 15, 2023 Author Share Posted July 15, 2023 The bufferViews in the .gltf part have an extra parameter called "target", so maybe the bin data is different too? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 16, 2023 Author Share Posted July 16, 2023 I loaded this into the model viewer and re-saved it from there. In C++ it still says only 1 LOD is available and it has a mesh size of 0. Even though the output says it loaded the other LOD and it renders perfectly. Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted July 17, 2023 Solution Share Posted July 17, 2023 It looks like branches and leaves are two separate children: int l = 0; for (int n = 0; n < model->kids.size(); ++n) { for (auto lod : model->kids[n]->As<Model>()->lods) { auto m = 0; for (auto mesh : lod->meshes) { Notify("lod : " + String(l) + ", mesh : " + String(m), ""); m++; } l++; } } 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...
SpiderPig Posted July 17, 2023 Author Share Posted July 17, 2023 Ah yes they are. One has to be parented to the other I think. Quote 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.