Josh Posted August 17, 2022 Author Share Posted August 17, 2022 BTW, NVCompress is in the Tools folder with a bunch of bat files you can use to just drag an image onto it and get the DDS in the format you want. There's also an option to turn a texture into a normal map, for quick and dirty normal maps. You do not need to use DDS, but they load a lot faster than image files and don't require any plugins. 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...
klepto2 Posted August 18, 2022 Share Posted August 18, 2022 I have now tried a very basic setup for the new Hook-Feature, but can't get it to work While the setup works, it just does nothing in the loop. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; class Environment : public Object { private: shared_ptr<World> _world; public: Environment(shared_ptr<World> world); friend shared_ptr<Environment> CreateEnvironment(shared_ptr<World> world); }; void CalculateEnvironment(VkCommandBuffer cbuffer, shared_ptr<Object> extra) { //Vulkan code Print("Hello World"); } Environment::Environment(shared_ptr<World> world) { _world = world; } shared_ptr<Environment> CreateEnvironment(shared_ptr<World> world) { auto env = make_shared<Environment>(world); world->AddHook(HOOKID_RENDER, CalculateEnvironment, env); return env; } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world 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, 0, -3); //Create a light auto light = CreateLight(world, LIGHT_DIRECTIONAL); light->SetRotation(35, 45, 0); //Create a box auto box = CreateBox(world); //Entity component system auto actor = CreateActor(box); auto component = actor->AddComponent<Mover>(); component->rotation.y = 45; auto environment = CreateEnvironment(world); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; } Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted August 18, 2022 Author Share Posted August 18, 2022 @klepto2If you add an object in the "extra" parameter, the function will get called. It shouldn't be required, but I made a small mistake. Also, don't call Print() from the rendering thread, since it is not thread-safe. 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...
klepto2 Posted August 18, 2022 Share Posted August 18, 2022 @Josh I have provided the extra parameter in the function: auto env = make_shared<Environment>(world); world->AddHook(HOOKID_RENDER, CalculateEnvironment, env); The Print was just for testing, of course this should be removed. [Edit:] I should mention taht it still isn't called in the render loop or otherwise 1 Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted August 18, 2022 Author Share Posted August 18, 2022 confirmed... 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...
Josh Posted August 18, 2022 Author Share Posted August 18, 2022 The library is updated and your code above works now. 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...
klepto2 Posted August 18, 2022 Share Posted August 18, 2022 4 minutes ago, Josh said: The library is updated and your code above works now. confirmed Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted August 18, 2022 Share Posted August 18, 2022 Ok, i have now a setup where i can begin to start integrating the compute shaders (Textures are successfully created) and accessible. If i want to include my own ComputePipeline i need access to some more specific vulkan handles, eg: the vkDevice, maybe vkInstance etc. Maybe you can provide a struct containing all these in the Hook instead of just the Commandbuffer? Or is there another way to Dispatch a loaded ShaderModule in UltraEngine? I have searched the UltraRender namespace as well, but i can't access the infos needed to manually create the Pipeline. Any infos or ideas? Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted August 18, 2022 Author Share Posted August 18, 2022 If you call UltraCore::GameEngine::Get()->renderingthreadmanager->device most everything will be there. 1 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...
Josh Posted August 18, 2022 Author Share Posted August 18, 2022 @reepblueThis is what I usually do to make all sprite coordinates match up to the screen coordinates: cam2d->SetPosition(float(framebuffer->size.x)*0.5f, float(framebuffer->size.y)*0.5f); Then position 0,0 is the bottom-left of the screen. 1 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...
reepblue Posted August 18, 2022 Share Posted August 18, 2022 Oh nice, I was wondering about this. Interesting that you chose to make the bottom-left the origin for sprites/2D projection instead of top-left. It threw me off at first. Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted August 18, 2022 Author Share Posted August 18, 2022 I didn't choose anything. Remember, there is no 2D graphics, just orthographic projection. 1 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...
reepblue Posted August 18, 2022 Share Posted August 18, 2022 What about the GUI? Would I render that onto a sprite? Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted August 19, 2022 Author Share Posted August 19, 2022 There are some rendering problems I am working on now, but this is how a GUI gets created for 3D graphics: auto ui = CreateInterface(world, framebuffer->size); ui->SetRenderLayers(RENDERLAYER_1); auto button = CreateButton("Button", 20, 20, 100, 30, ui->root); ui->SetScale(displays[0]->scale); Then in the main loop you need to pass events to the interface, since it is not connected to any window: while (PeekEvent()) { const auto& e = WaitEvent(); switch (e.id) { case EVENT_MOUSEDOWN: case EVENT_MOUSEUP: case EVENT_MOUSEMOVE: case EVENT_KEYDOWN: case EVENT_KEYUP: case EVENT_KEYCHAR: ui->ProcessEvent(e); break; case EVENT_WIDGETACTION: //if (e.source == button) Notify("Button pressed!"); break; } } You can pass the unmodified event like above, or you can pass events in from transformed coordinates in-game, like the clickable panels in Doom. In that case, you would call camera->SetRenderTarget() to make the camera render to a texture, and then you have in-game interfaces. 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...
reepblue Posted August 19, 2022 Share Posted August 19, 2022 Fyi, The project updated is broken with my project. The app crashes upon clicking on the hazard icon. I just recopy everything but my source and project. I'm not sure adding another library to my project it made it upset or not. Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
klepto2 Posted August 19, 2022 Share Posted August 19, 2022 Small Update on compute shaders: I have now a small partly working Implementation which looks like this: auto environment = initalize_atmosphere(world); auto cshader = ComputeShader::Create("Shaders\\Environment\\transmittance_gen.comp.spv"); cshader->AddImageBinding(texture1, 0, WRITE); cshader->AddImageBinding(texture2, 1, READ); cshader->AddBufferBinding(environment, 2,1 READ); cshader->BeginDispatch(world,16,16,1,true); The most magic is done in the BeginDispatch, this creates the proper LayoutInfo and Descriptorsets when not done yet, and registers a renderhook which then adds the proper commands to the cmdbuffer. I still need to figure some things out, but at least the compute shader is succesfully bound and can be seen in nsight :). I will later add a DirectDispatch method which can be executed withot the rendering buffer, but therefore I need create a new separate Queue, etc.. But first i will have a first running version with the BeginDispatch approach. 2 Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted August 19, 2022 Author Share Posted August 19, 2022 I'm curious, are you really doing Vulkan programming yourself with this, or are you more just passing the values to another API? 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...
klepto2 Posted August 19, 2022 Share Posted August 19, 2022 Complete vulkan programing on my own, well besides some researches done previous. I am trying to implement https://github.com/ebruneton/precomputed_atmospheric_scattering Currently which was successfully in Leadwerks engine. This implementation can provide real-time luminance and reflection textures for pbr pipelines. Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted August 19, 2022 Author Share Posted August 19, 2022 Oh man, you have my respect. Damn, I will try to help as much as possible. UltraRender is a sort of mid-layer API, but I am hesitant to try to expose or document it since it is a lot more complex and prone to changes. 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...
klepto2 Posted August 19, 2022 Share Posted August 19, 2022 Thank you, this is the atmosphere renderin in Leadwerks: And I think with the terrain benefits of ultraengine ( real spherical ) this is awesome. 4 Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
reepblue Posted August 19, 2022 Share Posted August 19, 2022 Wow, that looks incredible in Leadwerks and I can't wait to see it in Ultra. Hopefully your environment class can be part of the engine itself some day. Future on everything is really exciting and I'm glad to be part of it. 🙂 Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted August 20, 2022 Share Posted August 20, 2022 Looks like the last update broke the scroll bar for text areas, it was working last night. I would post a screenshot but the site is not letting me again. Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted August 20, 2022 Author Share Posted August 20, 2022 PNG does not work for some reason sometimes. I am waiting to update the system before I do anything about it. 1 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...
Josh Posted August 21, 2022 Author Share Posted August 21, 2022 @klepto2 In the next build the hook will pass this stucture instead of just a command buffer: struct VkRenderer { VkDevice device; VkInstance instance; VkCommandBuffer commandbuffer; }; Is there any other data I should add to it? 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...
klepto2 Posted August 21, 2022 Share Posted August 21, 2022 This looks good, what might be a good addition would be the ability to remove hooks. I am currently designing my pipeline to have one shot and recurring pipelines. The atmosphere just needs one shot calculations, when some parameters have changed. Later the more complex fft calculation for oceans needs recurring updates each frame. Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Recommended Posts