Jump to content

Ultra Engine testing


Josh
 Share

Recommended Posts

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.

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

I see that materialD is an unsigned int but there are several checks to see if it is -1 throughout the shaders.  I assume it's working okay because there is always a default material?

layout(location = 5) flat in uint materialID;

 

if (materialID != -1)
{
	material = materials[materialID];
}

 

Link to comment
Share on other sites

Almost there....

image.thumb.png.c460f4c7d3bf06ad684ee9deb5e75392.png

Text Area is still messed up as it randomly blotches out on some lines. Just create a text box in 3D and 

My console in the left corner updates in real time, pushing older messages down were they nicely fade out. It's so wonderful, I wish I could have it in Cyclone but making context calls just slows Leadwerks down. 

Resizing works 100% with some work. When I rebuild my window, I emit the EVENT_WINDOWSIZE event so everything else can reposition itself when the event is triggered. For the HUD camera, I might leave it in the center and work out of the default position of the middle. This will remove the need of repositioning the camera and centered huds are more friendly to ultrawide users like myself.

Also, I was getting exceptions thrown when using Interface::ProcessEvent although the examples work. Doing this prevents the crash.

while (UltraEngine::PeekEvent())
{
	const auto ev = UltraEngine::WaitEvent();

	// IDK why I have to do this..
	if (ev.id != UltraEngine::EVENT_WINDOWSIZE && m_spInterface != NULL) m_spInterface->ProcessEvent(ev);
  
  	....

Also, I found an assert when instancing a text sprite and then setting its text to a new string. My stats counter makes new pointers for each drop shadow. I'll write an example demonstrating this when it's not midnight...

 

Once UI is done, then I have to make a client/server setup. :(

 

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

On 12/28/2022 at 9:07 PM, SpiderPig said:
  • Setting a pivots render layer causes a crash in both debug and release (I know a pivot can not be rendered so there may not be a need for this to work)
  • Setting the pivot as box2's parent will cause it to not show in the set render layer.  (I assumed because the pivot was on a different render layer?)
  • Box2 renders on render layer 2 but it's shadow still shows on render layer 0
  • And box2 shows some sort of shadowing from the floor box on render layer 0
  • I don't think lights are working between the layers because of the shadow issues and models on layer 2 still receive light from the directional light on layer 0.  I've also made a spotlight in another project on render layer 2 and it doesn't seem to show up, but it's hard to tell due the shadowing and light from layer 0.

  Update

 

  • Fixed pivots crashing when render layer set
  • Lights will now use their render layers both for which cameras they appear in, and which objects will appear in their shadow
  • Added SetRenderLayers(const unsigned int) override so you can just specify integer bit flags (1 + 2, 65, etc). I might get rid of the RENDERLAYER_N constants because it's an advanced feature anyways, and anyone who uses Ultra Engine has already proven they are very smart by making the choice to use Ultra Engine.
  • Thanks 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

6 hours ago, reepblue said:

Also, I was getting exceptions thrown when using Interface::ProcessEvent although the examples work. Doing this prevents the crash

Update

  • Fixed crash when WINDOWSIZE event sent to 3D interface
  • Like 2

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

25 minutes ago, Josh said:

 Update

  • Fixed pivots crashing when render layer set
  • Lights will now use their render layers both for which cameras they appear in, and which objects will appear in their shadow
  • Added SetRenderLayers(const unsigned int) override so you can just specify integer bit flags (1 + 2, 65, etc). I might get rid of the RENDERLAYER_N constants because it's an advanced feature anyways, and anyone who uses Ultra Engine has already proven they are very smart by making the choice to use Ultra Engine.

Pivot crash is fixed, thanks.  I'm still getting a shadow from a cube in layer 0 cast onto a plane in layer 2 though...

ShadowOntoLayer1.thumb.png.e2e96d62b90ba4c8c99fa74b64202f37.png

scene_pivot = CreatePivot(world);
scene_pivot->SetRenderLayers(RENDERLAYER_2);

floor = CreatePlane(world, 10.0f, 10.0f);
floor->SetParent(scene_pivot);
floor->SetRenderLayers(RENDERLAYER_2);

camera_pivot = CreatePivot(world);
camera_pivot->SetRenderLayers(RENDERLAYER_2);

camera = CreateCamera(world);
camera->SetRenderLayers(RENDERLAYER_2);
camera->SetParent(camera_pivot);
camera->SetFov(70.0f);
camera->SetClearColor(1,0,0);
camera->SetHidden(true);

I can put together a better example tomorrow if you need it.

Link to comment
Share on other sites

7 hours ago, reepblue said:

Text Area is still messed up as it randomly blotches out on some lines. Just create a text box in 3D and

Works fine in this example:

#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 - Normal", 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, PROJECTION_ORTHOGRAPHIC);
    camera->SetClearColor(0.125);
    camera->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2);

    auto font = LoadFont("Fonts/arial.ttf");

    auto ui = CreateInterface(world, font, framebuffer->size);

    auto box = CreateTextArea(10, 10, 500, 300, ui->background);

    for (int n = 0; n < 3; ++n)
    {
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("How are you today?!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
        box->AddText("Hello!\n");
    }

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        while (PeekEvent())
        {
            ui->ProcessEvent(WaitEvent());
        }
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

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

8 hours ago, reepblue said:

Also, I found an assert when instancing a text sprite and then setting its text to a new string. My stats counter makes new pointers for each drop shadow. I'll write an example demonstrating this when it's not midnight...

Update

  • Fixed some bugs in game engine when text sprites are copied or instantiated
  • Like 2

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

43 minutes ago, Josh said:

Works fine in this example:

I have noticed that when I reprint the user's entry it's blotched, but when a response is printed, it's just fine. I thought it was because of wide strings but that doesn't make sense. I'll probably try your example and see if I can ether break it or it's on my side.

Also, thanks for fixing everything else. 🙂

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

Hi all, I recently discovered Leadwerks Game Engine on Steam and I am considering to buy it but then I discovered Ultra Engine is new and soon to be released.

Should I wait for Ultra Engine or if I do buy Leadwerks on Steam will there be a discount/upgrade price for Ultra Engine from owning Leadwerks already?

Is Leadwerks still worth buying in 2022?

PS, I would like to be a beta tester too.

Thanks

Link to comment
Share on other sites

Here's an example for you.  The spot light seems to be showing correctly onto layer 2 however to the right of it there's something weird going on.  You can also see the shadow from the spinning cube on layer 0 showing up on layer 2.

 

ShadowIssue2.thumb.png.beeb8c42af86f22ab31b5ee9c501c84a.png

 

#include "UltraEngine.h"
#include "ComponentSystem.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto world = CreateWorld();

    auto framebuffer = CreateFramebuffer(window);

    auto camera = CreateCamera(world);
    camera->SetClearColor(0,0,1);
    camera->SetFov(70);
    camera->SetPosition(0, 2, -3);

    auto font = LoadFont("Fonts/arial.ttf");
    auto ui = CreateInterface(world, font, framebuffer->size);
    ui->SetRenderLayers(RENDERLAYER_1);
    ui->root->SetColor(0, 0, 0, 0);

    auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    ui_cam->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0);
    ui_cam->SetRenderLayers(RENDERLAYER_1);
    ui_cam->SetClearMode(CLEAR_DEPTH);


    auto tex_buffer = CreateTextureBuffer(512, 512);
    auto cam2 = CreateCamera(world);
    cam2->SetRenderLayers(RENDERLAYER_2);
    cam2->SetClearColor(1, 0, 0);
    cam2->SetRenderTarget(tex_buffer);
    cam2->Move(0, 1, -3);

    auto light2 = CreateSpotLight(world);
    light2->SetPosition(1, 2, 0);
    light2->SetRotation(90,0,0);
    light2->SetColor(2);
    light2->SetRenderLayers(RENDERLAYER_2);

    auto floor = CreatePlane(world, 10.0f, 10.0f);
    floor->SetRenderLayers(RENDERLAYER_2);

    auto b = CreateBox(world);
    b->SetPosition(0, 1, 0);
    b->SetRenderLayers(RENDERLAYER_2);

    auto box2 = CreateBox(world);
    box2->SetPosition(0,1,0);

    auto mat = CreateMaterial();
    mat->SetTexture(tex_buffer->GetColorAttachment());

    auto sprite = CreateSprite(world, 512, 512);
    sprite->SetRenderLayers(RENDERLAYER_1);
    sprite->SetMaterial(mat);


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

    auto floor2 = CreateBox(world, 1000.0f, 0.1f, 1000.0f);

    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        box2->Turn(0, 1, 0);

        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

Link to comment
Share on other sites

2 hours ago, SpiderPig said:

Here's an example for you.  The spot light seems to be showing correctly onto layer 2 however to the right of it there's something weird going on.  You can also see the shadow from the spinning cube on layer 0 showing up on layer 2.

There are two things going on here. One is that the directional lights was being displayed in both cameras. The other is that the render target dimensions were not being considered when the lighting data was calculated.

Update

  • Fixed the two problems above

Your code will now work, but there is another way you can do this without the render-to-texture. You can set the second camera's viewport to render a smaller area on top of the background, and skip the UI camera. This is simpler to set up and it will be a little bit faster probably:

#include "UltraEngine.h"
#include "ComponentSystem.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto world = CreateWorld();

    auto framebuffer = CreateFramebuffer(window);

    auto camera = CreateCamera(world);
    camera->SetClearColor(0, 0, 1);
    camera->SetFov(70);
    camera->SetPosition(0, 2, -3);

    auto font = LoadFont("Fonts/arial.ttf");
    auto ui = CreateInterface(world, font, framebuffer->size);
    ui->SetRenderLayers(RENDERLAYER_1);
    ui->root->SetColor(0, 0, 0, 0);

    //auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    //ui_cam->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0);
    //ui_cam->SetRenderLayers(RENDERLAYER_1);
    //ui_cam->SetClearMode(CLEAR_DEPTH);

    //auto tex_buffer = CreateTextureBuffer(512, 512);
    auto cam2 = CreateCamera(world);
    cam2->SetRenderLayers(RENDERLAYER_2);
    cam2->SetClearColor(1, 0, 0);
    //cam2->SetRenderTarget(tex_buffer);
    cam2->SetViewport(0, framebuffer->size.y - 512, 512, 512);
    cam2->Move(0, 1, -3);

    auto light2 = CreateSpotLight(world);
    light2->SetPosition(1, 2, 0);
    light2->SetRotation(90, 0, 0);
    light2->SetColor(2);
    light2->SetRenderLayers(RENDERLAYER_2);

    auto floor = CreatePlane(world, 10.0f, 10.0f);
    floor->SetRenderLayers(RENDERLAYER_2);

    auto b = CreateBox(world);
    b->SetPosition(0, 1, 0);
    b->SetRenderLayers(RENDERLAYER_2);

    auto box2 = CreateBox(world);
    box2->SetPosition(0, 1, 0);

    /*auto mat = CreateMaterial();
    mat->SetTexture(tex_buffer->GetColorAttachment());

    auto sprite = CreateSprite(world, 512, 512);
    sprite->SetRenderLayers(RENDERLAYER_1);
    sprite->SetMaterial(mat);
    */

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

    auto floor2 = CreateBox(world, 1000.0f, 0.1f, 1000.0f);

    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        box2->Turn(0, 1, 0);

        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

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

@reepblueHere is a program that produces your problem:

#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 - Normal", 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, PROJECTION_ORTHOGRAPHIC);
    camera->SetClearColor(0.125);
    camera->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2);

    auto font = LoadFont("Fonts/arial.ttf");

    auto ui = CreateInterface(world, font, framebuffer->size);

    auto box = CreateTextArea(10, 10, 500, 300, ui->background);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        if (window->KeyHit(KEY_SPACE))
        {
            box->AddText(Uuid() + "\n");
        }

        while (PeekEvent())
        {
            ui->ProcessEvent(WaitEvent());
        }
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • 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

