-
Posts
24,629 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Josh
-
1.0.3 Tools > Carve now works
-
1.0.3 Fixed terrain normals when displacement map is used.
-
The displacement map is using BC4 compression, so I would say displacement maps probably should not use any compression at all.
-
Fixed! I'm seeing a lot of stair-stepping on the example above. It looks like it is occurring at a higher frequency than the heightmap data itself...
-
I think the Vulkan spec states that 128 is the minimum. I haven't really looked at how this varies across different hardware.
-
Okay, this will be fixed in the next update. It will be important to disable navigation on the player itself because mesh primitives are now being created with a collider added: player->SetNavObstacle(false); Scratch that, I added a check so if an entity is attached to an entity it will not contribute geometry into the navigation mesh.
-
bool GetRegKey(const WString& name, WString& value) { auto sarr = name.Split("\\"); if (sarr.size() <= 1) return false; WString file = sarr[sarr.size() - 1]; WString dir = name.Left(name.size() - 1 - file.size()); HKEY root; if (sarr[0] == "HKEY_CLASSES_ROOT") { root = HKEY_LOCAL_MACHINE; } else if (sarr[0] == "HKEY_CURRENT_CONFIG") { root = HKEY_CURRENT_CONFIG; } else if (sarr[0] == "HKEY_CURRENT_USER") { root = HKEY_CURRENT_USER; } else if (sarr[0] == "HKEY_LOCAL_MACHINE") { root = HKEY_LOCAL_MACHINE; } else if (sarr[0] == "HKEY_USERS") { root = HKEY_USERS; } else { return false; } dir = dir.Right(dir.GetSize() - sarr[0].GetSize() - 1); HKEY hKey = NULL; auto res = RegOpenKeyExW(root, dir.c_str(), 0, KEY_READ, &hKey); if (res != ERROR_SUCCESS) return false; WCHAR szBuffer[2048]; DWORD dwBufferSize = sizeof(szBuffer); DWORD type = REG_LINK; res = RegQueryValueExW(hKey, file.c_str(), 0, &type, (LPBYTE)szBuffer, &dwBufferSize); RegCloseKey(hKey); if (res != ERROR_SUCCESS) return false; value = wstring(szBuffer); return true; } bool GetRegKey(const WString& name, uint32_t& value) { auto sarr = name.Split("\\"); if (sarr.size() <= 1) return false; WString file = sarr[sarr.size() - 1]; WString dir = name.Left(name.size() - 1 - file.size()); HKEY root; if (sarr[0] == "HKEY_CLASSES_ROOT") { root = HKEY_LOCAL_MACHINE; } else if (sarr[0] == "HKEY_CURRENT_CONFIG") { root = HKEY_CURRENT_CONFIG; } else if (sarr[0] == "HKEY_CURRENT_USER") { root = HKEY_CURRENT_USER; } else if (sarr[0] == "HKEY_LOCAL_MACHINE") { root = HKEY_LOCAL_MACHINE; } else if (sarr[0] == "HKEY_USERS") { root = HKEY_USERS; } else { return false; } dir = dir.Right(dir.GetSize() - sarr[0].GetSize() - 1); HKEY hKey = NULL; auto res = RegOpenKeyExW(root, dir.c_str(), 0, KEY_READ, &hKey); if (res != ERROR_SUCCESS) return false; DWORD result; DWORD dwBufferSize = sizeof(result); DWORD type = REG_DWORD; res = RegQueryValueExW(hKey, file.c_str(), 0, &type, (LPBYTE)&result, &dwBufferSize); RegCloseKey(hKey); if (res != ERROR_SUCCESS) return false; value = result; return true; } bool GetRegKey(const WString& name, uint64_t& value) { auto sarr = name.Split("\\"); if (sarr.size() <= 1) return false; WString file = sarr[sarr.size() - 1]; WString dir = name.Left(name.size() - 1 - file.size()); HKEY root; if (sarr[0] == "HKEY_CLASSES_ROOT") { root = HKEY_LOCAL_MACHINE; } else if (sarr[0] == "HKEY_CURRENT_CONFIG") { root = HKEY_CURRENT_CONFIG; } else if (sarr[0] == "HKEY_CURRENT_USER") { root = HKEY_CURRENT_USER; } else if (sarr[0] == "HKEY_LOCAL_MACHINE") { root = HKEY_LOCAL_MACHINE; } else if (sarr[0] == "HKEY_USERS") { root = HKEY_USERS; } else { return false; } dir = dir.Right(dir.GetSize() - sarr[0].GetSize() - 1); HKEY hKey = NULL; auto res = RegOpenKeyExW(root, dir.c_str(), 0, KEY_READ, &hKey); if (res != ERROR_SUCCESS) return false; uint64_t result; DWORD dwBufferSize = sizeof(result); DWORD type = REG_QWORD; res = RegQueryValueExW(hKey, file.c_str(), 0, &type, (LPBYTE)&result, &dwBufferSize); RegCloseKey(hKey); if (res != ERROR_SUCCESS) return false; value = result; return true; }
-
I'm assuming that's the problem. I just uploaded an update that flips the direction of faces in mesh colliders.
-
The direction a polygon faces, given three indices in order. It can be one direction or the other.
-
Okay, I fixed a bug in the OBJ loader that was flipping some faces. However, I do not know if the handedness of the physics matches the handedness of the renderer...
-
It looks like the top and bottom have the opposite orientation as the sides, although I can't say for sure which is right. Maybe the physics system has a different handedness than the renderer...
-
It appears to be loading correctly. Maybe the faces are all backwards, either in the shape, or they could be getting flipped in my loader...
-
Confirmed: #include "UltraEngine.h" #include "Components/CameraControls.hpp" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the display list 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(); world->SetAmbientLight(0); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetFov(70); camera->SetPosition(0, 50, 0); camera->SetRotation(45, 0, 0); camera->SetClearColor(0.125); camera->SetTessellation(4.0); //camera->SetDepthPrepass(false); //camera->SetWireframe(true); //Sunlight auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); //Create terrain auto terrain = CreateTerrain(world, 512); terrain->LoadHeightmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Terrain/512.r16", 100); //Create base material auto ground = CreateMaterial(); auto diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_diff_4k.dds"); auto normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_nor_gl_4k.dds"); ground->SetTexture(diffusemap, TEXTURE_DIFFUSE); ground->SetTexture(normalmap, TEXTURE_NORMAL); terrain->SetMaterial(ground); //Create paint material auto rocks = CreateMaterial(); diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k.dds"); normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_dot3.dds"); auto dispmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_disp.dds"); rocks->SetTexture(diffusemap, TEXTURE_DIFFUSE); rocks->SetTexture(normalmap, TEXTURE_NORMAL); rocks->SetTexture(dispmap, TEXTURE_DISPLACEMENT); rocks->SetDisplacement(4, -2); //Apply material based on terrain slope for (int x = 0; x < terrain->resolution.x; ++x) { for (int y = 0; y < terrain->resolution.y; ++y) { float slope = terrain->GetSlope(x, y); if (slope > 15.0f) { float wt = Min((slope - 15.0f) / 10.0f, 1.0f); terrain->SetMaterial(x, y, rocks, wt); } } } //Camera controls camera->AddComponent<CameraControls>(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
-
Shaders now updated.
-
Currently it seems to not work at all: #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 framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetFov(70); camera->SetClearColor(0.125); camera->SetPosition(0, 3, -6); camera->SetRotation(35, 0, 0); //Create light auto light = CreateBoxLight(world); light->SetRange(-20, 20); light->SetArea(20, 20); light->SetRotation(35, 35, 0); light->SetColor(3); //Create scene auto ground = CreateBox(world, 10, 1, 10); ground->SetPosition(0, -0.5, 0); ground->SetColor(0, 1, 0); auto wall = CreateBox(world, 1, 2, 4); wall->SetPosition(3, 0, 0); //Create navmesh auto navmesh = CreateNavMesh(world, 10, 5, 10, 4, 4); navmesh->SetDebugging(true); navmesh->Build(); //Create player auto player = CreateCylinder(world, 0.4, 1.8); player->SetColor(0, 0, 1); auto agent = CreateNavAgent(navmesh); player->Attach(agent); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->MouseHit(MOUSE_LEFT)) { auto mousepos = window->GetMousePosition(); auto rayinfo = camera->Pick(framebuffer, mousepos.x, mousepos.y); if (rayinfo.success) { agent->Navigate(rayinfo.position); } } world->Update(); world->Render(framebuffer); } return 0; }
-
Above issues are now fixed.
-
1.0.3 Library is updated. Terrain collision updated to work with half-float height format.
-
glTF files do not store external materials. I could add the material path in the "extras" info but it would create a discontinuity where Ultra would be loading external materials, but every modeling application would be loading something different. I think this would cause more problems than it solves. glTF files CAN store textures in different paths, but in practice this is never done, and it would always be relative to the glTF file itself, not to the project. So you would end up with a lot of paths like "../../Nature/rock.dds" which I think would be prone to breakage.
-
I have it working now. The depth pre-pass seems to not be considering the discard mask. Load heightmap seems to not be working with colliision. But the missing functionailty is added. #include "UltraEngine.h" #include "Components/CameraControls.hpp" using namespace UltraEngine; const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; int main(int argc, const char* argv[]) { //Get the display list auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Terrain Cut", 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->SetFov(70); camera->SetPosition(0, 100, -100); camera->SetRotation(45, 0, 0); camera->SetClearColor(0.125); camera->SetDepthPrepass(false); //Sunlight auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); //Create terrain auto terrain = CreateTerrain(world, 512); //terrain->LoadHeightmap(remotepath + "/Terrain/512.r16"); terrain->SetScale(1, 1, 1); //Create base material auto ground = CreateMaterial(); auto diffusemap = LoadTexture(remotepath + "/Materials/Ground/river_small_rocks_diff_4k.dds"); auto normalmap = LoadTexture(remotepath + "/Materials/Ground/river_small_rocks_nor_gl_4k.dds"); ground->SetTexture(diffusemap, TEXTURE_DIFFUSE); ground->SetTexture(normalmap, TEXTURE_NORMAL); terrain->SetMaterial(ground); //Camera controls camera->AddComponent<CameraControls>(); shared_ptr<Entity> ball; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->MouseHit(MOUSE_RIGHT)) { ball = CreateSphere(world); ball->SetMass(10); ball->SetPosition(camera->position); } if (window->MouseDown(MOUSE_LEFT)) { auto mousepos = window->GetMousePosition(); auto pickinfo = camera->Pick(framebuffer, mousepos.x, mousepos.y); if (pickinfo.success) { if (pickinfo.entity == terrain) { iVec2 pos; pos.x = Round(pickinfo.position.x) + terrain->resolution.x / 2; pos.y = Round(pickinfo.position.z) + terrain->resolution.y / 2; int radius = 10; for (int x = pos.x - radius; x < pos.x + radius; ++x) { for (int y = pos.y - radius; y < pos.y + radius; ++y) { terrain->SetTileHidden(x, y, not window->KeyDown(KEY_CONTROL)); } } } } } world->Update(); world->Render(framebuffer); } return 0; }
-
App freezes after deleting an enitity with a component
Josh replied to Dreikblack's topic in Bug Reports
Next build. The library takes a while to upload, so I tend to not update it more than once a day or so. -
Preprocessor no longer in use!
-
If you have multiple materials referencing the same texture, it’s still just one texture
-
I think that buffer gets dynamically resized, so it doesn't even matter if you hit the initial limit. The texture arrays on the other hand are fixed size, because they are declared in the shaders.
-
Yes, each material will be unique, but it doesn't really matter. Rendering is grouped by shader family. The material is just a small structure stored in memory. Each mesh stores an index to the material, and its looked up in the shader itself, so it really has no effect on the performance of the rendering code.
-
App freezes after deleting an enitity with a component
Josh replied to Dreikblack's topic in Bug Reports