Jump to content

All Activity

This stream auto-updates

  1. Yesterday
  2. Run this code and use the arrows keys to move the player and move to intercept the box on the left. There's a few bugs here: After the first collision - "Collison Detected" is still printed to the console even after you move away from the box position, normal & speed are never above zero I've only noticed these issues when using COLLISION_TRIGGER as the collision type. So far normal collisions seem fine. #include "UltraEngine.h" using namespace UltraEngine; class MyComponent : public Component { private: public: virtual void Collide(shared_ptr<Entity> collidedentity, const Vec3& position, const Vec3& normal, const float speed) { Print(WString((float)Millisecs() / 1000.0f) + " : Collision Detected : " + WString(position) + " : " + WString(normal) + " : " + WString(speed)); } }; 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 framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 2, -6); camera->SetDebugPhysicsMode(true); //Create light auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); light->SetColor(3); auto trigger = CreateBox(world, 4); trigger->SetPosition(-4, 3, 0); trigger->SetCollisionType(COLLISION_TRIGGER); trigger->AddComponent<MyComponent>(); auto floor = CreateBox(world, 100.0f, 0.1f, 100.0f); auto box = CreateCylinder(world, 0.5f, 1.8f); box->SetCollisionType(COLLISION_PLAYER); box->SetMass(1.0f); box->SetPosition(0, 0.05, 0); box->SetCollider(CreateCapsuleCollider(0.5f, 1.8f)); auto joint = CreateKinematicJoint(Vec3(), box); joint->SetMaxForce(1000); joint->SetMaxTorque(1000); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { auto pos = box->GetPosition(true); auto speed = 0.25f; if (window->KeyDown(KEY_UP)) { pos.z += speed; } if (window->KeyDown(KEY_DOWN)) { pos.z -= speed; } if (window->KeyDown(KEY_LEFT)) { pos.x -= speed; } if (window->KeyDown(KEY_RIGHT)) { pos.x += speed; } joint->SetPose(pos, Vec3()); world->Update(); world->Render(framebuffer); } return 0; }
  3. This code does not capture the button in the screenshot. #include "Engine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto plugin = LoadPlugin("Plugins/FITextureLoader"); //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(); //Create main camera auto camera = CreateCamera(world); camera->SetPosition(0, 0, -3); //Create a model auto box = CreateBox(world); //Create a light auto light = CreateBoxLight(world); light->SetRange(-5, 5); light->SetRotation(34, 45, 0); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface with a semi-transparent background auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0.5); //Create widget iVec2 sz = ui->background->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->background); //Create camera auto orthocamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocamera->SetClearMode(CLEAR_DEPTH); orthocamera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); //UI will only appear in orthographic camera orthocamera->SetRenderLayers(2); ui->SetRenderLayers(2); while (true) { box->Turn(0, 1, 0); while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; default: ui->ProcessEvent(ev); break; } } if (window->KeyHit(KEY_F2)) { framebuffer->Capture(); } auto captures = framebuffer->GetCaptures(); for (auto c : captures) { auto path = GetPath(PATH_DESKTOP) + "/screenshot.jpg"; c->Save(path); RunFile(path); } world->Update(); world->Render(framebuffer); } return 0; }
  4. In earlier builds, yes. In more recent builds I changed it so the MSAA resolve happens at the beginning of the post-processing chain. The reason for this is that the depth buffer is the only texture that really needs to retain its full resolution, and the shaders can access that anyways, so only depth-based effects need to worry about this.
  5. Yeah, with 3D camera it does not look good, especially while moving. SetLineStipple(LINE_STIPPLE_DASHED) was best when it was working before switching to OpenGL
  6. Keep in mind, if you have 45 degree lines they will hit some spots where they appear completely solid, and in some positions they will disappear, because it's a checker pattern.
  7. You could also use alpha masking, and define a fragment shader in the depth pass settings.
  8. Made it work with strippleMaterial->SetTransparent(true);
  9. Hmm I'm not sure then. Josh will know. 😁
  10. Same result. Not sure if i did it right tho { "shaderfamily": { "root": "Shaders/PBR.fam", "static": { "float": { "opaque": { "default": { "base": { "vertex": "Shaders/PBR/PBR.vert", "fragment": "Shaders/Editor/Stipple.frag" } } }, "mask": { "default": { "base": { "vertex": "Shaders/PBR/PBR.vert", "fragment": "Shaders/Editor/Stipple.frag" } } } } } } }
  11. Discard means the pixel is not being drawn to. I.e discarded or ignored. Maybe the shader needs to be applied to the mask section of the shader family as well?
  12. How does discard work? Looks like it ignores any mesh, not only mesh with this shader
  13. small correction: void main() { ivec2 coord = ivec2(gl_FragCoord.x, gl_FragCoord.y); outColor = texelFetch(ColorBuffer, coord,gl_SampleID); outColor.rgb = aces(outColor.rgb); } this also uses the sampleID, which might be better in this case.
  14. @klepto2 and I had a discussion on discord about the Tone Mapping post effect blurring the result. It's really easy to tell if you load these images in Microsoft paint and zoom into a particular section. You'll see that the pixels have defiantly been blurred with the post effect. Not sure if this is just Nvidia or not. I'm using a GTX 980 TI. I fixed the blur by changing this: vec2 coord = ivec2(gl_FragCoord.x, gl_FragCoord.y) / vec2(DrawViewport.z, DrawViewport.w); To this: vec2 coord = vec2(gl_FragCoord.x, gl_FragCoord.y) / vec2(DrawViewport.z, DrawViewport.w); Klepto also suggest this might be better: void main() { ivec2 coord = ivec2(gl_FragCoord.x, gl_FragCoord.y); outColor = texelFetch(ColorBuffer, coord,0); outColor.rgb = aces(outColor.rgb); } Before: After: Also you may notice that when the post effect is applied Framebuffer::Capture() no longer get's the stuff from the 2nd UI camera... that may be another bug report though.
  15. Maybe not: https://discord.com/channels/1175951843118031049/1175951843612954786/1242663005158772756
  16. Thanks! Will try do to so later. Looks like i was thinking about recently for 3D GUI elements (circle to show range for example) and noticed it in latest Workshop.
  17. If you add this inside the shaderfamily structure in the file, it will behave like a standard shader: "root": "Shaders/PBR.fam" Note that this shader is not really line stippling, it just discards pixels in a grid pattern.
  18. I havn't looked at the stipple shader yet but maybe it should be a line mesh?
  19. Model just became invisible with it. What am i doing wrong? #include "UltraEngine.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->SetPosition(0, 0, -4); //Create a light auto light = CreateBoxLight(world); light->SetRotation(45, 35, 0); light->SetRange(-10, 10); light->SetColor(2); //Create a model auto model = CreateBox(world); model->SetColor(0, 0, 1, 0.5f); auto strippleMaterial = CreateMaterial(); ChangeDir(AppDir()); auto strippleShader = LoadShaderFamily("Shaders/Editor/Stipple.fam"); strippleMaterial->SetShaderFamily(strippleShader); model->SetMaterial(strippleMaterial); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  20. The latest build on Steam adds a timer that ticks once every second. This causes the program to not sit idly for long periods of time, and will cause the Steam_runcallbacks function to be called periodically.
  21. 0.9.6 Added a timer so the Steam callbacks function gets called periodically when the application is idle. Double-clicking an entity in the scene browser now navigates the viewports to that object.
  22. Last week
  23. This extension loads a scene from Unity. Place this file in "Ultra Engine/Scripts/Start/Extensions": Unity Import.lua You can use this plugin to export a JSON file from Unity containing the open scene: https://assetstore.unity.com/packages/tools/integration/scene-to-json-exporter-280989 I recommend breaking any prefabs you have before exporting. These files can then be loaded with this extension. Select the Script > Utilities > Import Unity Scene menu item and open the JSON file you saved. Currently just the basic hierarchy is loaded with no visible meshes, but it does work.
  24. Lua projects include a .bat file in the base folder that will open VSCode with the project folder loaded and the main.lua file open.
  25. Hmmm, perhaps the OP's problem is that Intel graphics are being used instead of the Nvidia card. You can check by adding this code to your main loop: while (PeekEvent()) { auto e = WaitEvent(); if (e.id == EVENT_STARTRENDERER) { Print(e.text); } }
  26. There is a bug occurring when I select the frame selection size. The labels are disappearing. https://streamable.com/if3amx?src=player-page-share
  27. Some addtional info about the problem. The problem appeared after version 0.9.4 when using Intel graphics. Updating igpu drivers from intel does not solve this problem. The editor does not start on new version of the driver. On old version (automatically installed by windows), it can launch but viewport does not work (just a gray image). If I compile through Visual Studio I get a black screen and error messages (I attached the screenshot with messages below).
  1. Load more activity
×
×
  • Create New...