Jump to content

Josh

Staff
  • Content Count

    15,718
  • Joined

  • Last visited

Everything posted by Josh

  1. A similar technique for terrain reduced system memory by 130 mb on a 2048x2048 terrain.
  2. What I mean is GTK and some other Linux libs that change with each version of Linux. There is another reason to make components optional, and that is because we can more easily update software for enterprise customers if they can skip optional components. Steam and GA would both be good candidates to make as a plugin, though I am not sure yet exactly how it would work.
  3. I tested a 1.5 million poly mesh and the BSP generation time was about three seconds. Not terrible given the size, but I would like to completely eliminate that annoying delay.
  4. We support Ubuntu 16.04. In the future I am going to use as few of third-party libraries as possible on Linux, but it's not possible to fix existing libs that keep breaking. The engine scales well, but you have to pay attention to optimization. I have seen people do things like have ten point lights constantly re-rendering a million extra polygons each frame, or a 10,000 poly collision mesh, and of course this can kill performance. Sometimes people want to just ignore these kinds of things, but optimization is an important part of development, and it should be paid attention to from the very start. The new engine I am working on does some very advanced things in order to handle the massive data the aerospace customers are working with, and I think this will have a good effect for game developers as well. It will still be possible to hit bottlenecks in the new engine, but I think most people will never come close.
  5. The GMF2 data format gives us fine control to enable fast load times. Vertex and indice data is stored in the exact same format the GPU uses so everything is read straight into video memory. There are some other optimizations I have wanted to make for a long time, and our use of big CAD models makes this a perfect time to implement these improvements. Precomputed BSP Trees For raycast (pick) operations, a BSP structure needs to be constructed from the mesh data. In Leadwerks Engine this structure is computed after a model is loaded. The "Bober Station: model from The Zone is a 46,000 poly model. Here are the build times for its BSP structure: Release: 500 milliseconds Debug: 6143 milliseconds This is not our biggest mesh. Let's assume a two million poly mesh, which is actually something we come across with CAD data. With this size model our load times increase 40x: Release: 20 seconds Debug: 4 minutes Those numbers are not good. To reduce load times I have embedded precomputed BSP structures into the GMF2 format so that they can be loaded from the file. I don't have any numbers yet because there is currently no GMF1 to GMF2 pipeline, but I believe this will significantly reduce load times, especially for large models. I am interested in the idea of replacing the BSP float vertex values with shorts to reduce memory, but I'm not going to worry about it right now. Static Meshes I also am adding making the engine dump vertex and indice data from memory by default when a mesh is sent to the GPU. This will reduce memory usage, since you normally don't need a copy of the vertex data in memory for any reason. void Mesh::Finalize(const bool makestatic) { GameEngine::Get()->renderingthreadmanager->AddInstruction(std::bind(&RenderMesh::Modify, rendermesh, vertices, indices)); if (makestatic) { if (collider == nullptr) UpdateCollider(); vertices.clear(); vertices.shrink_to_fit(); indices.clear(); indices.shrink_to_fit(); } } This change reduced our system memory usage in "The Zone" by 40 mb.
  6. Josh

    Compressed Vertex Arrays

    My best guess is this yielded a 7% performance boost, across the board. I'm not going to test in detail because it takes a lot of changes to modify the vertex format.
  7. Josh

    Compressed Vertex Arrays

    In fact, Leadwerks model files are usually measured in kilobytes rather than megabytes, so compressing those further would make very little difference in your game data size.
  8. My work with the MD3 format and its funny short vertex positions made me think about vertex array sizes. (Interestingly, the Quake 2 MD2 format uses a single char for vertex positions!) Smaller vertex formats run faster, so it made sense to look into this. Here was our vertex format before, weighing in at 72 bytes: struct Vertex { Vec3 position; float displacement; Vec3 normal; Vec2 texcoords[2]; Vec4 tangent; unsigned char color[4]; unsigned char boneweights[4]; unsigned char boneindices[4]; } According to the OpenGL wiki, it is okay to replace the normals with a signed char. And if this works for normals, it will also work for tangents, since they are just another vector. I also implemented half floats for the texture coordinates. Here is the vertex structure now at a mere 40 bytes, about half the size: struct Vertex { Vec3 position; signed char normal[3]; signed char displacement; unsigned short texcoords[4]; signed char tangent[4]; unsigned char color[4]; unsigned char boneweights[4]; unsigned char boneindices[4]; } Everything works with no visible loss of quality. Half-floats for the position would reduce the size by an additional 6 bytes, but would likely incur two bytes of padding since it would no longer by aligned to four bytes, like most GPUs prefer. So it would really only save four bytes, which is not worth it for half the precision. Another interesting thing I might work into the GMF format is Draco mesh compression by Google. This is only for shrinking file sizes, and does not lead to any increased performance. The bulk of your game data is going to be in texture files, so this isn't too important but might be a nice extra.
  9. Just posting my code here for the beginning of a file export for 3ds max: MacroScript SaveMapMacro category:"File" buttontext:"A Save GMF..." tooltip:"A Save GMF..." ( on execute do ( try ( createFile "C:\\file.txt" ) catch ( format "*** % ***\n" (getCurrentException()) ) ) ) You have to add the macro to the menu via "customize user interface". I started the name with "A " to make the item easier to find in that huge list.
  10. Josh

    GMF2 SDK Update

    The GMF2 SDK has been updated with tangents and bounds calculation, object colors, and save-to-file functionality. The GMF2 SDK is a lightweight engine-agnostic open-source toolkit for loading and saving of game models. The GMF2 format can work as a standalone file format or simply as a data format for import and export plugins. This gives us a protocol we can pull model data into and export model data from, and a format that loads large data much faster than alternative file formats. Here is an example showing how to construct a GMF2 model and save it to a file: //Create a GMF file GMFFile* file = new GMFFile; //Create a model GMFNode* node = new GMFNode(file, GMF_TYPE_MODEL); //Set the orientation node->SetMatrix(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1); //Set the object color node->SetColor(0,0,1,1); //Add one LOD level GMFLOD* lod = node->AddLOD(); //Create a triangle mesh and add it to the LOD. (Meshes can be shared.) GMFMesh* mesh = new GMFMesh(file, 3); lod->AddMesh(mesh); //Add vertices mesh->AddVertex(-0.5,0.5,0, 0,0,1, 0,0); mesh->AddVertex(0.5,0.5,0, 0,0,1, 1,0); mesh->AddVertex(0.5,-0.5,0, 0,0,1, 1,1); mesh->AddVertex(-0.5,-0.5,0, 0,0,1, 0,1); //Add triangles mesh->AddPolygon(0,1,2); mesh->AddPolygon(0,2,3); //Build vertex tangents (optional) mesh->UpdateTangents(); //Save data to file file->Save("out.gmf"); //Cleanup - This will get rid of all created objects delete file; You can get the GMF2 SDK on GitHub.
  11. Josh

    Supernatural City

    There is a very strange place I know. I might be able to sneak in, in two weeks.
  12. Upon final release, yes.
  13. I plan on paid updates every 12-18 months, but you can buy one version once and use forever.
  14. Josh

    Supernatural City

    man I could get you some interesting reference photos of some run down places.
  15. @Angelwolf Like this?: https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_Camera_SetFogMode
  16. Working on GDC 2020 lecture proposal.

    1. Thirsty Panther
    2. Josh

      Josh

      VR in aerospace and performance optimization for rendering large CAD models in real-time.

    3. Thirsty Panther

      Thirsty Panther

      Interesting and catchy :)

  17. I guess I have only done "mute". He looks like he is riding regular. The flying squirrel is pretty awesome.
  18. So in other words make it temporal rather than distance-based? That makes a lot of sense. I never really thought about that before.
  19. Josh

    Shoot Simulator

    Very cool. I bet that can save a lot of money in basic training. No ammo, no weapon maintenance, no huge shooting range to go to.
  20. Sorry, I just meant that in a matter-of-fact way. The way the plugin system is set up, the data is always run through the GMF2 data format. So we can have a plugin that loads a GLTF or USD or other files and gives it to the engine in memory as a GMF2 file, or we can make it save the GMF2 for faster loading. Bottom line is if we have an import plugin for any format, we also automatically have a converter. Plus the file format is so simple I think we will see more community-made exporters than we did with GMF1, which had a "tricky" chunk structure. Plus, we have the GMF2 SDK, which makes it easy to just create some data structures and then the code saves a file for you. So GMF2 and its SDK is a big funnel we can easily pipe all kinds of data into and either save it or load it from memory. I think loading speed is a significant consideration we should be paying attention to. This seems like a really basic consideration we should be designing file formats around, for all games. I guess I need to get some definite numbers on what mesh data load times are like under realistic use cases.
  21. @Monkey Frog Studio You've convinced me to make GMF2 our default file format. If another standard is coming along that replaced GLTF, yet still does not give us fast-loading models, we need to invent our own. We will still provide direct loading and optional conversion of GLTF files, and maybe also this new format, but some of these huge CAD files we are working with would take ages to load if we have to sort through all the data. I think we will be able to show some loading speed comparisons between GLTF and GMF2, and the difference will be massive. I am going to introduce the file format at GDC 2020, along with tools for working with it.
  22. Notice there is actually no one talking about a game-ready model format, because I guess that is boring or something. OpenGEX, Collada, and FBX are "exchange formats" for moving data between modeling programs, and I guess this USD format is too. GLTF is a scene (not model) format for web graphics, which is why it uses JPG and PNG textures. No one even considers making something for normal 3D games. What do you think the advantage of this USD format is? GLTF is nice because at least you can load all the Sketchfab content up easily.
  23. Josh

    How to use gmax

    You might actually be able to use it for commercial games: https://www.turbosquid.com/Download/?ID=L567261&DLC=4GYYVMKP7G
  24. Josh

    How to use gmax

    Not a lot of people know about this, but back in 2001 Discreet (before the company was purchased by Autodesk) released a free version of 3ds max for modding games. Back then game file formats and tools were much more highly specialized than today, so each game required a "game pack" to customize the gmax interface to support that game. I think the idea was to charge the game developer money to add support for their game. Gmax supported several titles including Quake 3 Arena and Microsoft Flight Simulator, but was later discontinued. I personally love the program because it includes only the features you need from 3ds max for hard surface modeling. It's basically a stripped down version of 3ds max with only the features you need. Gmax still survives today, apparently in the custody of Turbosquid. You can download it here. You need the gmax 1.2 installer and the Tempest game pack for Quake 3. You will also need to request a free registration key from Turbosquid. After installing gmax, you can simply find the MD3 export plugin ("md3exp.dle") in the Tempest game pack download and copy that to your "C:\gmax\plugins" directory to enable export. There is also an optional There is also an optional MD3 import script by Chris Cookson which is uploaded here for safekeeping: q3-md3.ms With the plugin system in our new engine I was able to add support for loading Quake 3 MD3 models, so you can export your gmax models and load them up in the new engine. However, there are some restrictions. The MD3 file format uses compressed vertex positions, so your vertex positions have a limited range and resolution. Additionally, there are restrictions on what you can do with the gmax program, so take a look at the licensing terms before you do anything. Still, it's a fun program to have and this is a nice feature to play around with.
  25. Quake 3 Arena player models are split into three parts. If you want to load them up, this is how: //Load Quake 3 plugin auto md3loader = LoadPlugin("Plugins/MD3.dll"); //Load Q3A character auto head = LoadModel(world, "Models/MD3/bitterman/head.md3"); auto torso = LoadModel(world, "Models/MD3/bitterman/upper.md3"); auto lower = LoadModel(world, "Models/MD3/bitterman/lower.md3"); auto tag_head = torso->FindChild("tag_head"); head->SetParent(tag_head, false); auto tag_torso = lower->FindChild("tag_torso"); torso->SetParent(tag_torso, false);
×
×
  • Create New...