EEVEE-Next: Displacement Option #113979

Merged
Clément Foucault merged 11 commits from fclem/blender:eevee-next-displacement-option into main 2023-11-21 19:55:49 +01:00

This add the displacement option to EEVEE materials.
This unifies the option for Cycles and EEVEE.

The displacement only option is not matching cycles
and not particularly useful. So we decided to not
support it and revert to displacement + bump.

Known issues

  • Displacement on flat surfaces breaks the surface resulting in cracks. This is because the displacement nodes use the shading normal instead of the vertex normal which is not currently accessible.

  • Displacement only result in flat per face normals. This is a limitation of the normal recovery algorithm. Maybe a solution exists but it isn't trivial and need further research.

Bump Displacement + Bump
Capture d’écran du 2023-10-23 10-53-08 Capture d’écran du 2023-10-23 10-53-24
This add the displacement option to EEVEE materials. This unifies the option for Cycles and EEVEE. The displacement only option is not matching cycles and not particularly useful. So we decided to not support it and revert to displacement + bump. ## Known issues - Displacement on flat surfaces breaks the surface resulting in cracks. This is because the displacement nodes use the shading normal instead of the vertex normal which is not currently accessible. - Displacement only result in flat per face normals. This is a limitation of the normal recovery algorithm. Maybe a solution exists but it isn't trivial and need further research. | Bump | Displacement + Bump | | -------- | -------- | | ![Capture d’écran du 2023-10-23 10-53-08](/attachments/2fbc8bd1-5d99-48a4-8de4-6b34037348ce) | ![Capture d’écran du 2023-10-23 10-53-24](/attachments/4febfe36-8407-4735-8cb5-9a5283f07c83) |
Clément Foucault added 4 commits 2023-10-20 19:53:57 +02:00
d5956abf72 Merge branch 'main' into eevee-next-displacement-option
# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_material.cc
#	source/blender/draw/engines/eevee_next/eevee_material.hh
#	source/blender/draw/engines/eevee_next/eevee_shader.cc
#	source/blender/makesdna/DNA_material_types.h
Clément Foucault added the
Interest
EEVEE & Viewport
Interest
EEVEE
labels 2023-10-20 19:54:09 +02:00
Clément Foucault added this to the EEVEE & Viewport project 2023-10-20 19:54:13 +02:00
Clément Foucault added 1 commit 2023-10-23 11:15:18 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
6419ef622e
Merge branch 'main' into eevee-next-displacement-option
# Conflicts:
#	scripts/startup/bl_ui/properties_material.py
Author
Member

@blender-bot build

@blender-bot build
Clément Foucault added this to the 4.1 milestone 2023-10-23 11:19:35 +02:00
Author
Member

To me it make sense to unify the setting even if EEVEE support is subpart.
I don't see any case where one would like to use different displacement types between cycles and EEVEE.

The only thing is that I'm not sure how does one work with displacement only + normal map.

@brecht any opinion?

To me it make sense to unify the setting even if EEVEE support is subpart. I don't see any case where one would like to use different displacement types between cycles and EEVEE. The only thing is that I'm not sure how does one work with displacement only + normal map. @brecht any opinion?

Cracks with flat shading seems like an acceptable limitation. On the CPU as in Cycles it's possible to join those up, but that still often leads to artifacts and is not that useful I think. Maybe forcing smooth shading would be good, but I'm not sure that's easy?

The faceted Displacement Only does not seem very useful, when opening an existing scene or setting up a material for Cycles and then previewing it in EEVEE. To me Displacement + Bump behavior seems better even if it's confusing that two options do the same thing. Alternatively, this could be an enum with just Bump and Displacement options, and then Cycles would have an additional boolean to use bump mapping for displacement or not.

Cracks with flat shading seems like an acceptable limitation. On the CPU as in Cycles it's possible to join those up, but that still often leads to artifacts and is not that useful I think. Maybe forcing smooth shading would be good, but I'm not sure that's easy? The faceted Displacement Only does not seem very useful, when opening an existing scene or setting up a material for Cycles and then previewing it in EEVEE. To me Displacement + Bump behavior seems better even if it's confusing that two options do the same thing. Alternatively, this could be an enum with just Bump and Displacement options, and then Cycles would have an additional boolean to use bump mapping for displacement or not.
Author
Member

