Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Fix missing sRGB conversion for dithering non-HDR pipelines #6707

Closed

Conversation

aevyrie
Copy link
Member

@aevyrie aevyrie commented Nov 21, 2022

Objective

Zoom in on the shadow in the following images:

Current bevy/main

HDR On - correct

current-hdron

HDR Off - incorrect

current-hdroff

This PR

HDR On - correct

new-hdron

HDR Off - corrected

new-hdroff

Close-up comparison

New

Screenshot from 2022-11-20 17-46-46

Old

Screenshot from 2022-11-20 17-46-41

Solution

  • It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
  • I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

Changelog

  • Fix deband dithering intensity for non-HDR pipelines.

@aevyrie aevyrie added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior labels Nov 21, 2022
@alice-i-cecile alice-i-cecile added this to the 0.9.1 milestone Nov 21, 2022
@aevyrie aevyrie changed the title Fix missing sRGB conversion for dithering Fix missing sRGB conversion for dithering non-HDR pipelines Nov 21, 2022
output_rgb = output_rgb + screen_space_dither(in.frag_coord.xy);
// This conversion back to linear space is required because our output texture format is
// SRGB; the GPU will assume our output is linear and will apply an SRGB conversion.
output_rgb = pow(output_rgb, vec3<f32>(2.2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick (possibly stupid) question: could this back-and-forth conversion be avoided by choosing a different output texture format?

(i don't really know about how the output texture format is chosen in the first place, if srgb is a requirement then i guess that is not an option)

Copy link
Member Author

@aevyrie aevyrie Nov 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, great question. The answer seems to be "yes, but we can't do that" for a variety of reasons I don't fully understand. That would be my preference for sure though.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Nov 22, 2022
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Nov 22, 2022
# Objective

- Fixes #6706 

Zoom in on the shadow in the following images:

## Current bevy/main

### HDR On - correct
![current-hdron](https://user-images.githubusercontent.com/2632925/202943151-ecad3cbe-a76e-46df-bac9-9e590a31a9f3.png)

### HDR Off - incorrect
![current-hdroff](https://user-images.githubusercontent.com/2632925/202943154-34e3f527-a00e-4546-931d-0691204cc6a4.png)

## This PR

### HDR On - correct
![new-hdron](https://user-images.githubusercontent.com/2632925/202943383-081990de-9a14-45bd-ac52-febcc4289079.png)

### HDR Off - corrected
![new-hdroff](https://user-images.githubusercontent.com/2632925/202943388-a3b05d79-a0f3-4b1e-b114-0a9f03efe351.png)

## Close-up comparison

### New
![Screenshot from 2022-11-20 17-46-46](https://user-images.githubusercontent.com/2632925/202943552-d45c3a48-841e-47a6-981f-776c5a9563f6.png)

### Old
![Screenshot from 2022-11-20 17-46-41](https://user-images.githubusercontent.com/2632925/202943562-555cb5a2-2b20-45f9-b250-89f2bc87af5f.png)

## Solution

- It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
- I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

---

## Changelog

- Fix deband dithering intensity for non-HDR pipelines.
@bors
Copy link
Contributor

bors bot commented Nov 22, 2022

Build failed:

@alice-i-cecile
Copy link
Member

bors retry

bors bot pushed a commit that referenced this pull request Nov 22, 2022
# Objective

- Fixes #6706 

Zoom in on the shadow in the following images:

## Current bevy/main

### HDR On - correct
![current-hdron](https://user-images.githubusercontent.com/2632925/202943151-ecad3cbe-a76e-46df-bac9-9e590a31a9f3.png)

### HDR Off - incorrect
![current-hdroff](https://user-images.githubusercontent.com/2632925/202943154-34e3f527-a00e-4546-931d-0691204cc6a4.png)

## This PR

### HDR On - correct
![new-hdron](https://user-images.githubusercontent.com/2632925/202943383-081990de-9a14-45bd-ac52-febcc4289079.png)

### HDR Off - corrected
![new-hdroff](https://user-images.githubusercontent.com/2632925/202943388-a3b05d79-a0f3-4b1e-b114-0a9f03efe351.png)

## Close-up comparison

### New
![Screenshot from 2022-11-20 17-46-46](https://user-images.githubusercontent.com/2632925/202943552-d45c3a48-841e-47a6-981f-776c5a9563f6.png)

### Old
![Screenshot from 2022-11-20 17-46-41](https://user-images.githubusercontent.com/2632925/202943562-555cb5a2-2b20-45f9-b250-89f2bc87af5f.png)

## Solution

- It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
- I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

---

## Changelog

- Fix deband dithering intensity for non-HDR pipelines.
@bors
Copy link
Contributor

bors bot commented Nov 22, 2022

Build failed:

@alice-i-cecile
Copy link
Member

bors plz 🥺

bors retry

bors bot pushed a commit that referenced this pull request Nov 22, 2022
# Objective

- Fixes #6706 

Zoom in on the shadow in the following images:

## Current bevy/main

### HDR On - correct
![current-hdron](https://user-images.githubusercontent.com/2632925/202943151-ecad3cbe-a76e-46df-bac9-9e590a31a9f3.png)

### HDR Off - incorrect
![current-hdroff](https://user-images.githubusercontent.com/2632925/202943154-34e3f527-a00e-4546-931d-0691204cc6a4.png)

## This PR

### HDR On - correct
![new-hdron](https://user-images.githubusercontent.com/2632925/202943383-081990de-9a14-45bd-ac52-febcc4289079.png)

### HDR Off - corrected
![new-hdroff](https://user-images.githubusercontent.com/2632925/202943388-a3b05d79-a0f3-4b1e-b114-0a9f03efe351.png)

## Close-up comparison

### New
![Screenshot from 2022-11-20 17-46-46](https://user-images.githubusercontent.com/2632925/202943552-d45c3a48-841e-47a6-981f-776c5a9563f6.png)

### Old
![Screenshot from 2022-11-20 17-46-41](https://user-images.githubusercontent.com/2632925/202943562-555cb5a2-2b20-45f9-b250-89f2bc87af5f.png)

## Solution

- It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
- I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

---

## Changelog

- Fix deband dithering intensity for non-HDR pipelines.
@bors
Copy link
Contributor

bors bot commented Nov 22, 2022

Build failed:

@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Nov 22, 2022
# Objective

- Fixes #6706 

Zoom in on the shadow in the following images:

## Current bevy/main

### HDR On - correct
![current-hdron](https://user-images.githubusercontent.com/2632925/202943151-ecad3cbe-a76e-46df-bac9-9e590a31a9f3.png)

### HDR Off - incorrect
![current-hdroff](https://user-images.githubusercontent.com/2632925/202943154-34e3f527-a00e-4546-931d-0691204cc6a4.png)

## This PR

### HDR On - correct
![new-hdron](https://user-images.githubusercontent.com/2632925/202943383-081990de-9a14-45bd-ac52-febcc4289079.png)

### HDR Off - corrected
![new-hdroff](https://user-images.githubusercontent.com/2632925/202943388-a3b05d79-a0f3-4b1e-b114-0a9f03efe351.png)

## Close-up comparison

### New
![Screenshot from 2022-11-20 17-46-46](https://user-images.githubusercontent.com/2632925/202943552-d45c3a48-841e-47a6-981f-776c5a9563f6.png)

### Old
![Screenshot from 2022-11-20 17-46-41](https://user-images.githubusercontent.com/2632925/202943562-555cb5a2-2b20-45f9-b250-89f2bc87af5f.png)

## Solution

- It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
- I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

---

## Changelog

- Fix deband dithering intensity for non-HDR pipelines.
@bors bors bot changed the title Fix missing sRGB conversion for dithering non-HDR pipelines [Merged by Bors] - Fix missing sRGB conversion for dithering non-HDR pipelines Nov 22, 2022
@bors bors bot closed this Nov 22, 2022
cart pushed a commit that referenced this pull request Nov 30, 2022
# Objective

- Fixes #6706 

Zoom in on the shadow in the following images:

## Current bevy/main

### HDR On - correct
![current-hdron](https://user-images.githubusercontent.com/2632925/202943151-ecad3cbe-a76e-46df-bac9-9e590a31a9f3.png)

### HDR Off - incorrect
![current-hdroff](https://user-images.githubusercontent.com/2632925/202943154-34e3f527-a00e-4546-931d-0691204cc6a4.png)

## This PR

### HDR On - correct
![new-hdron](https://user-images.githubusercontent.com/2632925/202943383-081990de-9a14-45bd-ac52-febcc4289079.png)

### HDR Off - corrected
![new-hdroff](https://user-images.githubusercontent.com/2632925/202943388-a3b05d79-a0f3-4b1e-b114-0a9f03efe351.png)

## Close-up comparison

### New
![Screenshot from 2022-11-20 17-46-46](https://user-images.githubusercontent.com/2632925/202943552-d45c3a48-841e-47a6-981f-776c5a9563f6.png)

### Old
![Screenshot from 2022-11-20 17-46-41](https://user-images.githubusercontent.com/2632925/202943562-555cb5a2-2b20-45f9-b250-89f2bc87af5f.png)

## Solution

- It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
- I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

---

## Changelog

- Fix deband dithering intensity for non-HDR pipelines.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…ne#6707)

# Objective

- Fixes bevyengine#6706 

Zoom in on the shadow in the following images:

## Current bevy/main

### HDR On - correct
![current-hdron](https://user-images.githubusercontent.com/2632925/202943151-ecad3cbe-a76e-46df-bac9-9e590a31a9f3.png)

### HDR Off - incorrect
![current-hdroff](https://user-images.githubusercontent.com/2632925/202943154-34e3f527-a00e-4546-931d-0691204cc6a4.png)

## This PR

### HDR On - correct
![new-hdron](https://user-images.githubusercontent.com/2632925/202943383-081990de-9a14-45bd-ac52-febcc4289079.png)

### HDR Off - corrected
![new-hdroff](https://user-images.githubusercontent.com/2632925/202943388-a3b05d79-a0f3-4b1e-b114-0a9f03efe351.png)

## Close-up comparison

### New
![Screenshot from 2022-11-20 17-46-46](https://user-images.githubusercontent.com/2632925/202943552-d45c3a48-841e-47a6-981f-776c5a9563f6.png)

### Old
![Screenshot from 2022-11-20 17-46-41](https://user-images.githubusercontent.com/2632925/202943562-555cb5a2-2b20-45f9-b250-89f2bc87af5f.png)

## Solution

- It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras.
- I also tried using a precise sRGB conversion, but it had no apparent effect on the final image.

---

## Changelog

- Fix deband dithering intensity for non-HDR pipelines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debanding intensity too high in dark regions
6 participants