Want to learn more?

That's the end of the free part of this lesson

WebGPU & TSL Course new $45 VAT incl.
  • 21 lessons · 24 hours of video
  • Quizzes · Certificate
  • Members-only Discord server · Future updates
00:00/00:00
3:22
00:03:22

Shortcuts ⌨️

  • SPACE to play / pause
  • ARROW RIGHT or L to go forward
  • ARROW LEFT or J to go backward
  • ARROW UP to increase volume
  • ARROW DOWN to decrease volume
  • F to toggle fullscreen
  • M to toggle mute
  • 0 to 9 to go to the corresponding part of the video
  • SHIFT + , to decrease playback speed
  • SHIFT + . or ; to increase playback speed

Unlock content 🔓

To get access to 93 hours of video, a members-only Discord server, subtitles, lesson resources, future updates and much more join us for only $95!

Want to learn more? 🤘

87%

That's the end of the free part of this lesson

WebGPU & TSL Course new $45 VAT incl.
  • 21 lessons · 24 hours of video
  • Quizzes · Certificate
  • Members-only Discord server · Future updates
Next lesson
WebGPU & TSL
Chapter 02 — Advanced Projects

78. Post-processing

Difficulty: Very hard02:11:23

Introduction 00:00

With TSL and WebGPU, Three.js post-processing also got a refresh.

It might sound too early in the chapter to discover such a topic, but I wanted to make the upcoming exercises look good, and there is nothing better than post-processing and a nice bloom for that.

We are going to discover how to set up our project to use post-processing, test a bunch of built-in effects, and create two custom effects: a simple one to get the hang of it, and one more complex and epic.

Setup 02:11

The starter already contains the following:

  • The same floor we used in previous lessons
  • A model composed of an anvil and a hammer, just to have something on screen
  • Some lighting with shadows
  • OrbitControls to rotate around
  • A SkyMesh to have something to look at in the background
  • It’s all being rendered with the WebGPURenderer
  • An instance of the Inspector

Tone mapping 02:47

Let’s start with the tone mapping, because yes, tone mapping is considered post-processing, especially with how Three.js now handles rendering.

Don’t worry, it works nearly the same as with the WebGLRenderer.

Tone mapping is a technique to convert HDR to LDR, but it’s also a way to tweak the output color (HDR or not) to mimic real camera effects.

Change the tone mapping like before, on the renderer:

const renderer = new THREE.WebGPURenderer({
    // ...
})
renderer.toneMapping = THREE.ACESFilmicToneMapping

The render looks a little bit darker and more contrasted.

And like before, we can play with the exposure using the toneMappingExposure property:

renderer.toneMapping = THREE.ACESFilmicToneMapping
renderer.toneMappingExposure = 3

The tone mapping exposure will multiply the color input, making it look like there is more light getting in the camera, thus making the tone mapping effect more intense and relevant.

Let’s have a bit of fun and add those two properties to the debug UI.

Want to learn more?

That's the end of the free part of this lesson

WebGPU & TSL Course new $45 VAT incl.
  • 21 lessons · 24 hours of video
  • Quizzes · Certificate
  • Members-only Discord server · Future updates

How to use it 🤔

  • Download the Starter pack or Final project
  • Unzip it
  • Open your terminal and go to the unzip folder
  • Run npm install to install dependencies
    (if your terminal warns you about vulnerabilities, ignore it)
  • Run npm run dev to launch the local server
    (project should open on your default browser automatically)
  • Start coding
  • The JS is located in src/script.js
  • The HTML is located in src/index.html
  • The CSS is located in src/style.css

If you get stuck and need help, join the members-only Discord server:

Discord