URP Cookbook: Compute shaders - Part 1: Particle fun
3-Second Blueprint (English)
- Allocates a GPU-resident ComputeBuffer by element count and stride, transferring particle structs from RAM to VRAM via SetData.
- Dispatches HLSL compute kernels in (256, 1, 1) thread groups to update thousands of particle positions and lifetimes in parallel.
- Binds a read-only StructuredBuffer indexed by instanceID in a URP point shader to position particles and fade RGBA alpha over life.
Compute ShadersUnity URPComputeBufferHLSL
3-Sekunden-Fazit (Deutsch)
- Allokiert einen GPU-residenten ComputeBuffer nach Anzahl und Stride und überträgt Partikeldaten per SetData vom RAM in den VRAM.
- Startet HLSL-Compute-Kernels in (256, 1, 1)-Threadgruppen, um Tausende Partikelpositionen und Lebensdauern parallel zu berechnen.
- Bindet einen per instanceID indizierten StructuredBuffer im URP-Punkt-Shader ein, um Positionen und RGBA-Verblassen zu rendern.
Compute-ShaderUnity URPComputeBufferHLSL
Note / Hinweis: Blueprints are AI-generated educational summaries (0% Politics · 0% Religion · 0% Brainrot) and do not constitute medical, legal, or financial advice. / KI-generierte Zusammenfassung zu Bildungszwecken – ersetzt keine medizinische, rechtliche oder finanzielle Fachberatung.