Show HN:有关 WebGPU 编程的免费电子书
Show HN: Free e-book about WebGPU Programming

原始链接: https://shi-yan.github.io/webgpuunleashed/

标题:WebGPU 编程简介 本指南对在 JavaScript 中使用 WebGPU 进行图形编程进行了介绍性探索,提供了作者 Shi Yan 在个人学习经历中获得的见解。 创建此资源的目的源于一位寻求图形编程入门指导的朋友的请求。 OpenGL 和 DirectX 等传统 API 曾经是流行的选择,但当今快速发展的图形 API 格局引入了 Vulkan、Metal 和 DirectX 12 等替代方案 - 更轻、更快但更复杂且不太普遍兼容的选项。 为了解决初学者的这种困惑,WebGPU 成为一个独特的选择。 作为概念上熟悉但功能独特的新图形 API,它旨在为网络提供本机图形功能,同时充当现有 API(Vulkan、Metal 等)的通用包装,确保与其他当代解决方案相比更容易访问。 本书涵盖了图形编程的基本方面,首先简要介绍了 GPU 驱动程序和 GPU 管道,这是传统图形 API 文献中经常被忽视的主题。 通过强调有关 GPU 驱动程序以及图形软件与底层硬件之间交互的正确知识,学生可以在不完全理解这些概念的情况下创建功能性图形应用程序。 此外,本书还深入探讨了各个方面,解释了 WebGPU 实现的基础知识,例如三角形绘图 - 3D 图形中的基本元素。 其他后续课程涵盖构建完整图形应用程序所需的基本技能,包括 2D 渲染技术和 3D 场景控制。 高级部分侧重于使用 WebGPU 探索用于计算目的的 GPU,展示超越基本三角形绘图的新颖渲染技术。 借助 WebGPU,WebGL 中以前不可能实现的 GPU 计算功能现在变得可用,为 Web 应用程序的 GPU AI 推理等创新机会铺平了道路。 最后提供了关于高斯泼溅渲染的综合教程(混合 GPU 计算和渲染的复杂示例),本指南为有抱负的程序员提供了使用 WebGPU 导航现代图形编程领域所需的工具。 在整个冒险过程中,用户将找到链接、视频解释和交互式在线平台来帮助加深他们的理解。 始终欢迎建设性批评和改进建议。 让我们一起探索惊心动魄的宇宙吧

相关文章

原文
By Shi Yan

By Shi Yan

Welcome to "WebGPU Unleashed" - your gateway to the dynamic world of graphics programming. This free book will teach you graphics programming in JavaScript using WebGPU, drawing from my own learning journey.

Why did I write this book? Recently, a friend asked me what his child should learn to get started with graphics programming. A few years ago, OpenGL was the go-to API for beginners, with DirectX as an alternative for those interested in game development.

However, the graphics API landscape has evolved significantly in recent years. A new generation of APIs has emerged, including Vulkan, Metal, and DirectX 12. These APIs are more lightweight and performant but require more verbose code. While similar in concept, they're more fragmented than OpenGL, with some only available on specific platforms. This fragmentation often confuses beginners, leaving them unsure which API to start with.

Enter WebGPU, a new graphics API conceptually similar to others but with a different goal: bringing native graphics capabilities to the web. Unlike other APIs with native implementations in graphics drivers, WebGPU is essentially a wrapper for the aforementioned APIs. This makes WebGPU appealing as a first API for several reasons:

  1. As a wrapper, WebGPU aims to be a common denominator of other APIs, making it relatively simpler.

  2. As the web graphics API standard, WebGPU is available on all platforms.

  3. For those interested in native development, there are WebGPU implementations available in C++ and Rust.

With WebGPU's recent release, now is an ideal time to learn it.

We'll begin with an overview of GPU drivers and the GPU pipeline - topics often overlooked in other graphics API books. Many students who can implement simple graphics applications lack understanding of GPU drivers and how graphics software interacts with underlying hardware. I believe covering these topics is essential.

Following this overview, we'll explore the simplest usage of WebGPU: drawing triangles, the basic elements of 3D graphics. While this might sound basic, mastering it is crucial for understanding more complex concepts. We'll then cover 2D rendering techniques and 3D scene control, necessary skills for implementing full graphics applications for the web.

In the advanced chapters, we'll look into GPU computing using WebGPU and explore advanced rendering techniques beyond simple triangles. GPU compute on the web, previously unavailable through WebGL, is now possible with WebGPU. This opens up exciting possibilities, including potential GPU AI inference for web applications.

As the book's final tutorial, we'll implement Gaussian splatting rendering - a complex example combining GPU compute and rendering. At the time of writing, Gaussian splatting is a cutting-edge scene representation and rendering technique, capable of capturing and rendering 3D scenes from real life with a high degree of realism and real-time performance.

I've put considerable effort into presenting this book's content. Initially planned as a traditional book, I realized that an interactive web format would be more effective for a tech book. This approach allows for:

  • Better explanation of concepts through videos

  • Easy citation of references via links

  • An online playground hosting all code samples, where you can run demos and modify code

All code snippets in the book are cross-referenced from the playground samples. To avoid overwhelming readers with verbose code, I've included only relevant code segments in the articles. navigation between the text and the playground is very easy .

Another advantage of this online format is the ability to receive reader feedback. If you have suggestions or improvements, please feel free to share them through GitHub discussions and issues.

Let's embark on this WebGPU journey together!

联系我们 contact @ memedata.com