Jump to content

Ultra Engine testing


Josh
 Share

Recommended Posts

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

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;
}

 

  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

@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. :rolleyes:

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

@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 :(

 

 

 

  • Haha 1
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

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?

  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

@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.

  • Like 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

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

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 PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

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.  

  • Like 2
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

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.

  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

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

Thank you, this is the atmosphere renderin in Leadwerks: 

And I think with the terrain benefits of ultraengine ( real spherical ) this is awesome.

  • Like 4
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

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 PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

@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

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.

  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

  • Josh changed the title to Ultra Engine testing
  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...