5 minutes ago, toonmad said:

I bought Leadwerks to at least support the developer, can't wait for what's new coming to Steam

Hello!

Ultra is designed to load Leadwerks file formats, including the scene file format. This makes the Leadwerks editor useful for work with Ultra, as we will not have a new editor ready until later in 2023.

Our new game engine Ultra is planned to be sold on this site only, on a subscription basis at $9.99 / mo. Developers who get it during the early access release will get a discounted price of $7.99 / mo.

What does Ultra do that's so special? Well, it's MUCH faster than Leadwerks or Unity. You can try the benchmarks yourself here:
https://github.com/UltraEngine/Benchmarks

In addition to that, there's a lot of new capabilities Leadwerks does not have. This video is a pretty good overview of what's new:

 

  • Like 2

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

13 hours ago, reepblue said:

Almost there....

image.thumb.png.c460f4c7d3bf06ad684ee9deb5e75392.png

Text Area is still messed up as it randomly blotches out on some lines. Just create a text box in 3D and 

I have not done any comparisons of this, but from that screenshot it's apparent my approach of using persistent 2D objects has performance that absolutely destroys imGUI's immediate mode method.

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

Thanks for your response Josh.

Regarding the subscription model, do you think there is a possibility to allow early adopters to purchase a lifetime license for a limited time?

