Jump to content

Josh

Staff
  • Posts

    23,315
  • Joined

  • Last visited

Everything posted by Josh

  1. 1.0.3 Terrain tool sliders and spinners will now respond properly to each other.
  2. 1.0.3 Added terrain editor gizmo drawing code into the terrain shader. This is the best solution because: A 3D model would require sending the updated vertices each frame, and still would not match the terrain exactly. A decal would require a very high resolution texture, and would still have visible pixels sometimes.
  3. 1.0.3 Terrain editing is nearly finished. I'm currently using a transparent sphere as the gizmo / indicator. This is not ideal but I think I want to use a decal for this, and decals aren't implemented yet. I'm not sure yet. Saving terrain in the map file format is not supported yet. Everything else shown in the editor should be working, including layer scales, constraints, UV mapping mode, etc. Speed of the terrain sculpting is currently framerate-dependent. I need to do something to regulate this to adjust for rendering time. Terrain API changed a bit. Terrain now has "layers". I did not need to add this for the materials but rather for the UV mapping mode, scale, and constraints. Originally I thought I would store these properties in the material file itself, but having those values hidden away in different files was frustrating. The "mapping scale" feature is removed from materials completely. Differences between Leadwerks and Ultra terrain: Ultra supports up to 256 different materials. Slope and height constraints are only used at the time a material is painted on. If you change the constraints values after that, it will have no effect except on new brush strokes you make. Material layers do not appear in any order. The order of the layers in the list is irrelevant. You just select the layer and start painting, and it will appear. Multiple terrains are supported, and may be positioned, rotated, and scaled. Terrain must be selected for its properties to appear in the side panel under the Terrain tab.
  4. Josh

    Terrain gizmo

    This is the code I used to create the terrain gizmo the editor uses: auto terrainwidget = CreateModel(NULL); int sides = 128; float th = 0.5 * 0.1; float x, y, a; int i = 0; CreateModel(NULL)->SetParent(terrainwidget); CreateModel(NULL)->SetParent(terrainwidget); auto mtl = CreateMaterial(); mtl->SetShaderFamily(LoadShaderFamily("Shaders/Unlit.fam")); mtl->SetTexture(LoadTexture(GetPath(PATH_DESKTOP) + "/terraingizmo.dds")); for (int i = 0; i < 2; ++i) { auto mesh = terrainwidget->kids[i]->As<Model>()->AddMesh(); if (i == 1) terrainwidget->kids[i]->SetColor(1, 1, 0, 1); mesh->SetMaterial(mtl); for (int n = 0; n < sides; ++n) { a = float(n) / float(sides) * 360.0f; x = Cos(a); y = Sin(a); mesh->AddVertex(x * (1.0 - float(i) * 0.5), 0, y * (1.0 - float(i) * 0.5), 0, 1, 0, 1, 0); mesh->AddVertex(x * (1.0 - float(i) * 0.5 - th), 0, y * (1.0 - float(i) * 0.5 - th), 0, 1, 0, 0, 0); if (n > 0) { mesh->AddPrimitive(n * 2 + 1, n * 2 + 0, (n - 1) * 2 + 0); mesh->AddPrimitive((n - 1) * 2 + 0, (n - 1) * 2 + 1, n * 2 + 1); if (n == sides - 1) { mesh->AddPrimitive(1, 0, n * 2 + 0); mesh->AddPrimitive(n * 2 + 0, n * 2 + 1, 1); } } } } terrainwidget->Save(GetPath(PATH_DESKTOP) + "/terrain.gltf");
  5. Josh

    Terrain editing WIP

    The terrain controls are morphing back to be almost identical with the Leadwerks interface, although the internal system is very different...
  6. Josh

    Terrain material blending

    Only two materials are in use.
  7. Josh

    Terrain Painting

    There are no actual "layers" in Ultra. You just select a material and start painting. The list of materials is automatically populated as you use materials, but it does not correspond to terrain layers, it's just a palette for you to paint with.
  8. Use an STL map instead of iterating through the whole array!
  9. The first thing you said. Use ListenEvent to intervept the event as it is emitted.
  10. 1.0.3 Added Tools > Mirror X, Y, Z functionality.
  11. 1.0.3 CSG hollow now works. The grid size of the current viewport is used for the thickness.
  12. It's not, for this exact reason. It's better to listen for events.
  13. Looks like that is a high-precision PNG:
  14. an 8-bit PNG is pretty useless. You will have severe stair-stepping artifacts. I can add it in, but you won't want to use those.
  15. If you do this it will work: //Create terrain auto terrain = CreateTerrain(world, 512); terrain->LoadHeightmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Terrain/512.r16", 100); //terrain->SetScale(1, 100, 1); However, I think I am going to change this behavior....
  16. Put the key hit call outside the if statement so it is always called each frame
  17. 1.0.3 Tools > Carve now works
  18. 1.0.3 Fixed terrain normals when displacement map is used.
  19. The displacement map is using BC4 compression, so I would say displacement maps probably should not use any compression at all.
  20. 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...
  21. I think the Vulkan spec states that 128 is the minimum. I haven't really looked at how this varies across different hardware.
  22. 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.
  23. 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; }
  24. I'm assuming that's the problem. I just uploaded an update that flips the direction of faces in mesh colliders.
×
×
  • Create New...