{"id":14960425,"url":"https://github.com/cinight/minimalcompute","last_synced_at":"2025-05-14T21:06:40.817Z","repository":{"id":40437657,"uuid":"213367524","full_name":"cinight/MinimalCompute","owner":"cinight","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-02T22:33:58.000Z","size":58916,"stargazers_count":1357,"open_issues_count":1,"forks_count":131,"subscribers_count":26,"default_branch":"6000.0","last_synced_at":"2025-05-14T21:06:35.552Z","etag":null,"topics":["compute-shaders","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cinight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-07T11:38:59.000Z","updated_at":"2025-05-14T16:01:57.000Z","dependencies_parsed_at":"2024-01-14T01:25:40.971Z","dependency_job_id":"7f83fc12-a6c7-45fe-a312-217e11bf68bb","html_url":"https://github.com/cinight/MinimalCompute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinight%2FMinimalCompute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinight%2FMinimalCompute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinight%2FMinimalCompute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinight%2FMinimalCompute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cinight","download_url":"https://codeload.github.com/cinight/MinimalCompute/tar.gz/refs/heads/6000.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227612,"owners_count":22035669,"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":["compute-shaders","unity","unity3d"],"created_at":"2024-09-24T13:22:15.191Z","updated_at":"2025-05-14T21:06:35.803Z","avatar_url":"https://github.com/cinight.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal Compute Shader Examples\nMinimal test scenes contains compute shaders, compute buffers etc\nPlaying with the transport between CPU \u003c-\u003e GPU\n\nUnity version : 6000.0 (Unity 6.0), contains both `BuiltinRP` and `Universal Render Pipeline (URP)` scenes \\\nSee branches for older Unity versions \\\nTested with : Win DX11\n\n| Scene | Image | Description |\n| --- | --- | --- |\n| 🔷 **01_Compute_Texture** 🔷 | |\n| `01_1_Basic` | \u003cimg src=\"READMEimages/01_1_Basic.gif\" width=\"250\" /\u003e | The most basic one, edit texture with compute shader, shader takes the texture for rendering |\n| `01_2_FallingSand` | \u003cimg src=\"READMEimages/01_2_FallingSand.gif\" width=\"250\" /\u003e | Example of using compute to animate texture pixels |\n| `01_3_Fluid_2D` | \u003cimg src=\"READMEimages/01_3_Fluid_2D.gif\" width=\"250\" /\u003e | GPU Fluid. Ref to [Scrawk/GPU-GEMS-2D-Fluid-Simulation](https://github.com/Scrawk/GPU-GEMS-2D-Fluid-Simulation) |\n| `01_4_Fluid_3D` | \u003cimg src=\"READMEimages/01_4_Fluid_3D.gif\" width=\"250\" /\u003e | A 3D version based on above GPU Fluid |\n| 🔷 **02_StructuredBuffer** 🔷 | |\n| `02_1_StructuredBufferNoCompute` | \u003cimg src=\"READMEimages/02_1_StructuredBufferNoCompute.gif\" width=\"250\" /\u003e | ComputeBuffer can also be used in Shader, not just ComputeShader. The folder contains implementation of unlit vert-frag, surface shader and unlit URP shader |\n| `02_2_ComputePaintTexture` | \u003cimg src=\"READMEimages/02_2_ComputePaintTexture.gif\" width=\"250\" /\u003e | Paint the texture by sending object positions to compute shader with StructuredBuffer |\n| `02_3_RotatingCircles` | \u003cimg src=\"READMEimages/02_3_RotatingCircles.gif\" width=\"250\" /\u003e | Similar to above, just another playground scene |\n| `02_4_ComputePaintTexture_DFT` | \u003cimg src=\"READMEimages/02_4_ComputePaintTexture_DFT.gif\" width=\"250\" /\u003e | Similar to above but drawing with Epicycles using Discrete Fourier Transform. Ref to [The Coding Train's youtube video](https://www.youtube.com/watch?v=MY4luNgGfms) |\n| `02_5_ComputeParticlesDirect` | \u003cimg src=\"READMEimages/02_5_ComputeParticlesDirect.gif\" width=\"250\" /\u003e | GPU Particle, drawing fixed no. of particles |\n| `02_6_ComputeSketch` | \u003cimg src=\"READMEimages/02_6_ComputeSketch.gif\" width=\"250\" /\u003e | Draw quads on the screen with color filled by compute shader |\n| `02_7_ShimmerSphere` | \u003cimg src=\"READMEimages/02_7_ShimmerSphere.gif\" width=\"250\" /\u003e | Pass spheres position and radius to quad material for a fake shimmer effect |\n| 🔷 **03_GPU_to_CPU** 🔷 | |\n| `03_1_StructuredBufferWithCompute` | \u003cimg src=\"READMEimages/03_1_StructuredBufferWithCompute.gif\" width=\"250\" /\u003e | Another basic one, use compute to calculate some data and send back to CPU |\n| `03_2_AsyncGPUReadback` | \u003cimg src=\"READMEimages/03_2_AsyncGPUReadback.gif\" width=\"250\" /\u003e | Similar to `StructuredBufferWithCompute`, but use AsyncGPUReadback to get array data back to CPU |\n| `03_3_AsyncGPUReadbackTex` | \u003cimg src=\"READMEimages/03_3_AsyncGPUReadbackTex.gif\" width=\"250\" /\u003e | Result is same as `ComputeUAVTexture`, but this scene uses AsyncGPUReadback to get texture data back to CPU, and CPU send the texture data to Shader for rendering |\n| `03_4_AsyncGPUReadbackMesh` | \u003cimg src=\"READMEimages/03_4_AsyncGPUReadbackMesh.gif\" width=\"250\" /\u003e | Update mesh vertices with compute + AsyncGPUReadback to get the vertex data back to CPU for physics |\n| `03_5_AsyncGPUReadbackMesh_NewMeshAPI` | \u003cimg src=\"READMEimages/03_4_AsyncGPUReadbackMesh.gif\" width=\"250\" /\u003e | Same as above but using the [new Mesh API](https://github.com/Unity-Technologies/MeshApiExamples) |\n| `03_6_PixelPercentage` | \u003cimg src=\"READMEimages/03_6_PixelPercentage.gif\" width=\"250\" /\u003e | Count the filled pixel percentage |\n| `03_7_ColorPalette` | \u003cimg src=\"READMEimages/03_7_ColorPalette.JPG\" width=\"250\" /\u003e | Find the top colors and replace them |\n| 🔷 **04_Indirect** 🔷 | |\n| `04_1_IndirectCompute` | \u003cimg src=\"READMEimages/04_1_IndirectCompute.gif\" width=\"250\" /\u003e | Simple indirect compute (indirect dispatch) and CopyCount |\n| `04_2_ComputeParticlesIndirect` | \u003cimg src=\"READMEimages/04_2_ComputeParticlesIndirect.gif\" width=\"250\" /\u003e | GPU Particle, drawing dynamic no. of particles, no need to read back to CPU! |\n| `04_3_ComputeParticlesIndirect_VFX` | \u003cimg src=\"READMEimages/04_3_ComputeParticlesIndirect_VFX.gif\" width=\"250\" /\u003e | Implementation of above scene with VFX graph |\n| `04_4_IndirectReflectedStar` | \u003cimg src=\"READMEimages/04_4_IndirectReflectedStar.gif\" width=\"250\" /\u003e | Draw stars on the screen only if the pixels are bright enough |\n| 🔷 **05_Shader_to_CPU** 🔷 | |\n| `05_1_UAVInShader` | \u003cimg src=\"READMEimages/05_1_UAVInShader.gif\" width=\"250\" /\u003e | Read some data back to CPU from fragment shader |\n| `05_2_ShaderBakeToTexture` | \u003cimg src=\"READMEimages/05_2_ShaderBakeToTexture.gif\" width=\"250\" /\u003e | Bake shader pixel result to texture |\n| 🔷 **06_Compute_Mesh** 🔷 | |\n| `06_1_ComputeVertex` | \u003cimg src=\"READMEimages/06_1_ComputeVertex.gif\" width=\"250\" /\u003e | Replace vertex buffer with StructuredBuffer and drive vertex displacement by compute |\n| `06_2_ComputeVertexLit` | \u003cimg src=\"READMEimages/06_2_ComputeVertexLit.gif\" width=\"250\" /\u003e | A usecase of above, with different shader passes share the same vertex data |\n| `06_3_SkinnedMeshBuffer_SameMesh` | \u003cimg src=\"READMEimages/06_3_SkinnedMeshBuffer_SameMesh.gif\" width=\"250\" /\u003e | Blend the vertex data from 2 SkinnedMeshRenderer vertex buffer and render it with MeshRenderer |\n| `06_4_SkinnedMeshBuffer_DiffMesh` | \u003cimg src=\"READMEimages/06_4_SkinnedMeshBuffer_DiffMesh.gif\" width=\"250\" /\u003e | Similar to above but blending 2 different SkinnedMeshes. The blended triangles are drawn with DrawMeshInstancedIndirect() |\n| `06_5_VFXGraphMeshDeform` | \u003cimg src=\"READMEimages/06_5_VFXGraphMeshDeform.gif\" width=\"250\" /\u003e | Using VFX Graph to deforming mesh (particle as vertex) |\n-------------\n\nDisclaimer: The stuff here might not be the best practice / optimized :'(. But at least they works. Play them for fun.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinight%2Fminimalcompute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcinight%2Fminimalcompute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinight%2Fminimalcompute/lists"}