Finally, I'm playing around in Leadwerks Game Engine and it seems really good, the only thing I noticed was the text on the pause menu for the games is a little broken but I am considering the C++ DLC version and wondered does the latest versions of Visual Studio work ok with it? Additionally can we use VS Code as an alternative if we want to or will it not be compatible with the gcc compiler etc?

Thanks

Link to comment
Share on other sites

27 minutes ago, toonmad said:

Regarding the subscription model, do you think there is a possibility to allow early adopters to purchase a lifetime license for a limited time?

This is not possible. The reason I am making this change is because Steam flooded their store and it doesn't bring in traffic like it used to.

28 minutes ago, toonmad said:

Finally, I'm playing around in Leadwerks Game Engine and it seems really good, the only thing I noticed was the text on the pause menu for the games is a little broken but I am considering the C++ DLC version and wondered does the latest versions of Visual Studio work ok with it? Additionally can we use VS Code as an alternative if we want to or will it not be compatible with the gcc compiler etc?

Visual Studio 2022 works with Leadwerks, but Visual Studio Code (they're really different programs) does not work.

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

2 hours ago, Josh said:

There are two things going on here. One is that the directional lights was being displayed in both cameras. The other is that the render target dimensions were not being considered when the lighting data was calculated.

Update

  • Fixed the two problems above

Confirming fixed, thanks.   I wonder - is there supposed to be a "copy code" button on all these code snippets that are posted?  I currently select the text by dragging with the mouse but vaguely remember a time there may have been this option on them?  Or maybe it's possible to add it? ^_^

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...