Phodex Games Posted July 1, 2018 Share Posted July 1, 2018 Hi, I once was using an engine where you could set up scenes like leadwerks uses maps. It was possible to load multiple scenes at once and also have multiple cameras set up in those scenes. That came in handy for preventing first person hands to clipping through walls, or was used to set up UI, as in that engine you needed a camera to display UI. I wonder if something similar is possible in Leadwerks and how I would achieve it. Do I need to create multiple worlds? And how to load two seperate maps at the same time? What I want to do is creating a new UI system based on 3D models, therefore I need a camera to display them and I would like to overlay that scene, having an seperate camera & lightning. Would also be awesome for split screen. Any solutions or suggestions? Thanks for your input! Markus from Phodex Games Quote Link to comment Share on other sites More sharing options...
Josh Posted July 1, 2018 Share Posted July 1, 2018 Yes. Just set the camera clear mode in the second world to only clear the depth buffer and it will work. 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...
Phodex Games Posted July 1, 2018 Author Share Posted July 1, 2018 1 hour ago, Josh said: Yes. Just set the camera clear mode in the second world to only clear the depth buffer and it will work. Ok but how to exactly do this? Could not find it in the documentation yet. I am using the code snippet from here to play around with it: https://www.leadwerks.com/learn?page=API-Reference_Object_World_GetCurrent How can I tell both cameras to render at the same time? I tried camera:SetClearColor(0, 0, 0, 0)... Quote Link to comment Share on other sites More sharing options...
Josh Posted July 2, 2018 Share Posted July 2, 2018 #include "Leadwerks.h" using namespace Leadwerks; Model* model = NULL; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); World* world1 = World::Create(); Camera* camera1 = Camera::Create(); World* world2 = World::Create(); Camera* camera2 = Camera::Create(); camera->SetClearMode(Buffer::Depth); while (true) { if (window->Closed() || window->KeyDown(Key::Escape)) return false; Leadwerks::Time::Update(); world1->Update(); world2->Update(); world1->Render(); world2->Render(); context->Sync(false); } return 0; } 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...
Phodex Games Posted July 2, 2018 Author Share Posted July 2, 2018 25 minutes ago, Josh said: camera->SetClearMode(Buffer::Depth); Thank you for the code snippet, but I am actually using lua and the method "SetClearMode" does not exist. I also tried it with C++, although I am not into it yet and have some trouble, but Visual Studio does not recognize the SetClearMode method either... also do I have to set it on camera 2 and 1? Because in your code its just camera. I would expect it to look like this in lua, maybe I did something wrong? local camera = Camera:Create() camera:SetClearMode(Buffer.Depth) Quote Link to comment Share on other sites More sharing options...
Josh Posted July 2, 2018 Share Posted July 2, 2018 Ah, it actually isn't in C++ either. There is just a "clearmode" member that is initialized to Color + Depth. I probably don't recommend attempting this. There are a lot of weird issues that could come up. If you just want something to appear on top you could set the depth test mode to false (unchecked) in the material editor. Or render to an offscreen buffer and then draw the resulting image on top of your final render. 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...
Phodex Games Posted July 2, 2018 Author Share Posted July 2, 2018 Ok, I guess I will find my way, as always thanks anyways Josh, game me some new ideas! 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.