-
Posts
2,411 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Posts posted by SpiderPig
-
-
An "Update All" option would be very nice for the client app.
- 1
-
Thanks In GUI alone Ultra is so much faster and more flexible than Leadwerks. In Leadwerks rendering a character like this with a 2nd camera dropped the FPS from 200 to about 50 If I remember correctly.
-
I wonder if anyone here has any clues as to how most games achieve a character editor?
As a test I scale the bone but this isn't the result that's needed. I'm thinking a float or two should be attached to each bone and the vertex shader can handle the scaling of the associated vertices around said bone. I wonder if this can be achieved in Ultra yet...
auto model = character_viewer->GetCharacter(); auto value = 0.5f * (float)slider_head_height->GetValue(); auto head_bone = model->skeleton->FindBone("Head"); head_bone->SetScale(0.5f + value);
- 2
-
I don't think camera fog is working either.
-
I'm going with render layers instead of multiple worlds. Have found a few issues;
- 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.
#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.125); 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(256, 256); auto cam2 = CreateCamera(world); cam2->SetRenderLayers(RENDERLAYER_2); cam2->SetClearColor(1, 0, 0); cam2->SetRenderTarget(tex_buffer); cam2->Move(0, 0, -5); auto light2 = CreateDirectionalLight(world); auto pivot = CreatePivot(world); //pivot->SetRenderLayers(RENDERLAYER_2);//Causes a crash auto box2 = CreateBox(world); // box2->SetParent(pivot);//box2 will not render box2->SetRenderLayers(RENDERLAYER_2); auto mat = CreateMaterial(); mat->SetTexture(tex_buffer->GetColorAttachment()); auto sprite = CreateSprite(world, 256, 256); sprite->SetRenderLayers(RENDERLAYER_1); sprite->SetMaterial(mat); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto floor = 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; }
- 1
-
3 hours ago, Josh said:
Also, you guys should use floating points when setting the 2D camera's position:
camera2D->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0.0f);
If you do integer division your position can be slightly off if the framebuffer happens to have an odd number for width or height. This WILL cause your sprites to not be pixel-perfect, and will cause blurry font rendering.
This actually fixed a few of the 3D GUI issues of panel borders missing or not lining up.
-
2 hours ago, Josh said:
Currently it's not really possible without using a pixmap, which would only work with image data in system memory, but it would probably not be too difficult to add an option for this, probably a Widget::SetTexture() method.
That would be great.
1 hour ago, Josh said:This code will work, but I don't think the engine likes constantly switching back and forth between worlds. It would be much better to use render layers to control what gets drawn on which camera. There is also a Camera::SetRealtime method which can be used to draw a camera only once or intermittently.
Didn't think about render layers. My mind was stuck in Leadwerks land.
Ultra is quickly prooving really powerfull. Cant wait to see what the next year of development brings.
-
With the GUI a transparent panel is cutting holes though it's parent. Also the same for text and sliders.
This might be similar to what @reepblue was referring to earlier with SetDepthPrepass() not working as expected?
#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(1,0,0); 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(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(RENDERLAYER_1); ui_cam->SetClearMode(CLEAR_DEPTH); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto floor = CreateBox(world, 1000.0f, 0.1f, 1000.0f); auto back_panel = CreatePanel(10, 10, 250, 500, ui->root); auto top_panel = CreatePanel(10, 10, 100, 480, back_panel); top_panel->SetColor(1, 1, 1, 0); auto text = CreateLabel("Hello", 120, 10, 100, 20, back_panel); auto slider = CreateSlider(120, 40, 100, 20, back_panel); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
-
@Josh I'm curious if the following is an acceptable way of setting a texture onto a panel. The texture is from a camera's render target and all seems to work well. I'd rather use the GUI instead of a sprite in this case as it's just easier.
widget->blocks[0].texture = texture;
-
I was wondering if that was supposed to be there.
-
It seems to work if you create two perspective cameras.
- 2
-
Here's an example for my post earlier. Rendering to a texture doesn't work from a second world. Not sure if I've set it up correctly though or if it's supposed to work yet. I've tried updating the second world in the main loop as well as rendering to a second framebuffer but creating a second framebuffer will crash the program.
If you uncomment the line below and use the first world the example works as expected.
#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.125); 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(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(RENDERLAYER_1); ui_cam->SetClearMode(CLEAR_DEPTH); auto world2 = CreateWorld(); //world2 = world; auto tex_buffer = CreateTextureBuffer(256, 256); auto cam2 = CreateCamera(world2); cam2->SetClearColor(1, 0, 0); cam2->SetRenderTarget(tex_buffer); cam2->Move(0, 0, -5); auto light2 = CreateDirectionalLight(world2); auto box2 = CreateBox(world2); auto mat = CreateMaterial(); mat->SetTexture(tex_buffer->GetColorAttachment()); auto sprite = CreateSprite(world, 256, 256); sprite->SetRenderLayers(RENDERLAYER_1); sprite->SetMaterial(mat); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto floor = CreateBox(world, 1000.0f, 0.1f, 1000.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
-
7 hours ago, Josh said:
Update
- Adjusted depth settings in transparency pass
- UTF-8 string conversion back to wide string no longer supported because it's unreliable
I noticed since this update Josh did you don't have to call "SetDepthPrepass(false)". If you comment that out your example will work.
Perhaps this isn't working as it should though?
- 1
-
On a different note, I'm trying to setup a different world to render to a sprite but am getting nothing but a black sprite. I can get it to render when using just one world for everything, but not creating a new world. This is what I have so far. (I have a gui_camera setup and working on renderlayer_1)
world = CreateWorld(); light = CreateDirectionalLight(world); render_target = CreateTextureBuffer(512, 512); camera = CreateCamera(world); camera->SetClearColor(1, 0, 0); camera->SetRenderTarget(render_target); camera->Move(0, 0, -5); material = CreateMaterial(); material->SetTexture(render_target->GetColorAttachment()); sprite = CreateSprite(sprite_world, 512, 512); sprite->SetRenderLayers(RENDERLAYER_1); sprite->SetMaterial(material); box = CreateBox(world);
-
enum RenderLayer { RENDERLAYER_NONE = 0, RENDERLAYER_0 = 1, RENDERLAYER_1 = 2, RENDERLAYER_2 = 4, RENDERLAYER_3 = 8, RENDERLAYER_4 = 16, RENDERLAYER_5 = 32, RENDERLAYER_6 = 64, RENDERLAYER_7 = 128, RENDERLAYER_ALL = 255 };
I took a look and they are powers of two so it appears you are correct.
-
I wonder if you should change SetRenderLayers() to SetRenderLayer()? Seeing as we're assigning the object to a specific layer it might make more sense.
-
Will test out the latest updates when I get home. Do you have any examples for a basic geometry shader and/or custom fragment shader or are you still ironing out the shaders?
-
You can separate each class into their own CPP and H files and then include them into your Main.cpp.
-
-
Did a clean reinstall like you said. I mucking around with UI and have noticed if I simply re-run the program below seconds apart I get a different draw order (or transparency?) each time. Project is up to date with new shaders.
#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(); world->RecordStats(); auto framebuffer = CreateFramebuffer(window); auto camera = CreateCamera(world); camera->SetClearColor(0.125); 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(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(RENDERLAYER_1); ui_cam->SetClearMode(CLEAR_DEPTH); auto panel = CreatePanel(10, 10, 100, 100, ui->root); auto p2 = CreatePanel(5, 5, 75, 75, panel); p2->SetColor(1, 0, 0); auto p3 = CreatePanel(5, 5, 50, 50, p2); p3->SetColor(0, 1, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto floor = CreateBox(world, 1000.0f, 0.1f, 1000.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(120); world->Render(framebuffer); } return 0; }
-
Creating a panel seems to disable transparency on the ui roots widget...
#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(); world->RecordStats(); auto framebuffer = CreateFramebuffer(window); auto camera = CreateCamera(world); camera->SetClearColor(0.125); 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(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(RENDERLAYER_1); ui_cam->SetClearMode(CLEAR_DEPTH); auto panel = CreatePanel(10, 10, 100, 100, ui->root); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto floor = CreateBox(world, 1000.0f, 0.1f, 1000.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(120); world->Render(framebuffer); } return 0; }
-
I did not know this.
-
Looks great. Didn't know it was so easy to manipulate the bones of an animated model - can't wait to be able to do this.
-
Love the addition of the dog Thats going to be cool to play.
Ultra Engine testing
in General Discussion
Posted
I want to be able to set a font and its size per widget - is this possible? I can only see an option for a font when creating the interface...