Jump to content

SpiderPig

Developers
  • Posts

    2,205
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. I think it did. Josh is currently doing a bit of work on the rendering stuff he said.
  2. Just curious, did you restart the editor after creating it manually?
  3. Your numeric values should be numbers instead of strings. Not sure if this is why it's not showing up though... maybe try creating one ".h" file and another ".cpp" file for the definitions. I think this changed a while back so it might need both files as well as the json file now. Take a look at the default components to see how they work. { "component": { "properties": [ { "name": "m_WalkSpeed", "label": "Walk Speed", "value": 5.0 }, { "name": "m_SprintSpeed", "label": "Sprint Speed", "value": 10.0 } ] } }
  4. Spent today refining an old class. The above shot was generated procedurally from this JSON file. Basically, towns can be created all over a terrain. Each town is made up of districts which can be defined by vertices so can be any closed 2D shape. Each district can hold properties which can also be any 2D shape. Each property can have access points (the blue wireframe at some of the edges) and neighbouring properties are aligned to an edge and allow room for roads if that edge is an access point. Then each property can be filled with a list of models. Right now there's only one and it's placed at the centre of the property. But once each model has a footprint calculated (probably from it's AABB) it can be placed randomly within a property. Hopefully, creating some nice randomized towns. With more defined shapes and models to place I think it'll look quite random. I'm going to try and work on roads next, probably use some sort of mesh spline that weaves between the properties that have access points. { "towns": [ { "name":"TownA", "min_radius":100, "max_radius":250, "min_height":0, "max_height":1000, "min_slope":0, "max_slope":90, "scatter":false, "districts": [ { "name":"DistrictA", "enabled":true, "primary":true, "vertices":[[0,0,4],[29,0,4],[29,0,-6],[20,0,-14],[-7,0,-14],[-10,0,-10],[-6,0,0]], "edge_access":[false,false,false,false,false,false,false], "normal":[0.0,1.0,0.0], "scale":5.0, "path_width":4.0, "zone_buffer":0.25, "properties": [ { "name":"Zone1", "vertices":[[-1,0,-1],[-1,0,1],[0,0,1.5],[1,0,1],[1,0,-1]], "edge_access":[true,true,false,false, false], "scale":5.0 }, { "name":"Zone2", "vertices":[[-1,0,-1],[-1,0,1],[1,0,1],[1,0,-1]], "edge_access":[true,false,true,true,false], "scale":6.0 } ] } ] } ] }
  5. Obviously, terrain needs LOD, but if you want to still see far away towns, boulders, trees or any other objects you're going to need to stop them clipping through the terrain as those far away patches reduce in resolution. If you leave the objects at the height required for the lower LOD level (tile size of 1m) they may be clipped or vanished entirely beneath the surface when that patch reaches a tile size of 8m or 16m as you move away from it. There are three approaches I can think of to solve that but I don't know which one I should go for or if you guys might know of something even better. Don't lower the patch resolution beyond a certain tile size if the patch has certain objects on it. Easy to implement Probably makes the point of terrain LODs redundant as nearly every patch can't go beyond a certain LOD Use the tessellation shader to tessellate the areas of the terrain around certain objects based on a mask, keeping the tile size at that area no bigger than the object footprint. Fast to run Won't know how good it looks until implemented Hard to implement Adjust each object's height to a height picked at the lower patch resolution when that patch changes. Easy to implement Player will see objects pop to new heights in distance This is mostly for my voxel terrain but it pretty much applies to all terrain I think. Hopefully some of you might have some input or some better ideas.
  6. Yikes Ultra is fast! 25FPS 2,500 instanced trees 53 million verts and 19 million polys
  7. I'm about to start work on a foliage system for voxel terrain and just wanted know if the FPS for the amount of vertices and polygons seems reasonable? If so it will tell me how I should proceed. This is only a 16x16 grid of instances so the instance count is off. Bug report is here. 70 FPS for 5.4 million verts and 2 million polys. I am doing a small bit of work in the vertex shader which sways the trees. Disabling that gets me about 100 to 120FPS.
  8. In this example without any instances I have an instance count of 5, If I create an instance of the box that count goes up to 7, not 6. Is this a bug or has it made more instances for the render thread and the world is tracking those too? I need to know because another project of mine my tree model increases the instance count by 4 for each instance even though it's one model. Just want to be sure if it's my model, or a bug, or a natural part of the engines workings. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto world = CreateWorld(); world->RecordStats(); auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetSweptCulling(true); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); camera->SetRotation(0, 25, 0); auto font = LoadFont("Fonts/arial.ttf"); auto ui = CreateInterface(world, font, framebuffer->size); ui->SetRenderLayers(2); ui->root->SetColor(0, 0, 0, 0); auto w_fps = CreateLabel("FPS : 0", 10, 10, 150, 30, ui->root); auto w_vertices = CreateLabel("Vertices : 0", 10, 30, 150, 30, ui->root); auto w_primitives = CreateLabel("Primitives : 0", 10, 50, 150, 30, ui->root); auto w_instances = CreateLabel("Instances : 0", 10, 70, 150, 30, ui->root); auto ui_cam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_cam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); ui_cam->SetRenderLayers(2); ui_cam->SetClearMode(CLEAR_DEPTH); auto light = CreateDirectionalLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); light->SetColor(5.0f); auto box = CreateBox(nullptr); //Comment out this line and instacne count is 5 //Leave this line uncommented and the instacne count is 7 auto inst = box->Instantiate(world); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { w_fps->SetText("FPS : " + WString(world->renderstats.framerate)); w_vertices->SetText("Vertices : " + WString(world->renderstats.vertices)); w_primitives->SetText("Primitives : " + WString(world->renderstats.polygons)); w_instances->SetText("Instances : " + String(world->renderstats.instances)); world->Update(); world->Render(framebuffer, false); } return 0; }
  9. I just tried your example above and am getting the same result as you after a few clicks back and forth between new game and main menu. It's getting stuck somewhere weird.
  10. You are correct, that was the issue.
  11. I thought that it didn't but that might be my shader editor... I'll add that manually and see if it works.
  12. Thanks, how would this be checked inside an extension? I mean, is there an update event or loop I could add it too to check when I've closed the process?
  13. @Josh What exactly does this error mean? Is there a problem with my connection at the time of loading the client? Because after this error I then have to enter my details again - no problem - then it says authentication error again and it says my license is not active. My subscription is still active on my account here.
  14. @Andy90 As you posted on Discord, I downloaded your recent project from here. The problems that I can see are a little different because you've got your teleport function as a component that I'm pretty sure is being deleted when you erase your map so it's causing the issue. My only advice is put your teleport code somewhere within main.cpp so that it can handle the map changes on the highest level - so that it is not part of the maps your erasing. You still need to solve the camera issue by making sure a camera is always available to render too. These are the only issues that I can see, by fixing it this way I managed to get your game working without crashes. I think the current errors seem random because of the multithreading and sometimes it's not catching the fact there is no camera. Welcome to multithreading.
  15. I wonder if double clicking or right clicking a component that's been added could take us to the component file? Or some other method other than hunting it down?
  16. This worked also. You still need a camera available though for the render. g_scene = nullptr; g_world->Update(); g_world->Render(framebuffer); g_scene = LoadMap(g_world, "Maps/TestScene.ultra");
  17. My advice is if you want persistent objects between maps (mainly the main camera) I would create those in C++ and just use the maps to load different environments.
  18. @Andy90 I believe I got your original upload to work as you expect it too. if (g_window->KeyHit(KEY_ENTER)) { if (g_scene != nullptr) { g_scene = nullptr; } else{ g_scene = LoadMap(g_world, "Maps/TestScene.ultra"); } } //if (g_scene != NULL) { g_itemMover.Update(g_window); g_playerInventory->Update(g_window); g_world->Update(); g_world->Render(framebuffer); //} It seems that setting the scene to nullptr will delete everything but your check to not update and render the world if it was nullptr meant that would never work. By removing that check and giving it a chance to delete on the first enter press I got it to work. However, the second issue I saw was the crash to RecordDraw and the framebuffer wasn't actually being cleared. This was because by deleting the map there was no longer any 3D camera available. By adding this line after creating the framebuffer, the above code worked. auto g_camera = CreateCamera(g_world); The second map also loaded okay and the player could harvest from the rock. I also got the error with the AnimationBone or something. I think that was a combination of the lack of 3D camera and not letting the first map actually clear before loading the next one. I hope this actually helps and I have not completely barked up the wrong tree.
  19. Updated to v1.3. Macros now supported and an editor extension allows you to create a shader project from an existing material.
  20. I might have some further info for you Josh. Create a new C++ project, load up the project in visual studio. Make this your loop: //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { Print("------DELETING MAP------"); scene = nullptr; } world->Update(); world->Render(framebuffer); #ifdef STEAM_API_H Steamworks::Update(); #endif } You will see in the output that it says all the material, textures and models are being deleted but nothing actually disappears from the scene. I think this is because the camera is being deleted with the map. Hope this helps. Maybe an error should be thrown if we try to render the world and there is no camera present?
  21. This is an odd one but I believe I have found the issue with it. If you load the gltf in the model editor, navigate to one of the meshes (first mesh in the list I think, but doesn't really matter) and browse for the 'Leaves' material. The leaves should go red, and while the editor updates the leaves should move around a bit. However, if the material that you apply (Leaves.mat in this case) has 'alphamask' set as true, the flag 'alphaMode' in the GLTF will be set to 'MASK' and not 'BLEND'. If 'alphaMode' is set to MASK the custom vertex shader in 'leaves.mat' which turns the leaves red and moves them, doesn't seem to load. If you manually change this back to BLEND and reload the model, the leaves should be red and move a bit as the window updates. Please let me know if I missed anything from the zip. You may need to change a few file paths in the material / shader family. PineTree.zip
  22. Upon occasion I've wanted to save the material of gltf model as a physical material file. Perhaps an 'Export' or "Save As' option here as well?
×
×
  • Create New...