[PR #3089] [MERGED] Add debanding option to improve gradient smoothness with truecolor #1588

Open
opened 2026-01-29 19:17:33 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stenzek/duckstation/pull/3089
Author: @Calinou
Created: 1/19/2024
Status: Merged
Merged: 1/19/2024
Merged by: @stenzek

Base: masterHead: add-debanding


📝 Commits (1)

  • cc94b76 Add debanding option to improve gradient smoothness with truecolor

📊 Changes

11 files changed (+71 additions, -18 deletions)

View changed files

📝 src/core/fullscreen_ui.cpp (+4 -0)
📝 src/core/gpu_hw.cpp (+10 -3)
📝 src/core/gpu_hw.h (+1 -0)
📝 src/core/gpu_hw_shadergen.cpp (+29 -11)
📝 src/core/gpu_hw_shadergen.h (+2 -1)
📝 src/core/imgui_overlays.cpp (+7 -2)
📝 src/core/settings.cpp (+3 -0)
📝 src/core/settings.h (+1 -0)
📝 src/core/system.cpp (+1 -0)
📝 src/duckstation-qt/enhancementsettingswidget.cpp (+5 -0)
📝 src/duckstation-qt/enhancementsettingswidget.ui (+8 -1)

📄 Description

This option only has an effect if true color is also enabled.

Most PS1 games don't exhibit that much banding with true color, but there are particular cases where flickering induced by a lack of color precision is visible, such as Driver in its nighttime levels. You may also notice more banding if you play with bilinear texture filtering enabled, in which case debanding will help.

Compared to the existing deband post-processing shader, this works with internal rendering which makes it both faster and more precise. No loss of detail occurs, and no tweaking of thresholds is required.

The option is disabled by default as its effect is subtle in most games, and it increases the file size of screenshots due to the subtle dithering pattern.

The debanding algorithm used is very fast (only a handful of instructions), and is also the one that happens to be used in Godot 🙂

Preview

Click to view at full size.

Before After
driver_without_debanding driver_debanding

This kind of flickering on the parking lot's floor and ceiling completely goes away once debanding is enabled:

https://github.com/stenzek/duckstation/assets/180032/ee325ce0-ddbc-41a3-8452-7472e8de7ff9


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stenzek/duckstation/pull/3089 **Author:** [@Calinou](https://github.com/Calinou) **Created:** 1/19/2024 **Status:** ✅ Merged **Merged:** 1/19/2024 **Merged by:** [@stenzek](https://github.com/stenzek) **Base:** `master` ← **Head:** `add-debanding` --- ### 📝 Commits (1) - [`cc94b76`](https://github.com/stenzek/duckstation/commit/cc94b760376fc216dd9e20c7134e7b6ca572c2b2) Add debanding option to improve gradient smoothness with truecolor ### 📊 Changes **11 files changed** (+71 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/core/fullscreen_ui.cpp` (+4 -0) 📝 `src/core/gpu_hw.cpp` (+10 -3) 📝 `src/core/gpu_hw.h` (+1 -0) 📝 `src/core/gpu_hw_shadergen.cpp` (+29 -11) 📝 `src/core/gpu_hw_shadergen.h` (+2 -1) 📝 `src/core/imgui_overlays.cpp` (+7 -2) 📝 `src/core/settings.cpp` (+3 -0) 📝 `src/core/settings.h` (+1 -0) 📝 `src/core/system.cpp` (+1 -0) 📝 `src/duckstation-qt/enhancementsettingswidget.cpp` (+5 -0) 📝 `src/duckstation-qt/enhancementsettingswidget.ui` (+8 -1) </details> ### 📄 Description This option only has an effect if true color is also enabled. Most PS1 games don't exhibit that much banding with true color, but there are particular cases where flickering induced by a lack of color precision is visible, such as Driver in its nighttime levels. You may also notice more banding if you play with bilinear texture filtering enabled, in which case debanding will help. Compared to the existing deband post-processing shader, this works with internal rendering which makes it both faster and more precise. No loss of detail occurs, and no tweaking of thresholds is required. The option is disabled by default as its effect is subtle in most games, and it increases the file size of screenshots due to the subtle dithering pattern. The debanding algorithm used is very fast (only a handful of instructions), and is also the one that happens to be used in Godot :slightly_smiling_face: ## Preview *Click to view at full size.* Before | After -|- ![driver_without_debanding](https://github.com/stenzek/duckstation/assets/180032/41a603bc-c566-4442-b559-dbd4ae3a1630) | ![driver_debanding](https://github.com/stenzek/duckstation/assets/180032/5fc010b6-883c-4006-915a-41d7cafdbee3) This kind of flickering on the parking lot's floor and ceiling completely goes away once debanding is enabled: https://github.com/stenzek/duckstation/assets/180032/ee325ce0-ddbc-41a3-8452-7472e8de7ff9 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 19:17:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#1588