Optimize Your Meshes! // OpenGL Tutorial #48

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024

Комментарии • 16

  • @OGLDEV
    @OGLDEV  10 месяцев назад +1

    Clone the sources:
    git clone --recurse-submodules github.com/emeiri/ogldev.git
    If you want to get the same version that was used in the video you can checkout the tag 'TUT_48_MESH_OPTIMIZER'.
    Build on Windows:
    Open the Visual Studio solution: ogldev\Windows\ogldev_vs_2022\ogldev_vs_2022.sln
    Build the project 'OpenGL Tutorials\Tutorial48_MeshOptimizer'
    Notes:
    1. I've implemented a similar change in the SkinnedMesh class which derives from BasicMesh. It is not presented in the video but you can check the sources for more details.
    Homework:
    1. Try to productize the mesh simplification optimization to be used in a real game. The mesh should be loaded by Assimp once and then optimized for several levels of detail based on the users request. When rendering the proper LOD should be selected based on the distance from the camera.

  • @cheerwizard21
    @cheerwizard21 9 месяцев назад +4

    I am happy that your educational content is still alive and you didn't suspended this channel. Keep it up! 🙂

    • @OGLDEV
      @OGLDEV  9 месяцев назад

      Thanks! 😃

  • @syntaxed2
    @syntaxed2 10 месяцев назад

    Hell yeah! I was just looking at this the other day :) perfect timing!

    • @OGLDEV
      @OGLDEV  10 месяцев назад +1

      Enjoy!

  • @emilfransson9764
    @emilfransson9764 2 месяца назад +1

    So it seems one may actually then use this library to generate the lods for a mesh and not just for "optimizing the only one mesh", if you get my point. A user-configurable lodtable per mesh along with that and some nice lodswapping can be made, if i understand this correctly.

    • @OGLDEV
      @OGLDEV  2 месяца назад +1

      Yes. You can integrate this library into an offline tool and then use it to visually tune the LODs. Then you can save them and during runtime dynamically switch between them.

  • @yuhaohan1451
    @yuhaohan1451 10 месяцев назад

    Thanks for the content!

    • @OGLDEV
      @OGLDEV  10 месяцев назад

      My pleasure!

  • @Test-iv4pm
    @Test-iv4pm 2 месяца назад

    In a renderer, does anything get rendered other than Meshes/Models?
    Is this like the top level? / is the end-game of a renderer to loop over a list of meshes/models and draw them?
    NEVERMIND I SEE THERE IS A LOT MORE :D

    • @OGLDEV
      @OGLDEV  2 месяца назад +1

      The job of the renderer is to generate the frame. Going over the list of meshes and drawing them is probably the simplest renderer that you can think of. A more capable renderer also handles the shadow maps, applies tone mapping/HDR/bloom, particles system, motion blur, etc. The renderer may also sort meshes by their depth or implement some method of BSP and it can calculate light spheres to calculate the light locally instead of globally.

  • @edwincarlsson9014
    @edwincarlsson9014 10 месяцев назад

    Hi and thank you! Very informative. I’ve always thought that just Assimp is enough, but I’ll have to try to optimize my meshes!
    Question: My geometry shader only allows for a single diffuse, normal, and specular map (3 in total). How should I handle meshes that have several textures per vertex? I’m very stuck here.

    • @OGLDEV
      @OGLDEV  10 месяцев назад

      You're welcome :-)
      Do you plan to use the same texture coordinates for each texture? Assimp supports loading multiple sets of texture coordinates per vertex (though I haven't used this feature yet). In general you need to assign a unique sampler for each texture and bind each texture to its corresponding sampler.

    • @cheerwizard21
      @cheerwizard21 9 месяцев назад

      1. Mix textures on CPU, if you mean several textures with similar format. Like several albedos per vertex.
      2. Maybe try to use instance rendering as well and do rendering per instance with combination of geometry shader. That way to make draw call that send all instances to gpu, all instance can be stored in some sort of InstanceBuffer. In case of DX11 it's StructuredBuffer or in case of OpenGL it's - StorageBuffer.
      3. Use Texture Array or Texture 3D and store texture index per instance or per vertex.
      4. For optimization of 3. you can generate Texture Atlas, store atlas cells & locations into instance buffer and than send it to shaders.
      5. You can use bindless textures feature in newer OpenGL. I don't really remember how to do it, since I switched to DX11 1 year ago.

  • @crouette
    @crouette 10 месяцев назад

    Any numbers on what are the frame rate improvements after the different optimizations (without simplification)?

    • @OGLDEV
      @OGLDEV  10 месяцев назад +1

      I didn't get a chance to do such measurements myself on real workloads. I guess it will be very difficult to provide a general guidance such as "the library improves the performance by 1.5x" due to the vast difference between workloads and GPUs.