Giter VIP home page Giter VIP logo

minimalcompute's Introduction

Minimal Compute Shader Examples

Minimal test scenes contains compute shaders, compute buffers etc Playing with the transport between CPU <-> GPU

Unity version : 2022.1+, contains both BuiltinRP and Universal RP (URP) scenes
See branches for older Unity versions
Tested with : Win DX11

Scene Image Description
ComputeUAVTexture The most basic one, edit texture with compute shader
AsyncGPUReadbackTex Similar to ComputeUAVTexture, but use AsyncGPUReadback to get texture data back to CPU
ComputeUAVTexFlow Example of using compute to animate texture pixels
ComputePaintTexture Paint the texture by sending object positions to compute shader
ComputePaintTexture_DFT Similar to above but drawing with Epicycles using Discrete Fourier Transform. Ref to The Coding Train's youtube video
StructuredBufferWithCompute Another basic one, use compute to calculate some data and send back to CPU
AsyncGPUReadback Similar to StructuredBufferWithCompute, but use AsyncGPUReadback to get array data back to CPU
StructuredBufferNoCompute ComputeBuffer doesn't always need to stick with ComputeShader
IndirectCompute Simple indirect compute (indirect dispatch) and CopyCount
IndirectReflectedStar Draw stars on the screen only if the pixels are bright enough
ComputeSketch Draw quads on the screen with color filled by compute shader
ComputeParticlesDirect GPU Particle, drawing fixed no. of particles
ComputeParticlesIndirect GPU Particle, drawing dynamic no. of particles, no need to read back to CPU!
ComputeVertex Replace vertex buffer with StructuredBuffer and drive vertex displacement by compute
SkinnedMeshBuffer Blend the vertex data from 2 SkinnedMeshRenderer vertex buffer and render it with MeshRenderer
SkinnedMeshBuffer_DiffMesh Similar to above but blending 2 different SkinnedMeshes. The blended triangles are drawn with DrawMeshInstancedIndirect()
ComputeVertexLit A usecase of ComputeVertex so that different shader passes share same vertex data
UAVInShader Read some data back to CPU from fragment shader
AsyncGPUReadbackMesh It is much faster to update mesh vertices with compute + AsyncGPUReadback to get the vertex data back to CPU for physics

Disclaimer: The stuff here might not be the best practice / optimized :'(. But at least they works. Play them for fun.

minimalcompute's People

Contributors

cinight avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.