This project is mirrored from https://github.com/zeux/meshoptimizer.git. Pull mirroring updated .
  1. 05 Feb, 2021 2 commits
    • Arseny Kapoulkine's avatar
      Merge pull request #239 from zeux/gltf-variants · 3bdc8125
      Arseny Kapoulkine authored
      gltfpack: Implement support for KHR_materials_variants
      3bdc8125
    • Arseny Kapoulkine's avatar
      gltfpack: Implement union-find to correctly quantize variant UVs · 0d0c363d
      Arseny Kapoulkine authored
      To make sure that all variants can be used interchangeably we need to
      make sure that whenever multiple materials can be used on a given mesh,
      the quantization grid for these materials matches.
      
      Since multiple meshes can use a single material as well, this means that
      multiple materials can be bound by the same quantization rules even if
      they are never used on the same mesh, for example:
      
      	mesh 0: materials 0, 1
      	mesh 1: materials 2, 3
      	mesh 2: materials 0, 3
      
      Here all 4 materials must use the same quantization settings even though
      materials 1 & 2 never overlap; to make all 3 meshes render correctly we
      need to use the common quantization for all 3 meshes for all 4
      materials.
      
      To make this work, we use union-find to find a single "canonical"
      material for each source mesh & material; we use that slot to accumulate
      UV bounds and then redistribute the resulting quantization parameters to
      all relevant materials.
      0d0c363d
  2. 04 Feb, 2021 1 commit
  3. 02 Feb, 2021 8 commits
  4. 31 Jan, 2021 6 commits
  5. 27 Jan, 2021 5 commits
    • Arseny Kapoulkine's avatar
      Merge pull request #235 from zeux/adj · d5620df6
      Arseny Kapoulkine authored
      indexgenerator: Implement support for triangle adjacency index buffers
      d5620df6
    • Arseny Kapoulkine's avatar
      indexgenerator: Share buildPositionRemap across two new generators · dc2823ce
      Arseny Kapoulkine authored
      This code is identical and self-sufficient so it's easy to extract.
      Building the edge table is more specialized due to the need for storing
      the opposite vertex, and the hasher along with other data is necessary
      during lookup, so it's better to leave that duplicated for now.
      dc2823ce
    • Arseny Kapoulkine's avatar
      indexgenerator: Implement support for triangle adjacency index buffers · 91fbf4e2
      Arseny Kapoulkine authored
      Several algorithms that use geometry shaders to render data require
      adjacency information; triangle-with-adjacency topology in various APIs
      provides a way to supply 3 extra vertices per each triangle that
      represent vertices opposite to each triangle's edge.
      
      This data can then be used to compute silhouettes and perform other
      types of local geometric processing.
      
      This change implements the data preprocessing step that is similar to
      the previous tessellation IB - but instead of storing vertices that
      adjoin the triangle from the opposite side, we need to store
      complementary / opposite vertices of adjacent triangles, which requires
      a separate temporary table.
      91fbf4e2
    • Arseny Kapoulkine's avatar
      Merge pull request #234 from zeux/tess · 63bacf12
      Arseny Kapoulkine authored
      indexgenerator: Implement support for PN-AEN tessellation buffers
      63bacf12
    • Arseny Kapoulkine's avatar
      indexgenerator: Implement support for PN-AEN tessellation buffers · 0ad425d7
      Arseny Kapoulkine authored
      To render a mesh with normal/UV seams using hardware tessellation, the
      PN-triangles method is not sufficient as it produces cracks on normal
      discontinuities (position displacement based on normal is not consistent
      along both sides of the seam), and displacement mapping uses slightly
      different texture samples which results in cracks along UV seams.
      
      In 2010, NVidia proposed a PN-AEN tessellation scheme that fixes the
      problem around normal discontinuities by using opposite edge normals and
      averaging the resulting control point data. In 2011, NVidia proposed a
      further tweak on top of this technique that allows to select the
      "dominant" edge by choosing the min. edge index out of the
      current/adjacent edges, and using the UV data from that edge on the
      patch edges to sample the displacement data. For corners, there can be
      more than two wedges that have the same position, so you need to store
      the dominant vertex for each patch corner as well.
      
      As a result, generating a 12-vertex patch for each input triangle allows
      to use the hardware tessellation engine to implement PN-AEN (using 9
      vertices) and/or displacement mapping (using 3 more vertices) without
      cracks.
      
      This change implements the data preprocessing step for this algorithm as
      meshopt_generateTessellationIndexBuffer; this index buffer can be
      directly fed to the GPU along with the requisite hull/domain shaders.
      
      For implementing the shader code, the following papers are recommended:
      
      John McDonald, Mark Kilgard
      Crack-Free Point-Normal Triangles using Adjacent Edge Normals. 2010
      
      John McDonald
      Tessellation on Any Budget. 2010
      
      Bryan Dudash
      My Tessellation Has Cracks! 2012
      0ad425d7
  6. 26 Jan, 2021 1 commit
  7. 25 Jan, 2021 1 commit
    • Arseny Kapoulkine's avatar
      Ensure hash tables always have some percentage of free buckets · d2811bc5
      Arseny Kapoulkine authored
      While in most cases we overallocate the hash tables as the number of
      elements we supply is an upper bound that's never reached, it's possible
      to create meshes that do reach that bound by having a power of two count
      of vertices and have all vertices be unique.
      
      To avoid catastrophic performance degradation of hash-based algorithms
      on such meshes we make sure that we have ~20% of elements free, which
      means that our expected chain length is reasonably short in all cases.
      
      Note: this isn't motivated by a specific example, but is merely done as
      a precaution.
      d2811bc5
  8. 23 Jan, 2021 4 commits
  9. 20 Jan, 2021 3 commits
  10. 19 Jan, 2021 9 commits