$ show przemyslawzaworski/Unity3D-CG-programming
This repository is an extensive collection of over 500 standalone shader examples, compute shader implementations, and supporting C# scripts for Unity, authored by Przemysław Zaworski. It covers a wide breadth of real‑time graphics techniques including raymarching, procedural texture generation, vertex/tessellation/geometry shaders, compute‑based physics, image post‑processing (bloom, HDR, SSAO), fluid simulation, grid‑based simulations (Voronoi, Marching Cubes), and advanced rendering like DirectX Raytracing path tracing. The codebase is primarily educational and demonstrative; each file typically implements a single effect or technique in a self‑contained manner, often with references to original Shadertoy sources, ReShade conversions, or published papers. While many examples are functional and well‑structured, others include incomplete fixes or stale comments, and overall the repository serves as a large reference library rather than a production application. The quality is average—many components are boileplate‑heavy ports—but several pieces, such as the Marching Cubes compute shader with indirect draw, the multipass fluid simulation, and the volume rendering tools, exhibit solid craftsmanship and are extractable for reuse.
The LLM identified 3 files worth highlighting for reuse:
Implements the Marching Cubes isosurface extraction algorithm entirely on the GPU using a compute shader. Manages a read‑write buffer of voxel countours and generates a triangle mesh via AppendStructuredBuffer. Uses Unity's indirect draw API to render the generated geometry without CPU readback. This is a self‑containd, advanced pattern for real‑tim isosurface rendering that can be reused for any scaar field defined in a compute shader.
A multi‑pass shader implementation of incompressible fluid dynamics on the GPU. Uses multiple render textures to store velocity, pressure, and density, and iterates through advection, buoyancy, divergence, and projection passes using Jacobi iteration. Demonstrates a clean pattern for double‑buffering and inter‑pass communication that can be adapted to other iterative simulations (e.g., reaction‑diffusion, heat transfer). The shader code is self‑contained and requires only a C# script to allocate buffers and dispatch passes.
A volume rendering shader that performs screen‑space ray marching through a 3D texture. Calculates ray direction from frustum corners provided by the C# script and accumulates color and opacity along the ray with a simple transfer function. The pattern is fully self‑contained, works as a post‑processing effect, and can be repurposed for any volumetric dataset stored in a 3D texture. Includes front‑to‑back compositing and early ray termination.