Eevee: strange discrepancy in handling of 32 bit floating point textures #73086

Closed
opened 2020-01-13 14:08:13 +01:00 by Stanislav Blinov · 14 comments

System Information
Operating system: Linux 5.4.10-arch1-1
Graphics card: GTX980Ti

Blender Version
Broken: 2.83 (01d9a2f71b)
Worked: N/A

Short description of error
When using a 32 bit floating point normal map with Eevee, it looks as if Eevee resamples the image and reduces quality:
eevee_normal_banding.png

The same image and material used with Cycles seem to work fine. Also, slightly different setups in Eevee (e.g. manually generating (some of the) same data) do not produce the same issue.
More information in this video .

Exact steps for others to reproduce the error

eevee_normal_banding.blend

  1. Load the above .blend file.
  2. Observe banding on the surface in Eevee material preview.
  3. Switch to render preview (Cycles): surface will become smooth.
  4. Try the other two materials and note that they do not exhibit the same problem in Eevee.
  5. Try baking normals using the ManualTangentNM material (see video for details). When baked with no range compression, Eevee does not seem to have an issue.
**System Information** Operating system: Linux 5.4.10-arch1-1 Graphics card: GTX980Ti **Blender Version** Broken: 2.83 (01d9a2f71b56be9354ce31564e3dddb6af4a0757) Worked: N/A **Short description of error** When using a 32 bit floating point normal map with Eevee, it looks as if Eevee resamples the image and reduces quality: ![eevee_normal_banding.png](https://archive.blender.org/developer/F8275718/eevee_normal_banding.png) The same image and material used with Cycles seem to work fine. Also, slightly different setups in Eevee (e.g. manually generating (some of the) same data) do not produce the same issue. More information in [this video ](https://youtu.be/Ag_MQPDojSQ). **Exact steps for others to reproduce the error** [eevee_normal_banding.blend](https://archive.blender.org/developer/F8275720/eevee_normal_banding.blend) 1. Load the above .blend file. 2. Observe banding on the surface in Eevee material preview. 3. Switch to render preview (Cycles): surface will become smooth. 4. Try the other two materials and note that they do not exhibit the same problem in Eevee. 5. Try baking normals using the ManualTangentNM material (see video for details). When baked with no range compression, Eevee does not seem to have an issue.

Added subscriber: @Stan_Pancakes

Added subscriber: @Stan_Pancakes

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I can confirm this. Seems to be caused by enabling Object Data > Normals > Auto Smooth.

I can confirm this. Seems to be caused by enabling Object Data > Normals > Auto Smooth.

I don't think that that is the case. Re-baking with the whole mesh smooth-shaded without custom normals and sharp edges will still show the issue in Eevee (but not in Cycles), although of course the normals in general would be wrong.
E.g., with Auto-Smooth disabled one can still use the 'ObjectNM' material. Eevee will preview it without banding. But, baking tangent space normals with that material, switching back to the 'TangentNM' material and plugging the new texture instead of the original TS normal map will bring back banding in Eevee (but not Cycles). Even a few seams along triangulation edges would show in Eevee (on the flat sides).

I don't think that that is the case. Re-baking with the whole mesh smooth-shaded without custom normals and sharp edges will still show the issue in Eevee (but not in Cycles), although of course the normals in general would be wrong. E.g., with Auto-Smooth disabled one can still use the 'ObjectNM' material. Eevee will preview it without banding. But, baking tangent space normals with that material, switching back to the 'TangentNM' material and plugging the new texture instead of the original TS normal map will bring back banding in Eevee (but not Cycles). Even a few seams along triangulation edges would show in Eevee (on the flat sides).

Added subscribers: @fclem, @Jeroen-Bakker, @mont29

Added subscribers: @fclem, @Jeroen-Bakker, @mont29

Let’s move it to bug for now… @fclem and/or @Jeroen-Bakker shall know more here?

Let’s move it to bug for now… @fclem and/or @Jeroen-Bakker shall know more here?

It's really strange. My first guess was that it was related to the 10bit normals precision issue (#61024). But even when testing with D6614 it did not fix the problem entierly.

Then I remember that we only use 16bits texture for the GPU.

This one liner fixes is:

 

/* create image */
glGenTextures(1, (GLuint *)bind);
glBindTexture(textarget, *bind);

 
- GLenum internal_format = (frect) ? GL_RGBA16F : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
+  GLenum internal_format = (frect) ? GL_RGBA32F : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
 

if (textarget == GL_TEXTURE_2D) {
if (frect) {
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, rectw, recth, 0, GL_RGBA, GL_FLOAT, frect);
}

However, this has some big performance impact. So I think this is an option we need to add in the future "Performance/Quality" panel for EEVEE/workbench.

It's really strange. My first guess was that it was related to the 10bit normals precision issue (#61024). But even when testing with [D6614](https://archive.blender.org/developer/D6614) it did not fix the problem entierly. Then I remember that we only use 16bits texture for the GPU. This one liner fixes is: ```@@ -1060,11 +1060,11 @@ void GPU_create_gl_tex(uint *bind, ``` /* create image */ glGenTextures(1, (GLuint *)bind); glBindTexture(textarget, *bind); ``` - GLenum internal_format = (frect) ? GL_RGBA16F : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8; + GLenum internal_format = (frect) ? GL_RGBA32F : (use_srgb) ? GL_SRGB8_ALPHA8 : GL_RGBA8; ``` if (textarget == GL_TEXTURE_2D) { if (frect) { glTexImage2D(GL_TEXTURE_2D, 0, internal_format, rectw, recth, 0, GL_RGBA, GL_FLOAT, frect); } ``` ``` However, this has some big performance impact. So I think this is an option we need to add in the future "Performance/Quality" panel for EEVEE/workbench.

Thanks for clarification. So it's not a bug per se? I wonder if that could be made an option for the texture node itself, to allow for selective sacrifices of performance to quality.

Thanks for clarification. So it's not a bug per se? I wonder if that could be made an option for the texture node itself, to allow for selective sacrifices of performance to quality.

Added subscribers: @WilliamReynish, @brecht

Added subscribers: @WilliamReynish, @brecht

We could add a per image datablock option. We can debate what is the best option UX wise. @brecht @WilliamReynish any input on this?

We could add a per image datablock option. We can debate what is the best option UX wise. @brecht @WilliamReynish any input on this?

I'm fine with an option on the image datablock.

I'm fine with an option on the image datablock.

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Clément Foucault self-assigned this 2020-02-25 15:15:52 +01:00

A new option was added to allow high bitdepth (32bit) in master for 2.83.

A new option was added to allow high bitdepth (32bit) in master for 2.83.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#73086
No description provided.