Practical GPU Graphics with wgpu-py and Python






Practical GPU Graphics with wgpu-py and Python

ISBN: 9798832139647, Publish Date: 2022

Paperback: $69.99

Buy on Amazon

eBook: $49.99

About this Book


wgpu-py is the next-generation graphics API and future standard in Python for both native devices and the web, aiming to provide modern 3D graphics and computation capabilities using the GPU acceleration. This book provides all the tools you need to create advanced 3D graphics and GPU computing in Python using this new wgpu-py API.

First, this book will take you through the development environment for building wgpu-py applications in Python, and then introduce Python and wgpu-py basics, shader programs, GPU buffers, and rendering pipelines. Next, you will learn how to create primitives and simple objects in wgpu-py. As you progress through the chapters, you will get to grips with advanced wgpu-py topics, including 3D transformations, lighting calculations, colormaps, and textures. At the same time, you will learn how to create advanced 3D wgpu-py objects, including various 3D wireframes, 3D shapes, and simple and parametric 3D surfaces with colormaps and textures, as well as beautiful 2D and 3D fractal images described by complex functions. In addition, you will explore new wgpu features such as the compute shader and storage buffers, and use them to simulate large particle systems. In addition, this book will introduce the pygfx render engine that is based on wgpu-py, and show you how to use its built-in primitives to create various 3D objects. You will also learn how to build custom objects and geometries in pygfx.

By the end of this book, you will have the solid skills you need to build your own GPU-accelerated graphics and computing applications on both native devices and the web in Rust with the wgpu-py API.

The things you will learn from this book:

  • Development environment and tools for creating wgpu-py apps in Python.
  • Python and wgpu-py basics, WGSL shaders, and rendering pipeline.
  • Primitives and simple shapes in wgpu.
  • 3D transformations, model, viewing, projection, and various coordinate systems.
  • GPU buffers, uniform buffer objects, animation, and camera controls.
  • Normal vectors, lighting model, ambient, diffuse, and specular light calculations.
  • UV coordinates, texture mapping.
  • Color model, colormaps, and color interpolation.
  • 3D shapes, wireframes, surfaces, and 3D charts.
  • 2D and 3D fractal images created in the fragment shader.
  • Compute shaders, storage buffers, and large particle system simulation.
  • Introdution to the pygfx render engine.
  • Create custom objects and geometries in pygfx.