{"id":19817161,"url":"https://github.com/nvpro-samples/vk_displacement_micromaps","last_synced_at":"2025-10-21T19:30:45.296Z","repository":{"id":200474440,"uuid":"705579359","full_name":"nvpro-samples/vk_displacement_micromaps","owner":"nvpro-samples","description":"This sample showcases rasterizing and ray tracing displaced NVIDIA Micro-Mesh assets in Vulkan with and without the VK_NV_displacement_micromap extension.","archived":false,"fork":false,"pushed_at":"2025-01-29T17:43:25.000Z","size":394,"stargazers_count":94,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-01-29T18:33:31.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvpro-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-16T09:39:08.000Z","updated_at":"2025-01-29T17:43:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8771f28-1ede-4caf-89ab-9532959fcde9","html_url":"https://github.com/nvpro-samples/vk_displacement_micromaps","commit_stats":null,"previous_names":["nvpro-samples/vk_displacement_micromaps"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_displacement_micromaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_displacement_micromaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_displacement_micromaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fvk_displacement_micromaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvpro-samples","download_url":"https://codeload.github.com/nvpro-samples/vk_displacement_micromaps/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237539975,"owners_count":19326581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T10:11:51.657Z","updated_at":"2025-10-21T19:30:44.335Z","avatar_url":"https://github.com/nvpro-samples.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED\n\nThe **NVIDIA RTX Mega Geometry** technology supercedes displaced Micro-Meshes. This repository is archived as result.\n\nPlease have a look at this new sample [vk_tessellated_clusters](https://github.com/nvpro-samples/vk_tessellated_clusters) that showcases real-time adaptive tessellation with displacement for ray tracing and rasterization.\n\n# vk_displacement_micromaps\n\nThis is a sample for rendering models using displacement micromaps resulting in a displaced [NVIDIA Micro-Mesh](https://developer.nvidia.com/rtx/ray-tracing/micro-mesh). Micromeshes are a new geometry representation to allow high geometric complexity with a reduced memory footprint and fast BVH build times for ray-tracing.\n\nPlease refer to any additional details:\n- For a basic introduction we recommend to check the [Micro-Mesh Basics slides](https://developer.download.nvidia.com/ProGraphics/nvpro-samples/slides/Micro-Mesh_Basics.pdf) first as well as the [dmm_displacement mini-sample](https://github.com/NVIDIAGameWorks/Displacement-MicroMap-Toolkit/blob/main/mini_samples/dmm_displacement/README.md).\n- Here is also details about the fundamental [Micromesh data structures](https://github.com/NVIDIAGameWorks/Displacement-MicroMap-Toolkit/blob/main/docs/data_structures.md)\n- Rasterizing displaced micromeshes is described in the [Micro-Mesh Rasterization slides](https://developer.download.nvidia.com/ProGraphics/nvpro-samples/slides/Micro-Mesh_Rasterization.pdf)\n- Creating displaced micromeshes via the [NVIDIA Displacement-MicroMap-Toolkit](https://github.com/NVIDIAGameWorks/Displacement-MicroMap-Toolkit). This sample here is just about rendering already prepared asset.\n\nWhile micromeshes were mostly designed for raytracing hardware, this sample focuses a lot on their rasterization through either mesh shaders or compute shaders. It does, however, also implement a renderer for raytracing. The rasterization is demonstrated for both HW rasterization with task and mesh shaders and a \"software\" compute shader based approach that works well for near pixel-sized triangles.\n\nThis sample may also be interesting to those looking into doing custom tessellation for rasterization beyond the traditional tessellation shaders.\n\n\u003e Note: The Vulkan SDK may not yet contain a shaderc version that supports all the features of this sample. See *Known Issues* towards the end of this document.\n\n**Fixed Meshlet Allocation**\n\nAs mesh shaders or compute shaders use fixed allocation schemes for the number of vertices/triangles they operate on, we want to maximize the use of that memory. For mesh shaders this is the output space (`layout(max_vertices = ..., max_primitives = ...) out;`), for compute shaders we use shared memory to store transient data. Both are configured to `64 vertices` and `64 triangles`.\n\nA micromesh is the result of power-of-two subdivision of a basetriangle. We want to create the necessary triangle topology on-the-fly within the meshlet allocation.\n\nA key feature and complexity is load balancing shader work with varying subdivision levels. Both approaches rely on fixed meshlet allocations and therefore are efficient when they are utilizing that well. Triangles with high subdivision can be distributed over multiple meshlets and those with low subdivision can be batched together.\n\nMicromeshes support up to subdivision level 5, which is 1024 triangles. That means we need up to 16 x 64 meshlets to render such a displaced triangle. In the shader code we refer to such partial regions of the input triangle as *parts*. We can also *pack* multiple lower subdivision levels into one meshlet:\n\n| Subdivision Level | Microtriangles | Parts / Meshlets | Packed | Utilized Triangles | Utilized Vertices\n|-------------------|----------------|------------------|--------|--------------------|-------------------|\n|                 0 |       1        |    1             |     16 |                16  |               48  |\n|                 1 |       4        |    1             |      8 |                32  |               48  |\n|                 2 |      16        |    1             |      4 |                64  |               60  |\n|                 3 |      64        |    1             |      1 |                64  |               45  |\n|                 4 |     256        |    4             |      1 |                64  |               45  |\n|                 5 |    1024        |   16             |      1 |                64  |               45  |\n\nTo rasterize micromeshes some key operations must be performed:\n\n- **Task Shading Phase**: Implemented in the task shader, or as separate dispatch for compute shaders. We operate on a batch of basetriangles.\n  - **Coarse Culling \u0026 LoD computation**: For each basetriangle we do rudimentary culling and we can also alter the subdivision level through dynamic level of detail.\n  - **Bin Packing**: As basetriangles can yield different target subdivision levels, we risk under utilizing the meshlet allocation if we render small subdivision levels individually. For example subdivision level 2 yields 16 triangles, but we have space for 64. Therefore, bins of same subdivision level are created and packed accordingly (see table above). In the subsequent *mesh shading phase* the bins are decoded.\n- **Mesh Shading Phase**: Implemented in the mesh shader, or as separate dispatch for compute shaders. We operate either on a part of a basetriangle using all threads in the workgroup, or on multiple low subdivision level basetriangles packed together, where each gets an equal fraction of threads of the workgroup.\n  - **Micro-Triangle Generation**: A micromesh is the result of power-of-two subdivision of a basetriangle. We want to create the necessary triangle topology on-the-fly within the meshlet allocation. In this process we need to respect the edge decimation flags and ensure the resulting triangles are watertight with the tessellation of neighboring basetriangles at lower subdivision. Rasterization also allows to dynamically adjust the subdivision level and implement a level of detail (LOD) scheme.\n  - **Micro-Vertex Decoding**: There are two ways to get the object-space microvertex position:\n    - Leveraging an intrinsic `vec3 fetchMicroTriangleVertexPositionNV(sceneTLAS, instanceID, ...)` to get the object-space position directly from an instance. This is hardware-assisted and means we can use the `VkMicromapEXT`'s opaque data directly and as result do not need additional memory. The fetch implicitly snaps vertices according to the edge decimation flags of that primitive (via  `VkAccelerationStructureTrianglesDisplacementMicromapNV::displacedMicromapPrimitiveFlags`), and therefore can yield degenerated triangles.\n    - Decoding the displacement manually from the uncompressed or compressed displacement data. The benefit of this approach can be performance, as well as improved portability for rendering micromeshes on platforms that may not support it in hardware.\n\nWe recommend the [Micro-Mesh Rasterization slides](https://developer.download.nvidia.com/ProGraphics/nvpro-samples/slides/Micro-Mesh_Rasterization.pdf) which illustrate these operations in more detail.\n\nThis sample implements both vertex decoding variants through an abstract interface [`micromesh_decoder_api.glsl`](micromesh_decoder_api.glsl). The decoding process adds a healthy amount of code complexity and this layered api does allow benchmarking different decoders more easily (during research even more variants had existed). However, it should be noted that this setup could be simplified, if only the intrinsics were targeted.\n\nThe decoder implementations currently make use of several pre-computed lookup tables, to get key properties of each vertex within the meshlet as well as the meshlet index buffer permutations that are relevant.\nSimilar as before, if we would only ever use the intrinsic-based decoder, some of this could be more easily handled at runtime, by computing vertex uv-coordinates on the fly.\n\n\u003e Note: On NVIDIA hardware launching compute shader workgroups with just 32 threads may yield suboptimal performance. Hence some of the compute shaders in this sample are set to do the equivalent of two jobs at a time, increasing the threads per workgroup. The values for `MICRO_FLAT_MESH_GROUPS`, `MICRO_FLAT_TASK_GROUPS` and `MICRO_FLAT_SPLIT_TASK_GROUPS` were based on a few benchmarks.\n\n## Loading\n\nBy default the sample will load `umesh_Murex_Romosus_compressed.gltf` which can be found in the `downloaded_resources/umesh_Murex_Romosus` directory. There is also a version using uncompressed displacements of the file in the same directory, as well as the config files used for the benchmarks mentioned in the slides. The model was converted from [Ramose Murex by Three D Scans](https://threedscans.com/shell/ramose-murex/) as part of the [Micro-Mesh Construction research paper by Maggiordomo et al.](https://micromesh.di.unimi.it/).\n\nThe top menu allows to load `gltf` model files.\n\n- `DISPLACED MODEL`: Load a displaced micromesh glTF file. Either compressed or uncompressed displacement data is supported.\n- `CFG FILE`: For more complex inputs it is best to store the relevant commandline arguments in a config file and load that instead. Filenames within a config file are loaded relative to it.\n\nThe models are represented in the `MeshSet` struct:\n- `MeshInfo` represents the geometry of a mesh as a range within the scene's vertex- and indexbuffers.\n- `MeshInstance` represents a concrete instance of a geometry with a material and matrix.\n- [`common_mesh.h`](common_mesh.h) : GPU / shader representation of the mesh\n- [`meshset.hpp`](meshset.hpp) : CPU data\n- [`meshset_vk.hpp`](meshset_vk.hpp) : Vulkan representation (buffers etc.)\n- [`meshset_vk.cpp`](meshset_vk.cpp)\n\n\n## Viewing\n\nAt the top of the UI you will find some drop-downs to change what variant of the model is rendered, as well as the ability to overlay a wireframe. Although not all renderers will support overlays.\n\n## Rendering\n\nThe application always uses downsampling for anti-aliasing, and therefore renders 4x the amount of pixels than seen on screen.\nSimple forward-shading is used, you can easily hack the shading output by editing [`draw_shading.glsl`](draw_shading.glsl) and press R to reload.\n\nThe renderers only affect the rendering of the displaced data. The list of available renderers in the UI will change depending on whether the loaded file uses compressed or uncompressed data.\n\nRenderer name codes:\n\n- **uncompressed**: renders simple uncompressed displacement data\n- **compressed**: renders block-compressed displacement data\n- **ms**: rendering via mesh shader\n- **cs**: rendering via compute shader, software rasterization using atomic64 bit instructions. Culling/lod and bin packing phase is done in an extra pass and stored in scratch memory. The later actual rasterization pass goes over all the emitted visible bins. The size of the scratch memory buffer can be influenced via `maxvisiblebits` (maximum is `1 \u003c\u003c maxvisiblebits`) in the advanced rendering options. The byte size of this buffer is printed to stdout when the renderer is activated.\n- **ray**: rendering via raytracing pipeline\n\n### Generic files used by renderers\n\n- [`common.h`](common.h) : Various data structures shared between CPU and GPU representations\n- [`draw_shading.glsl`](draw_shading.glsl) : Primary surface shading functions used within the fragment shaders\n- [`draw_culling.glsl`](draw_culling.glsl) : Utilities for per-triangle culling\n\n### **uncompressed common data** (rasterization)\n\n- [`common_barymap.h`](common_barymap.h) : data-structures used to encode pre-computed meshlets for the subdivision at different lod levels\n- [`common_micromesh_uncompressed.h`](common_micromesh_uncompressed.h) : data-structures used to store the micromesh data\n- [`micromesh_culling_uncompressed.glsl`](micromesh_culling_uncompressed.glsl) : Utilities for the culling and dynamic level-of-detail of uncompressed basetriangles\n\n- [`barymap_vk.cpp`](barymap_vk.cpp) : The meshlets that are required to render each subdivision level are pre-generated here\n- [`micromesh_uncompressed_vk.cpp`](micromesh_uncompressed_vk.cpp) : CPU preparation of buffers\n- [`renderer_uncompressed_vk.cpp`](renderer_uncompressed_vk.cpp) : The renderers for rasterization of compressed displacements.\n\n### **uncompressed ms**\n\nUses mesh shader to render uncompressed displacement data.\n\n- [`micromesh_binpack.glsl`](micromesh_binpack.glsl) : Utility to help binning micromeshes of same resolution into task memory bins\n- [`draw_uncompressed_basic.task.glsl`](draw_uncompressed_basic.task.glsl) : task shader that handles multiple basetriangles and generates variable amount of mesh-shader workgroups.\n- [`draw_uncompressed_basic.mesh.glsl`](draw_uncompressed_basic.mesh.glsl) : mesh shader renders all or a portion of the basetriangle's subdivided triangles with uncompressed displacement.\n- [`draw_uncompressed_basic.frag.glsl`](draw_uncompressed_basic.frag.glsl)\n- [`draw_uncompressed_lod.task.glsl`](draw_uncompressed_lod.task.glsl) : dynamic level-of-detail, task shader that bins basetriangles of same subdivision\n- [`draw_uncompressed_lod.mesh.glsl`](draw_uncompressed_lod.mesh.glsl) : dynamic level-of-detail, mesh shader that decodes variable number of basetriangles at once\n- [`draw_uncompressed_lod.frag.glsl`](draw_uncompressed_lod.frag.glsl)\n\n### **uncompressed cs**\n\nUses compute shader to render uncompressed displacement data.\n\nThis renderer does basic \"software rasterization\" using 64-bit atomics. \nEach triangle is sampled in dynamic for loops within a single thread and pixel points \nwithin the triangle trigger a 64-bit atomicMin at the appropriate output image location.\nThe upper 32-bit store the depth, and the lower 32-bit a payload.\nThe final shading is done as fullscreen fragment shader pass and turns the 64-bit \nimage into a color and depth output. \n\nThe shading is very much simplified in this samples and always outputs global microtriangle ids as colors.\n\nSoftware rasterization may be faster than hardware rasterization for subpixel-sized \ntriangles and when only simple values need to be rasterized.\nThe software rasterization logic used here is fairly basic and was not specifically optimized.\nIt will not handle near or far clipping properly, and larger triangles can quickly lower performance a lot. A more sophisticated renderer would distribute these more complex scenarios to traditional hardware rasterization.\n\nOne compute shader pass operates similar to task shader phase and stores the result\nin a global scratch buffer. Then an indirect dispatch is computed, which performs the actual rasterization over all visible binpacks.\nInternally this global scratch buffer is also referred as \"flat\" buffer, and the number of maximum visible elements can be set in the advanced UI (`Render Advanced : flat max visible mshlts`).\n\n- [`drast_utils.glsl`](drast_utils.glsl) : Utilities for the software rasterization\n- [`micromesh_binpack_flat.glsl`](micromesh_binpack_flat.glsl) : Utility to help binning micromeshes of same resolution into bins and outputting them into a global buffer.\n- [`drast_uncompressed_lod_flat_task.comp.glsl`](drast_uncompressed_lod_flat_task.comp.glsl) : dynamic level-of-detail, compute shader that handles multiple basetriangles does culling and dynamic lod and generates variable amount of output bins written in a scratch buffer. The shader file also contains a small compute shader that computes the final dispatch indirect arguments after the task phase.\n- [`drast_uncompressed_lod_flat_mesh.comp.glsl`](drast_uncompressed_lod_flat_mesh.comp.glsl) : dynamic level-of-detail, compute shader whose workgroup operates on the binned micromeshes of the global scratch buffer and software-rasterizes them.\n- [`drast_shade_uncompressed.frag.glsl`](drast_shade_uncompressed.frag.glsl) : fullscreen fragment shader turning the 64-bit atomic back to color and depth.\n\n### **uncompressed split cs**\n\nThis is a version of the previous which does some rasterization directly within the task-shading phase. Namely, all bins that are below subdivision level 3 are rasterized directly.\nThe other triangles are sent for rasterization in the second pass through the scratch buffer. This can be slightly faster than previous.\n\n- [`micromesh_binpack_flatsplit.glsl`](micromesh_binpack_flatsplit.glsl) : Utility to help binning micromeshes of same resolution into bins. It outputs subdiv == 3 bins into a global buffer, but handles smaller bins directly.\n- [`drast_uncompressed_lod_flatsplit_task.comp.glsl`](drast_uncompressed_lod_flatsplit_task.comp.glsl) : dynamic level-of-detail, compute shader that handles multiple basetriangles does culling and dynamic lod and generates variable amount of output bins. Bins with just subdivision level 3 are written to the scratch buffer, others are directly rasterized in this pass. The shader file also contains a small compute shader that computes the final dispatch indirect arguments after the task phase.\n- [`drast_uncompressed_lod_flat_mesh.comp.glsl`](drast_uncompressed_lod_flat_mesh.comp.glsl) : dynamic level-of-detail, compute shader whose workgroup operates on the binned micromeshes of the global scratch buffer and software-rasterizes them.\n\n### **compressed ray**\n\nUses raytracing pipeline to generate an image.\n\n- [`common_micromesh_compressed_rt.h`](common_micromesh_compressed_rt.h) : data-structures used for microvertex normal shading on the GPU\n- [`dray_trace.rgen.glsl`](dray_trace.rgen.glsl) : ray generation shader\n- [`dray_trace.rhit.glsl`](dray_trace.rhit.glsl) : ray hit shader\n- [`dray_trace.rmiss.glsl`](dray_trace.rmiss.glsl) : ray miss shader\n- [`dray_blit.vert.glsl`](dray_blit.vert.glsl) : vertex shader (full screen triangle)\n- [`dray_blit.frag.glsl`](dray_blit.frag.glsl) : fragment shader that blits the ray tracing result into framebuffer and also writes appropriate `gl_FragDepth` so that the post processing ambient occlusion (HBAO) works.\n\nThe displacement data needs to be created as `VkMicromapEXT` and we also need to build the raytracing BLAS and TLAS.\n- [`micromesh_compressed_rt_vk.cpp`](micromesh_compressed_rt_vk.hpp) : Setup of displacement `VkMicromapEXT` within the scene\n- [`meshset_vk.cpp`](meshset_vk.cpp) : Look for the usage of the `MicromeshSetCompressedRayTracedVK` within the `initRayTracingGeometry` and `initRayTracingScene`, as they show how/when to use the micromap data when building the acceleration structures.\n- [`renderer_compressed_rt_vk.cpp`](renderer_compressed_rt_vk.cpp) : The renderer for raytracing the compressed displacements.\n\n### **compressed common data** (rasterization)\n\nMost of the common data here are is only relevant for rasterization.\n\nThe [Micro-Mesh Rasterization slides](https://developer.download.nvidia.com/ProGraphics/nvpro-samples/slides/Micro-Mesh_Rasterization.pdf) are explaining a lot of the details and should be consulted first.\n\nIn the UI *\"Render Settings \u003e decoder type\"* influences what decoder logic is used to decompress the displacement at render time.\n\n- [`common_micromesh_compressed.h`](common_micromesh_compressed.h) : data-structures used to represent the micromeshes on the GPU\n- [`micromesh_utils.glsl`](micromesh_utils.glsl) : Lots of small utility functions around micromeshes\n- [`micromesh_decoder.glsl`](micromesh_decoder.glsl) : The primary entry for decoding can be found here. There are three different implementations of the decoder.\n  - [`micromesh_decoder_api.glsl`](micromesh_decoder_api.glsl) : Abstraction around the different decoder implementations.\n  - [`micromesh_decoder_config.glsl`](micromesh_decoder_config.glsl) : Setup of the decoding state.\n  - [`micromesh_decoder_basetri.glsl`](micromesh_decoder_basetri.glsl) : Decoder implementation that decodes each basetriangle using additional mip information. Receives a flattened list over all basetriangles. `\"base w. mip\"` decoder type in UI.\n  - [`micromesh_decoder_microtri.glsl`](micromesh_decoder_microtri.glsl) : Decoder implementation that decodes each basetriangle by individually decoding the microtriangles required. Receives a flattened list over all basetriangles. `\"micro\"` or `\"micro (intrinsic)\"` decoder type in UI. The `\"micro (intrinsic)\"` decoder type uses the `MICRO_MTRI_USE_INTRINSIC 1` codepath.\n  - [`micromesh_decoder_microtri_eval.glsl`](micromesh_decoder_microtri_eval.glsl) : This code is only relevant for the `\"micro\"` decoder type that does not use intrinsics. There are two codepaths `MICRO_MTRI_USE_MATH 0/1` to handle details about the hierarchical decompression. The slower one relies on shader-logic (math) and by default is off, the alternative uses a pre-computed table.\n- [`micromesh_culling_compressed.glsl`](micromesh_culling_compressed.glsl) : Handles culling and dynamic level-of-detail decision.\n\nMicromesh rasterization makes a lot of use of pre-computed lookup tables for different micromesh configurations and decoders. Similar to above you will find relevant information in the appropriate files:\n- [`micromesh_decoder_utils_vk.cpp`](micromesh_decoder_utils_vk.cpp) : Some utility classes that the decoders use to prepare their data\n- [`micromesh_decoder_basetri_vk.cpp`](micromesh_decoder_basetri_vk.cpp) : Generation of input data that aids the decoding process for the `\"base w. mip\"` decoder type.\n- [`micromesh_decoder_microtri_vk.cpp`](micromesh_decoder_microtri_vk.cpp) : Generation of input data that aids the decoding process for the `\"micro\"` or `\"micro (intrinsic)\"` decoder type.\n- [`renderer_compressed_vk.cpp`](renderer_compressed_vk.cpp) : The renderers for rasterization of compressed displacements.\n\n### **compressed ms**\n\nUses mesh shader to render compressed displacement data.\n\nFollowing shader code is relevant:\n- [`micromesh_binpack.glsl`](micromesh_binpack.glsl) : Utility to help binning micromeshes of same resolution into task memory bins\n- [`draw_compressed_basic.task.glsl`](draw_compressed_basic.task.glsl) : task shader that operates on multiple micromeshes and emits a variable amount of mesh shader workgroups\n- [`draw_compressed_basic.mesh.glsl`](draw_compressed_basic.mesh.glsl) : mesh shader that decodes a single, or partial micromesh at a time\n- [`draw_compressed_basic.frag.glsl`](draw_compressed_basic.frag.glsl)\n- [`draw_compressed_lod.task.glsl`](draw_compressed_lod.task.glsl) : dynamic level-of-detail, task shader that bins micromeshes of same subdivision\n- [`draw_compressed_lod.mesh.glsl`](draw_compressed_lod.mesh.glsl) : dynamic level-of-detail, mesh shader that decodes variable number of micromeshes at once\n- [`draw_compressed_lod.frag.glsl`](draw_compressed_lod.frag.glsl)\n\n### **compressed cs**\n\nSimilar to **uncompressed cs** but handles compressed data.\n\nFollowing shader code is relevant:\n\n- [`micromesh_binpack_flat.glsl`](micromesh_binpack_flat.glsl) : Utility to help binning micromeshes of same resolution into bins and outputting them into a global buffer.\n- [`drast_utils.glsl`](drast_utils.glsl) : Utilities for the software rasterization\n- [`drast_compressed_lod_flat_task.comp.glsl`](drast_compressed_lod_flat_task.comp.glsl) : dynamic level-of-detail, compute shader whose workgroup operates on multiple micromeshes, bins micromeshes of same subdivision. Writes outputs to a global scratch buffer. It also contains a second simple compute shader that modifies the indirect dispatch buffer prior launch.\n- [`drast_compressed_lod_flat_mesh.comp.glsl`](drast_compressed_lod_flat_mesh.comp.glsl) : dynamic level-of-detail, compute shader whose workgroup operates on the binned micromeshes of the global scratch buffer and software-rasterizes them.\n- [`drast_shade_compressed.frag.glsl`](drast_shade_compressed.frag.glsl) : fullscreen fragment shader turning the 64-bit atomic back to color and depth.\n\n### **compressed split cs**\n\nJust like **uncompressed split cs** but handles compressed data.\n\n- [`micromesh_binpack_flatsplit.glsl`](micromesh_binpack_flatsplit.glsl) : Utility to help binning micromeshes of same resolution into bins. It outputs subdiv == 3 bins into a global buffer, but handles smaller bins directly.\n- [`drast_compressed_lod_flatsplit_task.comp.glsl`](drast_compressed_lod_flat_tasksplit.comp.glsl) : dynamic level-of-detail, compute shader that handles multiple basetriangles does culling and dynamic lod and generates variable amount of output bins. Bins with just subdivision level 3 are written to the scratch buffer, others are directly rasterized in this pass. The shader file also contains a small compute shader that computes the final dispatch indirect arguments after the task phase.\n- [`drast_compressed_lod_flat_mesh.comp.glsl`](drast_compressed_lod_flat_mesh.comp.glsl) : dynamic level-of-detail, compute shader whose workgroup operates on the binned micromeshes of the global scratch buffer and software-rasterizes them.\n\n## Screenshot\n\n![screenshot](doc/screenshot.jpg)\n\n# Build\nVulkan SDK 1.3.261.0 or higher\n\nUse CMake to generate solution in `/build`, leave settings as is. Must be built for x64.\n\nUse `vk_displacement_micromaps` as the start-up solution.\n\n# Known Issues \u0026 Limitations\n\n**Known Issues**\n\n- For the shader intrinsics to work you need to provide a `shaderc_shared` dll/shared library that supports the GLSL extension `GL_NV_displacement_micromap`, which at the time of writing was not supported in the Vulkan SDK. If you see compilation errors and termination of the app in some renderers or settings, that is the most likely reason. You may want to get a custom shaderc with support yourself and override CMake's `VULKANSDK_SHADERC_DLL/LIB` to point to it, which is then used by the sample. Affected are following combinations:\n  - Any *compressed* rasterization renderer when the *decoder type* is set to `micro (intrinsic)`\n  - The *compressed ray* raytracing renderer.\n\nYou can find shaderc prebuilt binaries [here](https://github.com/google/shaderc/blob/main/downloads.md) and the latest Vulkan Beta drivers from NVIDIA [here](https://developer.nvidia.com/vulkan-driver).\n\n**Limitations**\n\n- glTF files must be glTF 2.0 files; glTF 1.0 is not supported.\n- All referenced displacement files must be either compressed or uncompressed, not mixed.\n- The renderers assume a 1:1 mapping of micromap to mesh triangles without using a mapping indirection buffer.\n\n# Third Party Licenses\n\n* [`dlib_url.h`](PACKAGE-LICENSES/dlib-LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fvk_displacement_micromaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvpro-samples%2Fvk_displacement_micromaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fvk_displacement_micromaps/lists"}