Jump to content

All Activity

This stream auto-updates

  1. Today
  2. I have my player being rendered to another camera on a different render layer to all else and then drawn to a texturebuffer. I want the background to be transparent and I cant see a way to remove the environment maps for that camera / render layer as all entities are in the one world. Is this possible?
  3. If you want to convert a lot of files in a batch process, you can do something like this: local dir = LoadDir("mask") for n = 1, #dir do collectgarbage() local pixmap = LoadPixmap("mask/"..dir[n]) if pixmap ~= nil then local x, y, r, g, b, a for x = 0, pixmap.size.x - 1 do for y = 0, pixmap.size.y - 1 do local rgba = pixmap:ReadPixel(x, y) r = Red(rgba) g = Green(rgba) b = Blue(rgba) a = Alpha(rgba) rgba = Rgba(g, 255 - a, r, 255) pixmap:WritePixel(x, y, rgba) end end pixmap:Save("mask/"..dir[n]) end end
  4. Updated version. This actually can load some scenes correctly, although the way unity does LODs is really weird and not every scene is compatible. Definitely break all prefabs before exporting. Unity Import.lua
  5. This extension adds a menu item in the texture editor that will do the necessary channel swizzle to convert a unity "mask texture" into the standard occlusion / roughness / metal map that Khronos glTF and Ultra use. After the process finishes you can save the texture, probably in DDS format with BC7 compression, and start using it. Unity Mask Texture.lua
  6. Yesterday
  7. 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; }
  8. 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; }
  9. 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.
  10. 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
  11. 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.
  12. You could also use alpha masking, and define a fragment shader in the depth pass settings.
  13. Made it work with strippleMaterial->SetTransparent(true);
  14. Hmm I'm not sure then. Josh will know. 😁
  15. 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" } } } } } } }
  16. 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?
  17. How does discard work? Looks like it ignores any mesh, not only mesh with this shader
  18. 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.
  19. @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.
  20. Maybe not: https://discord.com/channels/1175951843118031049/1175951843612954786/1242663005158772756
  21. 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.
  22. 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.
  23. I havn't looked at the stipple shader yet but maybe it should be a line mesh?
  24. 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; }
  25. 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.
  26. 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.
  27. Last week
  28. 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.
  1. Load more activity
×
×
  • Create New...