Jump to content

klepto2

Developers
  • Posts

    857
  • Joined

  • Last visited

Posts posted by klepto2

  1. A small Feature-request:

    Currently there are 2 available Hooks in the rendering pipeline: HOOK_RENDER and HOOK_TRANSFER

    I can think of at least 2 more additional hooks which might be useful: HOOK_XXXX_BEGIN and HOOK_END. This might be used to create performance queries. 

    Additional but not so important would be to have Hooks which are called when textures are created or the rendering thread is initialized (when the device, etc is available) this would help to integrate 3rd party libraries much easier.

  2. #include "UltraAppKit.h"
    
    using namespace UltraAppKit;
    
    int main(int argc, const char* argv[])
    {
        String s = LoadFile("projects.txt");
    
        vector<String> sarr = s.Split("\n"); 
    
        for (auto s : sarr)
        {
            Print(s);
        }
    
        return 0;
    }

    And for deleting: Just rewrite the whole project text file, just iterate all your listbox items and save the data.

  3. You need to keep track of each variable you create, if you just do something like this:

    auto window = CreateWindow("Window 1"....);
    window = CreateWindow("Window 2"....);

    then the first window is not referenced anymore and therefore deleted.

    To better handle this, you should use classes to hold everything your windows need. (one class per window).

    A very basic sample:

    #include "UltraEngine.h"
    
    using namespace UltraEngine;
    
    class MyWindowBase : public Object
    {
    protected:
        shared_ptr<Window> _window;
        shared_ptr<Interface> _ui;
        string _title;
        bool _closed;
    
    public:
        MyWindowBase(string title,int px,int py, int width,int height,  vector<shared_ptr<Display>> displays) : _title(title)
        {
            _window = CreateWindow(_title,px,py,width,height, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER);
            _ui = CreateInterface(_window);
            _closed = false;
        }
    
        bool Closed()
        {
            return _closed;
        }
    
        void virtual Init() abstract;
    
        bool virtual Update(const Event ev)
        {
            if (ev.source != NULL && ev.source->As<Window>() == _window && !_closed)
            {
                switch (ev.id)
                {
                case EVENT_WINDOWCLOSE:
                    _closed = true;
                    _window = NULL;
                    return true;
                }
            }
    
            return false;
        }
    };
    
    class MainWindow : public MyWindowBase
    {
    private:
        shared_ptr<Widget> _listbox;
    
    public:
        
        MainWindow(string title, int px, int py, int width, int height, vector<shared_ptr<Display>> displays) : MyWindowBase(title, px, py, width, height, displays)
        {
            Init();
        }
    
        void Init() override
        {
            auto sz = _ui->root->GetSize();
            _listbox = CreateListBox(20, 20, sz.x - 40, sz.y - 40, _ui->root);
            _listbox->AddItem("Item 1", true);
            _listbox->AddItem("Item 2");
            _listbox->AddItem("Item 3");
            _listbox->AddItem("Item 4");
            _listbox->AddItem("Item 5");
            _listbox->AddItem("Item 6");
            _listbox->SetLayout(1, 1, 1, 1);
        }
    
        bool virtual Update(const Event ev) override
        {
            if (!MyWindowBase::Update(ev))
            {
                switch (ev.id)
                {
                case EVENT_WIDGETACTION:
                    Print("Item " + String(ev.data) + " action");
                    break;
                case EVENT_WIDGETSELECT:
                    Print("Item " + String(ev.data) + " selected");
                    break;
                }
            }
    
            return false;
        }
    
    };
    
    class SecondWindow : public MyWindowBase
    {
    private:
        shared_ptr<Widget> _listbox;
    
    public:
        SecondWindow(string title, int px, int py, int width, int height, vector<shared_ptr<Display>> displays) : MyWindowBase(title, px, py, width, height, displays)
        {
            Init();
        }
    
        void Init() override
        {
            auto sz = _ui->root->GetSize();
            _listbox = CreateListBox(20, 20, sz.x - 40, sz.y - 40, _ui->root);
            _listbox->AddItem("Item 1.1", true);
            _listbox->AddItem("Item 1.2");
            _listbox->AddItem("Item 1.3");
            _listbox->AddItem("Item 1.4");
            _listbox->AddItem("Item 1.5");
            _listbox->AddItem("Item 1.6");
            _listbox->SetLayout(1, 1, 1, 1);
        }
    
        bool virtual Update(const Event ev) override
        {
            if (!MyWindowBase::Update(ev))
            {
                switch (ev.id)
                {
                case EVENT_WIDGETACTION:
                    Print("Item " + String(ev.data) + " action");
                    break;
                case EVENT_WIDGETSELECT:
                    Print("Item " + String(ev.data) + " selected");
                    break;
                }
            }
    
            return false;
        }
    
    };
    
    int main(int argc, const char* argv[])
    {
        //Get the displays
        auto displays = GetDisplays();
    
        vector<shared_ptr<MyWindowBase>> windows;
        windows.push_back(make_shared<MainWindow>("Main Window", 0, 0, 800, 600, displays));
        windows.push_back(make_shared<SecondWindow>("Second Window", 400, 300, 400, 300, displays));
        bool running = true;
    
        while (running)
        {
            const Event ev = WaitEvent();   
            running = false;
    
            for (auto w : windows) 
            {
                if (w->Update(ev))
                    break;
    
                if (!w->Closed())
                    running = true;
            }
        }
        return 0;
    }

     

    • Thanks 1
  4. To be honest, I just corrected the shadow map lookups in the Lighting.glsl and replaced the Lighting lookup with the one from PBRLighting. Otherwise i just added some MieScattering and i actually reworked the raymarching you used to a fixed step to always get the full raymarching. Everything else should be more or less the same as your experiment.

  5. Reworked Volumetric Lighting:

    image.thumb.png.d1a372f9d9efd8747617f267b4843d1e.png

    #include "UltraEngine.h"
    
    using namespace UltraEngine;
    
    int main(int argc, const char* argv[])
    {
        auto plg = LoadPlugin("Plugins/KTX2TextureLoader");
        auto plg2 = LoadPlugin("Plugins/FITextureLoader");
        //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->SetRotation(45, 0, 0);
        
        camera->SetFOV(70);
    
        camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/SSR.json"));
        camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/FXAA.json"));
        camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/SSAO.json"));
        camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/Bloom.json"));
        camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/VolumetricLighting.json"));
        
    
        world->SetEnvironmentMap(LoadTexture("Materials/Environment/Storm/Diffuse.dds"), ENVIRONMENTMAP_DIFFUSE);
        world->SetEnvironmentMap(LoadTexture("Materials/Environment/Storm/Specular.dds"), ENVIRONMENTMAP_SPECULAR);
        world->SetEnvironmentMap(LoadTexture("Materials/Environment/Storm/Specular.dds"), ENVIRONMENTMAP_BACKGROUND);
    
        world->SetAmbientLight(0.0);
    
        auto sponza = LoadModel(world, "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Sponza/glTF/Sponza.gltf");
        camera->Move(sponza->GetBounds(BOUNDS_RECURSIVE).center);
    
        auto pointlight = CreatePointLight(world);
        pointlight->SetPosition(sponza->GetBounds(BOUNDS_RECURSIVE).center);
        pointlight->SetColor(0.0,2.0,0.0,10.0);
        pointlight->SetRange(0.1, 25.0);
        pointlight->SetShadowMapSize(1024);
    
        auto spotlight = CreateSpotLight(world);
        spotlight->SetPosition(sponza->GetBounds(BOUNDS_RECURSIVE).center + Vec3(0.0,2.0,0.0));
        spotlight->SetColor(2.0, 0.0, 0.0, 100.0);
        spotlight->SetRange(0.1, 25.0);
        spotlight->SetShadowMapSize(1024);
    
        auto light = CreateDirectionalLight(world);
        light->SetRotation(45, -45, 0);
        light->SetColor(1.0,1.0,1.0,5.0);
        light->SetShadowMapSize(2048);
    
        //Main loop
        while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
        {
            auto center = sponza->GetBounds(BOUNDS_RECURSIVE).center + Vec3(0.0, sin(world->GetTime() * 0.0005) * (sponza->GetBounds(BOUNDS_RECURSIVE).size.height * 0.25), 0.0);
            pointlight->SetPosition(center);
            spotlight->Turn(0.0, 1.0, 0.0);
            camera->UpdateControls(window);
            world->Update();
            world->Render(framebuffer);
        }
        return 0;
    }

    The Volumetric Strength can be controlled with the alpha value of the lightcolor.

    You can experiment as well by changeing the #define G_SCATTERING 0.25

    in VolumetricLighting.frag. Higher Values will make the Volumetric effect more localized, lower values will make it more uniform. Maybe when the SetVolumetricStrength is passed to the LightInfo, this can be used for the strength and G_SCATTERING can be provided with the alpha value.

     

    Volumetric_Lighting.zip

  6. Works now perfectly. One sidenote: I know a backup of the changed files is made, but i believe the template files especially the main.cpp or other possibly heavily modified files by users should not be changed by an update. Shaders etc. provided by the engine should be updated, but nothing else.

  7. My bad, the basic sample works. but using SetEnvironmentMap throws errors now:

    >	VolumetricLighting_d.exe!std::_Ptr_base<class UltraRender::RenderMaterial>::get(void)	Unbekannt
     	VolumetricLighting_d.exe!std::shared_ptr<class UltraRender::RenderMaterial>::operator-><class UltraRender::RenderMaterial,0>(void)	Unbekannt
     	VolumetricLighting_d.exe!UltraRender::RenderWorld::SetEnvironmentMap(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap)	Unbekannt
     	VolumetricLighting_d.exe!std::invoke<void ( UltraRender::RenderWorld::*&)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap &>(void ( UltraRender::RenderWorld::*&)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap &)	Unbekannt
     	VolumetricLighting_d.exe!std::_Invoker_ret<struct std::_Unforced>::_Call<void ( UltraRender::RenderWorld::*&)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap &>(void ( UltraRender::RenderWorld::*&)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap &)	Unbekannt
     	VolumetricLighting_d.exe!std::_Call_binder<struct std::_Unforced,0,1,2,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::tuple<class std::shared_ptr<class UltraRender::RenderWorld>,class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap>,class std::tuple<> >(struct std::_Invoker_ret<struct std::_Unforced>,struct std::integer_sequence<unsigned __int64,0,1,2>,void ( UltraRender::RenderWorld::*&)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::tuple<class std::shared_ptr<class UltraRender::RenderWorld>,class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap> &,class std::tuple<> &&)	Unbekannt
     	VolumetricLighting_d.exe!std::_Binder<struct std::_Unforced,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap const &>::operator()<>(void)	Unbekannt
     	VolumetricLighting_d.exe!std::invoke<class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap const &> &>(class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap const &> &)	Unbekannt
     	VolumetricLighting_d.exe!std::_Invoker_ret<void>::_Call<class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap const &> &>(class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap const &> &)	Unbekannt
     	VolumetricLighting_d.exe!std::_Func_impl_no_alloc<class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderWorld::*)(class std::shared_ptr<class UltraRender::RenderTexture>,enum UltraEngine::EnvironmentMap),class std::shared_ptr<class UltraRender::RenderWorld> &,class std::shared_ptr<class UltraRender::RenderTexture> &,enum UltraEngine::EnvironmentMap const &>,void>::_Do_call(void)	Unbekannt
     	VolumetricLighting_d.exe!std::_Func_class<void>::operator()(void)	Unbekannt
     	VolumetricLighting_d.exe!UltraCore::ThreadManager::Update(bool)	Unbekannt
     	VolumetricLighting_d.exe!UltraRender::RenderingThreadManager::Update(bool)	Unbekannt
     	VolumetricLighting_d.exe!UltraCore::ThreadManager::EntryPoint(class std::shared_ptr<class UltraEngine::Object>)	Unbekannt
     	VolumetricLighting_d.exe!UltraEngine::Thread::thread_function(void *)	Unbekannt
     	ucrtbased.dll!00007ff84fa73010()	Unbekannt
     	kernel32.dll!00007ff8f29a7034()	Unbekannt
     	ntdll.dll!00007ff8f48e26a1()	Unbekannt
    

     

  8. I get an access violation with the new version with a blank new project and all other projects:

    >	NewVersionTest_d.exe!std::_Ptr_base<class UltraRender::GPUBuffer>::get(void)	Unbekannt
     	NewVersionTest_d.exe!std::shared_ptr<class UltraRender::GPUBuffer>::operator-><class UltraRender::GPUBuffer,0>(void)	Unbekannt
     	NewVersionTest_d.exe!UltraRender::RenderMaterial::Submit(void)	Unbekannt
     	NewVersionTest_d.exe!UltraRender::RenderingThreadManager::GetDefaultMaterial(void)	Unbekannt
     	NewVersionTest_d.exe!UltraRender::RenderMesh::Initialize(void)	Unbekannt
     	NewVersionTest_d.exe!std::invoke<void ( UltraRender::RenderMesh::*&)(void),class std::shared_ptr<class UltraRender::RenderMesh> &>(void ( UltraRender::RenderMesh::*&)(void),class std::shared_ptr<class UltraRender::RenderMesh> &)	Unbekannt
     	NewVersionTest_d.exe!std::_Invoker_ret<struct std::_Unforced>::_Call<void ( UltraRender::RenderMesh::*&)(void),class std::shared_ptr<class UltraRender::RenderMesh> &>(void ( UltraRender::RenderMesh::*&)(void),class std::shared_ptr<class UltraRender::RenderMesh> &)	Unbekannt
     	NewVersionTest_d.exe!std::_Call_binder<struct std::_Unforced,0,void ( UltraRender::RenderMesh::*)(void),class std::tuple<class std::shared_ptr<class UltraRender::RenderMesh> >,class std::tuple<> >(struct std::_Invoker_ret<struct std::_Unforced>,struct std::integer_sequence<unsigned __int64,0>,void ( UltraRender::RenderMesh::*&)(void),class std::tuple<class std::shared_ptr<class UltraRender::RenderMesh> > &,class std::tuple<> &&)	Unbekannt
     	NewVersionTest_d.exe!std::_Binder<struct std::_Unforced,void ( UltraRender::RenderMesh::*)(void),class std::shared_ptr<class UltraRender::RenderMesh> &>::operator()<>(void)	Unbekannt
     	NewVersionTest_d.exe!std::invoke<class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderMesh::*)(void),class std::shared_ptr<class UltraRender::RenderMesh> &> &>(class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderMesh::*)(void),class std::shared_ptr<class UltraRender::RenderMesh> &> &)	Unbekannt
     	NewVersionTest_d.exe!std::_Invoker_ret<void>::_Call<class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderMesh::*)(void),class std::shared_ptr<class UltraRender::RenderMesh> &> &>(class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderMesh::*)(void),class std::shared_ptr<class UltraRender::RenderMesh> &> &)	Unbekannt
     	NewVersionTest_d.exe!std::_Func_impl_no_alloc<class std::_Binder<struct std::_Unforced,void ( UltraRender::RenderMesh::*)(void),class std::shared_ptr<class UltraRender::RenderMesh> &>,void>::_Do_call(void)	Unbekannt
     	NewVersionTest_d.exe!std::_Func_class<void>::operator()(void)	Unbekannt
     	NewVersionTest_d.exe!UltraCore::ThreadManager::Update(bool)	Unbekannt
     	NewVersionTest_d.exe!UltraRender::RenderingThreadManager::Update(bool)	Unbekannt
     	NewVersionTest_d.exe!UltraCore::ThreadManager::EntryPoint(class std::shared_ptr<class UltraEngine::Object>)	Unbekannt
     	NewVersionTest_d.exe!UltraEngine::Thread::thread_function(void *)	Unbekannt
     	ucrtbased.dll!00007ff820a73010()	Unbekannt
     	kernel32.dll!00007ff8f29a7034()	Unbekannt
     	ntdll.dll!00007ff8f48e26a1()	Unbekannt
    

     

    Error: Failed to load shader module "Shaders/Downsample.frag.spv"
    Ausnahme ausgelöst bei 0x00007FF6F99739C6 in NewVersionTest_d.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x0000000000000258.

     

  9. Maybe i am thinking wrong, but if a ENVIRONMAP_DIFFUSE is used, this should be used as a lookup for the ambientlight. 

    In earlier versions this was clearly visible, but now it seems, that only the ambientlight setting is affecting the scene:

    In this screenshot i have used the diffuse texture as a background to visualize it a bit better:

    image.thumb.png.c1415fc803128425cdf97bc1846b88a9.png

     

  10. 4 hours ago, Josh said:
    
    auto scaleFactor = sponza->GetScale() * desiredWidth / originalAABB.size.width;

    Oh my! Stupid mistake by myself. Of course the initial scale has to be taken into account as well.

    looking forward testing the new updates :) 

    i am currently cleaning up my code and hope to publish a first release of the compute library next week. I just need to add structure buffers and make the texture assignment more dynamic. But the whole thing works really nice. I am thinking about a simple sample. Which takes just a cubemap and calculates the ibl and diffuse textures on the fly. So no need using extra tools.

  11. I am currently trying to get a bit more used with the UI-3D interactions and wrote a small but simple gltf-viewer based on the khronos viewer, it extracts the sample models from the khronos github and you can switch between the models and view them. Due the fact, that the models are in deifferent scales from very tiny ( < 0.01 units) to very big ( > 1000.0 units)  I try to scale them to a unified width, which works most of the time. 

    But from time to time with different models i get unexpected results:

    Sponza: (way too big)
    -----------------------------------------
    Original-AABB:29.7668, 12.447, 18.3059
    ScaleFactor  :0.167972
    New-AABB     :625, 261.344, 384.359
    
    Engine: (correct)
    -----------------------------------------
    Original-AABB:1379.28, 954.6, 1093.35
    ScaleFactor  :0.00362508
    New-AABB     :5, 3.4605, 3.96346

    This is a very basic sample to show it:

    #include "UltraEngine.h"
    #include "ComponentSystem.h"
    
    using namespace UltraEngine;
    
    int main(int argc, const char* argv[])
    {
        auto plg = LoadPlugin("Plugins/KTX2TextureLoader");
        auto plg2 = LoadPlugin("Plugins/FITextureLoader");
        //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 = CreateDirectionalLight(world);
        light->SetRotation(35, 45, 0);
    
    
        float desiredWidth = 5.0;
        auto sponza = LoadModel(world, "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Sponza/glTF/Sponza.gltf");
        auto originalAABB = sponza->GetBounds(BOUNDS_RECURSIVE);
        auto scaleFactor = desiredWidth / originalAABB.size.width;
        sponza->SetScale(scaleFactor);
        auto newAABB = sponza->GetBounds(BOUNDS_RECURSIVE);
    
        Print("Sponza:");
        Print("-----------------------------------------");
        Print("Original-AABB:" + WString(originalAABB.size));
        Print("ScaleFactor  :" + WString(scaleFactor));
        Print("New-AABB     :" + WString(newAABB.size));
    
    
        auto engine = LoadModel(world, "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/2CylinderEngine/glTF/2CylinderEngine.gltf");
        auto originalAABB1 = engine->GetBounds(BOUNDS_RECURSIVE);
        auto scaleFactor1 = desiredWidth / originalAABB1.size.width;
        engine->SetScale(scaleFactor1);
        auto newAABB1 = engine->GetBounds(BOUNDS_RECURSIVE);
    
        Print("Engine:");
        Print("-----------------------------------------");
        Print("Original-AABB:" + WString(originalAABB1.size));
        Print("ScaleFactor  :" + WString(scaleFactor1));
        Print("New-AABB     :" + WString(newAABB1.size));
    
    
        //Main loop
        while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
        {
            world->Update();
            world->Render(framebuffer);
        }
        return 0;
    }

     

    • Like 1
  12. The range is  near: 50000.0 far:10000000.0

    I dynamically increase the near range in steps the more i am away from the planet. I think it should be easier later if Doubles are used, but the shaders i have written are not yet build for that. Also I think a way to overcome this would be to use 2 cameras, one for the near objects, and a second for the planet stuff. 

     

    The Radius of the earth is 6.371.000 m.

  13. 12 hours ago, Josh said:

    @klepto2 @SpiderPig That might actually be the correct result. A diffuse environment map has a very big impact on brightness, and the only place it will not crank the brightness up is inside an environment probe, which effectively blocks the ambient light from coming in. I can't say for sure yet. If you have a directional light and a diffuse environment map, you are effectively lighting the scene twice as bright.

    Additional commands to tune the IBL brightness for diffuse and specular will be added.

    yeah, that might be true. Setting the Color of a directional light to 0.1,0.1,0.1 instead of full bright fixes the problem as well, but there are still some issues with the directional shadows:

    The shadows are not very smooth. And they blend out way too early for directional lights (in my opinion).

    Blocky:

    image.thumb.png.56f2f46efd343ba601bbb42de4c75df9.png

  14. The sample looks nice, but once you setup a directional light, the whole scene (except the background) becomes ultra bright:

    image.thumb.png.33f75add1290ea43b2ec9e5d6140a1e0.png

    auto light = CreateDirectionalLight(world);
    light->SetRotation(45, -45, 0);

     

    Sidequestion: Is there a way to increase the Texturelimits? currently there are just 16 cubemaps allowed, Can this be altered in some way? In earler versions this was done through the ultra.json if i rembmer correctly.

  15. Another small bug report (with potential fix):

    When you move the camera to a position which is further away from the center than the far range, the sykbox becomes distorted and doesn't work anymore:

       auto camera = CreateCamera(world);
        camera->SetClearColor(0.125);
        camera->SetRange(0.1, 1000);
        camera->SetPosition(0, 0, -1000);

    image.thumb.png.adb68c4f561ef207b9804846c2639c93.png

    with a change to sky.frag to this:

    #version 450
    #extension GL_GOOGLE_include_directive : enable
    #extension GL_ARB_separate_shader_objects : enable
    #extension GL_ARB_shader_draw_parameters : enable
    #extension GL_EXT_multiview : enable
    
    #include "../Base/Limits.glsl"
    #include "../Base/PushConstants.glsl"
    #include "../Base/StorageBufferBindings.glsl"
    #include "../Base/TextureArrays.glsl"
    #include "../Base/materials.glsl"
    #include "../Base/UniformBlocks.glsl"
    #include "../Utilities/ReconstructPosition.glsl"
    
    //#include "../base/base_frag.glsl"
    
    //layout(binding = TEXTURE_BUFFER_CUBE) uniform samplerCube textureCubeSampler[MAX_TEXTURES_CUBE];
    
    //Inputs
    layout(location = 0) in flat mat4 cameraMatrix;
    layout(location = 9) in flat uint materialID;
    layout(location = 4) in flat mat4 cameraProjMatrix;
    
    //Outputs
    layout(location = 0) out vec4 outColor;
    
    void main()
    {
    	if (EnvironmentMap_Background != -1)
    	{
    		vec3 screencoord;
    		screencoord.xy = gl_FragCoord.xy / BufferSize;
    		screencoord.z = 0.0;// get the depth at this coord;
    		vec3 fragposition = ScreenCoordToWorldPosition(screencoord);
    
    		vec3 v = normalize(CameraPosition - fragposition);
    		v*=vec3(-1.0);
    		//vec4 screencoord = vec4((gl_FragCoord.xy / bufferSize.xy - 0.5f) * 2.0f, 1.0f, 1.0f);
    		//vec4 screencoord = vec4(((gl_FragCoord.xy - cameraViewport.xy) / cameraViewport.zw - 0.5f) * 2.0f, 1.0f, 1.0f);
    		//vec3 texcoord = normalize(CameraPosition - (cameraProjMatrix * screencoord).xyz);
    		outColor = textureLod(textureCubeSampler[EnvironmentMap_Background], v, 0);//9.5f) * 1.0f;
    	}
    	else
    	{
    		outColor = vec4(1,0,1,1);
    	}
    }

    The sykbox is correctly centered around the camera at any position:

    image.thumb.png.82c13266beeab848d7dd26c72ad2b7ed.png

     

    • Like 1
    • Thanks 1
  16. If you want some basic syntax highlighting and error reporting for the shaders in visual studio I can recommend this:

    https://github.com/danielscherzer/GLSL

    image.thumb.png.5c74410b21fc695cf42a07287b96964c.png

    Configuration to let it be compatible with Ultraengine and Vulkan:

    image.thumb.png.c12c4438fbe47382935495df0b626aa7.png

    The Expand includes is currently needed as the Compileprocess generates a temporary file under %temp% and so there is no direct access to the include files in the shader, but the error detection still works. it can't compile yet to spv files because the Arguments-System is a bit limited, but maybe we can change this :)

    • Like 1
    • Upvote 1
  17. Hi Josh, 

    while you're working on new features and refining them, i would like to suggest some improvements to the client hub:

    1. Update-Tab:
      1. It would be nice to have a Button to directly browse the installation directory (like in the Projects tab, where you can click on the project to open the base folder)
      2. Another addition, which would be nice: An ability to create a backup of the current installed Version, currently I keep track of this manually and create backups, but depending on how you plan to support multiple version channels, it might be nice to easy rollback to a previous one. (without hoping that you provide the correct version channel, maybe a simple zip file or tar)
    2. Project-Tab:
      1. The warning icons and delete button are not indicating, that they can be clicked and there is now real indicator what happens if you click them (tooltips to the rescue?)
      2. The delete icon should be replaced (in my opinion) with a trash bin or something like this. A hint, that the project is only removed from the project tab would be nice as well.
      3. Backup:
        1. The backup should be kept in a separate folder, which should mimic the original folder structure. The current system fills the dev folders with unnecessary files, which can make the fast searching in folders quite complicated. Also with version-control in mind, it would be easier to manage, if there is just a folder with the backed up files, which can be easily be deleted on demand. Currently, you need to filter all bak files and remove them, but this can also lead to problems if a developer maintains their own bak files. 

     

    • Thanks 1
    • Upvote 1
  18. signed distance fields can be used for much more than that. you can use it for every effect which needs to know here it collides with an object. eg:  flow direction, or foam generation:

    they even can be used to make fast SSAO and other effects.

    So you should keep this in mind for later ;)

    • Upvote 1
  19. Hi Josh,

    I have a small and i think simple feature request. If my assumption from your previous posts are correct, then all textures created within the context of ultraengine are already available in all shaders. This is similar to my investigations while debugging in the app. eg: the renderthreadmanager holds a reference for every texture and its type. I also have seen, that the underlying rednertexture has an ID which seems to be the correct index for the texturearray (2d,3d, cube). 

    If that is correct, it would be nice to have this id directly accessable in the Texture class. Then you could easily pass that id too a posteffect shader. With the AddPostEffectParameter you mentioned in this thread.

×
×
  • Create New...