Jump to content

klepto2

Developers
  • Posts

    929
  • Joined

  • Last visited

Everything posted by klepto2

  1. Just added: shared_ptr<SyntaxEditor> CreateSyntaxEditor(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) This will create a scintilla component. It works both for 3d Interfaces and Window-Interfaces, But in 3d it is just an overlay on the topwindow, so it is not available for render to texture targets. For Details on how to use the Control: https://www.scintilla.org/ScintillaDoc.html I have seperated the Scintilla Function calls from the base Widget. You need to call: syntaxEditor->GetCall()->CurrentPos() for exsample. It is more oriented the way it is used by the original author in his Scite project.
  2. In this post, I want to introduce you to my GitHub repository: https://github.com/klepto2/UltraEngineUtilities Currently, there is not that much available, but I am working on adding more utilities and helper classes, which will help to work with UltraEngine. I had the privilege to be one of the first users of UltraEngine and was able to see the enormous amount of potential right from the beginning. So with the repo, I want to give some of the small or bigger helpers I have developed or made compatible for UltraEngine to the public. Available Features: namepace UltraEngine::Utilities::Shader ShaderCompiler A class which allows you to compile UltraEngines glsl-shaders to SPIRV format from code. ShaderWatcher This class uses the UltraEngine::FileSystemWatcher to watch changes for all available shaders used by your program It parses the ShaderFamilies Keeps track of includes Recompilation of shaders as soon as the shader file changes Automatically reloads shaders when the compilation was succesfully Sample code: How To use the Shadercompiler: #include "UltraEngine.h" #include "ComponentSystem.h" #include "include\Utilities.h" using namespace UltraEngine; using namespace UltraEngine::Utilities::Shader; int main(int argc, const char* argv[]) { auto compiler = CreateShaderCompiler(); auto result = compiler->Compile("Shaders/GUI/WidgetBlock.frag", "Shaders/GUI/WidgetBlock.frag.spv"); if (result->IsSuccesfull()) { Print("Shader compiled succesfully!"); for (auto f : result->GetIncludedFiles()) { Print("Shader includes: " + f); } } else { Print("Shader compilation failed!"); Print(result->GetError()); } ... } How to use the ShaderWatcher: #include "UltraEngine.h" #include "ComponentSystem.h" #include "include\Utilities.h" using namespace UltraEngine; using namespace UltraEngine::Utilities::Shader; int main(int argc, const char* argv[]) { auto watcher = CreateShaderWatcher(); watcher->Start(); ... } Future Features: Multiple Widgets ContainerWidgets: FlowPanel StackPanel TableLayoutPanel Scintilla Integration plain Scintilla Wrapper Advanced SyntaxEditor -widget will encapsulate some advanced features like inlining etc. Vulkan-Utilities: A port and slightly modified Version of Sascha Willems https://github.com/SaschaWillems/Vulkan/blob/master/base/VulkanTools.cpp I am as well working on some more advanced stuff, but there i have to decide how to publish them. ComputeShader-Integration Real-time PBR-Environment-Calculations Atmospheric scattering Ocean and Water rendering Here are some Screens and Animations showing some of the above Features:
  3. Some small additions i wanted to test with the current scintilla version: how to make autocomplete better than in Leadwerks (it was firstly in there, but then changed to an opt-in feature, due to problems) Line indention Calltips (not even tried them in Leadwerks time)
  4. You can try to implement some kind of virtualization. If all elements in you list are of the same size, you can just create as much as is visible. If you scroll you can recycle the ones which are out of view and put them in a cache. Then you calculate which items are in view and you pop the items from the cache and update there position. If the size changes and more items are visible than are in the cache, just create new items.
  5. Some minor issues regarding panelstyles and clipping: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface auto ui = CreateInterface(world, font, framebuffer->size); iVec2 sz = ui->root->ClientSize(); auto mainPanel = CreatePanel(0, 0, sz.x, sz.y, ui->root); mainPanel->SetColor(Vec4(1.0, 0.0, 0.0, 1.0), WIDGETCOLOR_BACKGROUND); //Create widget sz = mainPanel->ClientSize(); auto panel1 = CreatePanel(5, 5, 300, sz.y - 10, mainPanel); auto panel2 = CreatePanel(5 + 305, 5, 300, sz.y - 10, mainPanel, PANEL_BORDER); auto panel3 = CreatePanel(5 + 610, 5, 300, sz.y - 10, mainPanel, PANEL_GROUP); auto tabber = CreateTabber(5 + 915, 5, 300, sz.y - 10, mainPanel); tabber->AddItem("Tabber"); panel3->SetText("Group"); sz = panel1->ClientSize(); auto scrollBar1V = CreateSlider(sz.x - 20, 0, 20, sz.y, panel1, SLIDER_SCROLLBAR | SLIDER_VERTICAL); auto scrollBar1H = CreateSlider(0, sz.y-20, sz.x-20, 20, panel1, SLIDER_SCROLLBAR | SLIDER_HORIZONTAL); sz = panel2->ClientSize(); auto scrollBar2V = CreateSlider(sz.x - 20, 0, 20, sz.y, panel2, SLIDER_SCROLLBAR | SLIDER_VERTICAL); auto scrollBar2H = CreateSlider(0, sz.y - 20, sz.x - 20, 20, panel2, SLIDER_SCROLLBAR | SLIDER_HORIZONTAL); sz = panel3->ClientSize(); auto scrollBar3V = CreateSlider(sz.x - 20, 0, 20, sz.y, panel3, SLIDER_SCROLLBAR | SLIDER_VERTICAL); auto scrollBar3H = CreateSlider(0, sz.y - 20, sz.x - 20, 20, panel3, SLIDER_SCROLLBAR | SLIDER_HORIZONTAL); sz = tabber->ClientSize(); auto scrollBar4V = CreateSlider(sz.x - 20, 0, 20, sz.y, tabber, SLIDER_SCROLLBAR | SLIDER_VERTICAL); auto scrollBar4H = CreateSlider(0, sz.y - 20, sz.x - 20, 20, tabber, SLIDER_SCROLLBAR | SLIDER_HORIZONTAL); //Create camera auto camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); camera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); while (true) { while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; default: ui->ProcessEvent(ev); break; } } world->Update(); world->Render(framebuffer); } return 0; }
  6. This is how the ShaderEditor looks like when styled the UltraEngine way and with proper glsl highlighting:
  7. It is a slightly modified and updated to the latest version of ultraengine of this: It is not rendered in Vulkan directly, so it will not work when rendered to a texture, but for general purpose ingame editors it will work as well as if it is directly attached to a window. I just needed to modify some syntax changes and change some scrolling and draw behavior.
  8. Ingame realtime Shaderediting:
  9. Updated my Repo here: https://github.com/klepto2/UltraEngineUtilities Added a ShaderWatcher: It establishes a FilesystemWatch and keeps track of all used shaders in Shaderfamilies. - Runtime compilation of shaders - Automatically reloading shader assets after compilation - Error-Reports for each shader Missing: Handling Renaming and Deletion of json files Known issues: Notepadd++ uses a way to save files which will trigger the FILECHANGED - EVENT multiple times. I guess i need some way to store some hashvalues for the files. #include "UltraEngine.h" #include "ComponentSystem.h" #include "include\Utilities.h" using namespace UltraEngine; using namespace UltraEngine::Utilities::Shader; int main(int argc, const char* argv[]) { auto watcher = CreateShaderWatcher(); watcher->Start(); ... }
  10. I have published a first version of the compilation class: https://github.com/klepto2/UltraEngineUtilities the watcher class will come later. #include "UltraEngine.h" #include "ComponentSystem.h" #include "include\Utilities.h" using namespace UltraEngine; using namespace UltraEngine::Utilities::Shader; int main(int argc, const char* argv[]) { auto compiler = CreateShaderCompiler(); auto result = compiler->Compile("Shaders/GUI/WidgetBlock.frag", "Shaders/GUI/WidgetBlock.frag.spv"); if (result->IsSuccesfull()) { Print("Shader compiled succesfully!"); for (auto f : result->GetIncludedFiles()) { Print("Shader includes: " + f); } } else { Print("Shader compilation failed!"); Print(result->GetError()); } ... }
  11. A small update on the shader reload: In this gif you can see, that i am editing an included file (Fragment.glsl) This file is used by many shaders so changing this file needs to recompile all dependent main shader files, which you see here. (i changed the lod lookup to a fixed value of 0 which leads to a clear representation of the reflection (just for demonstration) ) I also have improved the compile times as i have moved the Compilation to Multithreading, which makes it much faster than the batch file approach. I am now working on a better error handling, As you can see in the gif, currently the same error is printed for each compiled shader. I want to make it more streamlined, The idea is to create an error log at the end, after all files are compiled. When this is finished i will make this piece of code open source, so Josh and others can include this if they need it.
  12. Some more progress: Realtime Shader editing while the program is running: It uses the FindCachedAsset function together with the FileSystemWatcher. Another feature: it even supports the editing of includes on the fly. So when you edit for example the Lightning.glsl file, the code will find all dependent main shaders and recompile them on the fly.
  13. just a small proof of concept i made: The top line ShaderValidator::ShaderCompiler::Compile(); is the interessting part. This method parses all json shaderfamilies and extracts the required shader files and tries to locate the correct source and target. then it takes all of the found shaders and recompiles them to Spirv-binary files in code before any shader is loaded.
  14. I have 2 ideas for making the Shader and postprocess pipeline a bit more flexible and to keep the innerarchitecture mostly untouched: Postprocessing: Add a method (preferable static, to let later plugins or where you can assign a named Texture, something like: PostEffect::RegisterTexture("MyCustomTex"); PostEffect::SetTexture("MyCustomTex", mytexture); in the json file you can now access them like depth, etc. Just the binding code might be a bit adjusted on your end. Generel shaders: The current shader system is super fast because you more or less make everything available to every shader. With this in mind, i thought about something like the precompiler for components, but on the fly. with libs like shaderc or glslang it is possible to compile shaders to SPIR-V on the fly in the code. Add something like Shader::AddBufferData("BufferName", "Layout",size, &object); With this we could modify e.G.: UniformBlocks.glsl and add the new buffer data to the pipeline On start when the first shader is about to be loaded the UniformBlocks.glsl is validated against the possible current one. If the validation is succesfull, just use the latest shaders and go on if the UniformBlocks.glsl is different from the new generated one: rebuild all shaders like you already do with the batch file. This would make the system a bit more flexible for additions, but will also maintain the speed you get from less binding switches.
  15. Josh, after all these bug reports you have solved recently ,and I just want to say: Thank you. UltraEngine is coming along very nice, and it is much better than I ever have thought it will be. The speed is really incredible, and the API is nice and smooth (of course there is space for improvements, but this will always be the case). Just a small sample: In one of my researches (I posted it earlier in this thread), I started rendering a scene with a large terrain and a pseudo water plane (all tessellated). To test a feature I wanted to implement, I needed some kind of cascade rendering of the scene from multiple viewports (in this case 3). So I rendered the complete scene with lights terrain etc. 4 times, 1 time for the main viewport and 3 times for the cascades to a viewport (512,512) with an attached pfx shader with around 10-12 subpasses. And long story short: the speed was nearly the same as if I would render just the normal viewport. Of course there is some impact, but the same scene in Leadwerks would make it slow down to maybe 5 fps, if not less. In UltraEngine this still runs at 60fps. This is amazing !!!
  16. No, there is a function it is called something like getmeterialtextureindex or so. There you can pass the current material and the index u are using. The function then returns the internal index you need to lookup in the array. take a look in pbr/fragment.glsl and search for textureid.
  17. Improved Distancefield generation with 3 cascades. This could be later combined with flowmaps or other objects flowing around in the water.
  18. Yes, I know the method is in the camera class but commented out. as I think it would require changes to the vertex shaders, like in Leadwerks. But it would be nice to have a way to cut out everything by plane. Also, it would make water refraction possible, when the global refraction is no option (don’t know when, just mentioning it for completeness )
  19. A small experiment to recreate an effect i used in my ocean for Leadwerks: This is uses a second camera with an attached postprocess effect which renders a distance and direction map from a topdown view. It consists of many passes but is still amazingly fast: Render everything but water in a texturebuffer where you store the texcoords for every pixel higher than the water level depending on the texture resolution: perform a JFA (https://www.shadertoy.com/view/WlGyR3) in multiple step sizes store the distance of each pixel to the shore You can see that this is not very accurate as i am currently only render a full cascade for the entire world. But you can get the idea behind it. Unfortunatly UltraEngine currently has no access to clipmaps which leads to the artifact you can see when the sphere is above water. But once clipmaps are reintroduced this should be a no-brainer to solve.
  20. Terrain - SetHeight bug: #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the display list auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Terrain Paint", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); world->SetAmbientLight(0); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetFov(70); camera->SetPosition(0, 100, -100); camera->SetRotation(45, 0, 0); camera->SetClearColor(0.125); //Sunlight auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); //Create terrain auto terrain = CreateTerrain(world, 512); terrain->SetScale(1, 100, 1); //Create base material auto ground = CreateMaterial(); auto diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_diff_4k.dds"); auto normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_nor_gl_4k.dds"); ground->SetTexture(diffusemap, TEXTURE_DIFFUSE); ground->SetTexture(normalmap, TEXTURE_NORMAL); terrain->SetMaterial(ground); //Create paint material auto rocks = CreateMaterial(); diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k.dds"); normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_dot3.dds"); auto dispmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_disp.dds"); rocks->SetTexture(diffusemap, TEXTURE_DIFFUSE); rocks->SetTexture(normalmap, TEXTURE_NORMAL); rocks->SetTexture(dispmap, TEXTURE_DISPLACEMENT); //Camera controls auto actor = CreateActor(camera); actor->AddComponent<CameraControls>(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->MouseDown(MOUSE_LEFT)) { auto mousepos = window->GetMousePosition(); auto pickinfo = camera->Pick(framebuffer, mousepos.x, mousepos.y); if (pickinfo.success) { if (pickinfo.entity == terrain) { iVec2 pos; pos.x = Round(pickinfo.position.x) + terrain->resolution.x / 2; pos.y = Round(pickinfo.position.z) + terrain->resolution.y / 2; int radius = 20; for (int x = pos.x - radius; x < pos.x + radius; ++x) { for (int y = pos.y - radius; y < pos.y + radius; ++y) { float strength = 1.0f - Vec3(x, y, 0).DistanceToPoint(Vec3(pos.x, pos.y, 0)) / float(radius); if (strength <= 0.0f) continue; terrain->SetHeight(x, y, terrain->GetHeight(x,y) + 0.005 * strength); } } } } } world->Update(); world->Render(framebuffer); } return 0; } Terrain_test_d.exe!std::vector<class std::shared_ptr<class UltraEngine::Model>,class std::allocator<class std::shared_ptr<class UltraEngine::Model> > >::operator[](unsigned __int64) Unbekannt Terrain_test_d.exe!UltraEngine::Terrain::UpdatePatchBounds(void) Unbekannt Terrain_test_d.exe!UltraEngine::Terrain::Finalize(void) Unbekannt Terrain_test_d.exe!UltraEngine::World::Render(class std::shared_ptr<class UltraEngine::Framebuffer>,bool,int) Unbekannt > Terrain_test_d.exe!main(int argc, const char * * argv) Zeile 87 C++ [Externer Code] you get this error as soon as you try to modify the terrain with SetHeight: Expression: vector subscript out of range
  21. UltraEngine has a Legacy-Importer which can load the Leadwerks files (map, mat. tex, etc.) while not everything is supported right now you already can load maps created with the Leadwerks Editor. but keep in mind, that the Legacy materials and models will use a different shader family, so you might not get PBR out of the box in Leadwerks maps.
  22. Ok. That Was a stupid mistake. Thank you.
  23. In the latest version, the UI is not rendered correclty: There are 100 items in the list and below are 2 tabbers. If you look closely the tabbers are visible, but only the text in a dark grayish color. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, 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); camera->SetViewport(200, 0, framebuffer->size.x -200, framebuffer->size.y); auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); uiCamera->SetRenderLayers(RENDERLAYER_1); uiCamera->SetClearMode(CLEAR_DEPTH); uiCamera->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2); auto ui = CreateInterface(world, LoadFont("Fonts/arial.ttf"), iVec2(200, framebuffer->size.y)); ui->SetRenderLayers(RENDERLAYER_1); auto sz = ui->root->ClientSize(); auto listbox = CreateListBox(5, 5, sz.x - 10, 200, ui->root, LISTBOX_DEFAULT)->As<ListBox>(); auto tabber = CreateTabber(5, 205, sz.x - 10, sz.y - 205, ui->root)->As<Tabber>(); tabber->AddItem("Settings", true); tabber->AddItem("Output"); for (int i = 0; i < 100; i++) { listbox->AddItem("Item " + String(i)); } //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); //Create a box auto box = CreateBox(world); box->SetColor(0,0,1); //Entity component system auto actor = CreateActor(box); auto component = actor->AddComponent<Mover>(); component->rotation.y = 45; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (PeekEvent()) { auto ev = WaitEvent(); ui->ProcessEvent(ev); } world->Update(); world->Render(framebuffer); } return 0; }
  24. Works Nice I would like to add some small thing to the list: if you clean up the shader code, then you might consider to reanable the mappingscale feature (currently SetMappingScale has no effect, pbr and terrain) Also if possible: readd the animation texture feature with volume textures, this would make life a lot easier. and minor feature request: add some more methods to access some major properties: Camera: GetMatrix() (projection, view, etc.) GetFrustumn Terrain: a way to get the heightmap texture (not only the pixmap) --> support for gpu based heightmap generation a way to get / set the alpha mask for each material --> better support for serialization
×
×
  • Create New...