Fix: Draw: EEVEE-Next shadow flickering and other uninitialized bounds fixes #120591

Merged
Miguel Pozo merged 7 commits from pragma37/blender:pull-draw-fix-uninitialized-bounds into main 2024-04-16 17:19:29 +02:00
Member

Always check if the DrawManager ObjectBounds are valid.
Initialized invalid bounds to NaN in debug builds for easier debugging.

Always check if the DrawManager ObjectBounds are valid. Initialized invalid bounds to NaN in debug builds for easier debugging.
Miguel Pozo added the
Interest
Workbench
Interest
EEVEE
Module
EEVEE & Viewport
labels 2024-04-12 19:11:15 +02:00
Miguel Pozo added 4 commits 2024-04-12 19:11:26 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
343ccb29e1
Fix workbench shadow visibily bounds
Miguel Pozo requested review from Clément Foucault 2024-04-12 19:11:39 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR120591) when ready.
Clément Foucault requested changes 2024-04-13 21:42:04 +02:00
Dismissed
Clément Foucault left a comment
Member

As discussed on blender chat, I would rather see this fixed at the consumer shaders level than trying to not invoke the consumer shaders. We should have some utility functions to check if the bounds are corrects (bounding sphere and bounding box).

Pros:

  • Defines a clear way to interact with bounds.
  • Future proof if we modify object bounds on GPU.

Cons:

  • More error prone in the process of changing existing shaders.
As discussed on blender chat, I would rather see this fixed at the consumer shaders level than trying to not invoke the consumer shaders. We should have some utility functions to check if the bounds are corrects (bounding sphere and bounding box). Pros: - Defines a clear way to interact with bounds. - Future proof if we modify object bounds on GPU. Cons: - More error prone in the process of changing existing shaders.
@ -904,2 +904,4 @@
}
const ObjectBounds &bounds =
inst_.manager->bounds_buf.current()[resource_handle.resource_index()];

Reading the data of the draw manager is prohibited by design. The fact these members are public are only for them to be used as shader resources.

Reading the data of the draw manager is prohibited by design. The fact these members are public are only for them to be used as shader resources.
Miguel Pozo added 2 commits 2024-04-15 14:04:20 +02:00
Clément Foucault requested changes 2024-04-15 23:32:59 +02:00
Dismissed
Clément Foucault left a comment
Member

There is still two occurrences of if (bounds.bounding_sphere.w != -1.0) { inside draw/intern/shaders

There is still two occurrences of `if (bounds.bounding_sphere.w != -1.0) {` inside `draw/intern/shaders`
@ -205,1 +205,4 @@
inline bool drw_bounds_are_valid(ObjectBounds bounds)
{
return bounds.bounding_sphere.w != -1.0f;

bounds.bounding_sphere.w == -1.0f only means the culling is disabled (which does not always means the bounding box is invalid (see snippet).

    if (bounds.bounding_sphere.w > 1e12) {
      bounds.bounding_sphere.w = -1.0;
    }

Maybe set it to -2 when bounding box is invalid.

`bounds.bounding_sphere.w == -1.0f` only means the culling is disabled (which does not always means the bounding box is invalid (see snippet). ``` if (bounds.bounding_sphere.w > 1e12) { bounds.bounding_sphere.w = -1.0; } ``` Maybe set it to `-2` when bounding box is invalid.
Author
Member

bounds.bounding_sphere.w == -1.0f only means the culling is disabled (which does not always means the bounding box is invalid

At the moment disabling culling effectively means the bounding box is invalid, since the only way to disable culling is to create a ResourceHandle without bounds.

Right now culling is only explicitly disabled for objects with invalid bounding boxes (curves and hair), and for the lookdev spheres.

Maybe we need a better design for this.

About the diagonal > 1e12 case, I think is fair to treat those bounds as invalid. That's going to wreak havoc on any system that relies on object bounds.

> `bounds.bounding_sphere.w == -1.0f` only means the culling is disabled (which does not always means the bounding box is invalid At the moment disabling culling effectively means the bounding box is invalid, since the only way to disable culling is to create a ResourceHandle without bounds. Right now culling is only explicitly disabled for objects with invalid bounding boxes (curves and hair), and for the lookdev spheres. Maybe we need a better design for this. About the diagonal > 1e12 case, I think is fair to treat those bounds as invalid. That's going to wreak havoc on any system that relies on object bounds.
fclem marked this conversation as resolved
Miguel Pozo added 1 commit 2024-04-16 16:12:58 +02:00
Clément Foucault approved these changes 2024-04-16 17:17:08 +02:00
Miguel Pozo merged commit cec57e9138 into main 2024-04-16 17:19:29 +02:00
Miguel Pozo deleted branch pull-draw-fix-uninitialized-bounds 2024-04-16 17:19:32 +02: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 project
No Assignees
3 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#120591
No description provided.