To me Displacement + Bump behavior seems better even if it's confusing that two options do the same thing.

It is more than that, the displace bump is blended with normal map nodes. So it would change the
normal map node behavior drastically.

Another option is to not do anything to the interpolated normal and allow for the normal map to just set the correct normal. I think that's what most real-time engines do. But that is not what Cycles does.

> To me Displacement + Bump behavior seems better even if it's confusing that two options do the same thing. It is more than that, the displace bump is blended with normal map nodes. So it would change the normal map node behavior drastically. Another option is to not do anything to the interpolated normal and allow for the normal map to just set the correct normal. I think that's what most real-time engines do. But that is not what Cycles does.

For realtime engines I can see the point of baking both a displacement and normal map for performance, to avoid having to differentiate the displacement map. For authoring new materials and for offline rendering, just a displacement map is often enough and allows procedural texturing.

For me that's a different distinction than "displacement" vs "displacement + bump" though. If you are going to replace the normal entirely with a baked normal map, both options would yield the same result, as that displaced/bumped normal is not used at all.

We could make the Normal Map node use the undisplaced normal as input by default, since the normal map was probably baked for the geometry without displacement.

For realtime engines I can see the point of baking both a displacement and normal map for performance, to avoid having to differentiate the displacement map. For authoring new materials and for offline rendering, just a displacement map is often enough and allows procedural texturing. For me that's a different distinction than "displacement" vs "displacement + bump" though. If you are going to replace the normal entirely with a baked normal map, both options would yield the same result, as that displaced/bumped normal is not used at all. We could make the Normal Map node use the undisplaced normal as input by default, since the normal map was probably baked for the geometry without displacement.
Author
Member

Since the issue is about the Displacement Only case, and this is a mode we cannot support fully or somewhat correctly, I would just revert to no displacement at all (avoid adding high frequency details) or one of the supported case (Bump Only or Both). The later makes sense for backward compatibility as it would preserve the EEVEE Legacy behavior. I would also display a warning bellow the option if the mode is incompatible with the current render engine.

The Displacement With Original Normal option would be another option in the list and not a target of this PR.

Since the issue is about the `Displacement Only` case, and this is a mode we cannot support fully or somewhat correctly, I would just revert to no displacement at all (avoid adding high frequency details) or one of the supported case (`Bump Only` or `Both`). The later makes sense for backward compatibility as it would preserve the EEVEE Legacy behavior. I would also display a warning bellow the option if the mode is incompatible with the current render engine. The `Displacement With Original Normal` option would be another option in the list and not a target of this PR.

That sounds good to me.

That sounds good to me.
Clément Foucault added 4 commits 2023-11-18 00:34:56 +01:00
ba920067bb Merge branch 'main' into eevee-next-displacement-option
# Conflicts:
#	scripts/startup/bl_ui/properties_material.py
#	source/blender/draw/engines/eevee_next/eevee_material.hh
#	source/blender/draw/engines/eevee_next/eevee_shader.cc
buildbot/vexp-code-patch-coordinator Build done. Details
49f0f9254a
Add versionning
Author
Member

@blender-bot build

@blender-bot build
Clément Foucault added 1 commit 2023-11-18 23:25:19 +01:00
Clément Foucault requested review from Brecht Van Lommel 2023-11-18 23:31:27 +01:00
Author
Member

@brecht I added versioning code to make Cycles use the same parameter. Should be straight forward but want a double check.

@brecht I added versioning code to make Cycles use the same parameter. Should be straight forward but want a double check.
Brecht Van Lommel approved these changes 2023-11-21 19:42:28 +01:00
Clément Foucault added 1 commit 2023-11-21 19:51:58 +01:00
d2eece00fb Merge branch 'main' into eevee-next-displacement-option
# Conflicts:
#	source/blender/blenloader/intern/versioning_400.cc
Clément Foucault merged commit a001cf9f2b into main 2023-11-21 19:55:49 +01:00
Clément Foucault deleted branch eevee-next-displacement-option 2023-11-21 19:55:51 +01:00
Sign in to join this conversation.
No reviewers
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 Assignees
2 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#113979
No description provided.