Skip to content

wgpu4k/wgpu4k-samples

Repository files navigation

wgpu4k Samples

This project aims to provide a starting point for learning to use WGPU4K, bringing in samples such as the Javascript WebGPU samples, but rewritten in Kotlin. It uses wgpu4k-matrix, similarly to how the Javascript samples use wgpu-matrix, to avoid reimplementing matrices for every example.

Running Samples

Simply run gradlew jvmRun -DmainClass=samples.HelloTriangleKt, and replace HelloTriangle with your desired sample. You can also run the main functions directly in IntelliJ.

Status

This project is in alpha.

Limitations

  • Currently you can only run the samples on the JVM, but the samples themselves will work in a multiplatform project. Consequentially, other platforms could be trivially added. Contributions are welcome in this area.
  • The samples are almost directly converted from Javascript, which means code quality is poor. This isn't a bad thing per se, as the goal is to stay faithful to the original samples.
  • Some samples are missing (contributions welcome).
  • There is currently no way to add GUIs to the samples like in JS.

Available Samples

Basic Graphics

  • HelloTriangle
  • HelloTriangleMSAA
  • RotatingCube
  • TwoCubes
  • TexturedCube
  • InstancedCube
  • FractalCube
  • Cubemap

WebGPU Features

  • reversedZ (partially, requires GUI)
  • RenderBundles
  • OcclusionQuery
  • SamplerParameters
  • TimestampQuery
  • Blending

GPGPU Demos

  • ComputeBoids
  • GameOfLife
  • BitonicSort

Graphics Techniques

  • Cameras
  • NormalMap
  • ShadowMapping
  • DeferredRendering
  • Particles (HDR)
  • Points
  • ImageBlur
  • GenerateMipmap
  • Cornell
  • A-Buffer
  • SkinnedMesh
  • StencilMask
  • TextRenderingMsdf
  • VolumeRenderingTexture3D
  • Wireframe

External Samples

  • BundleCulling
  • Metaballs
  • PristineGrid
  • ClusteredShading
  • Spookyball
  • MarchingCubes
  • AlphaToCoverageEmulator

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages