Mesh: Add viewport normals simplify option #113975

Merged
Hans Goudey merged 154 commits from HooglyBoogly/blender:mesh-normals-simplify-option into main 2023-12-16 00:18:49 +01:00
Member

Before #108014, toggling "Auto Smooth" was an easy way to disable
evaluation of custom normals and face corner normals for faster
viewport playback performance. Now that corner normals are calculated
automatically as necessary, it's helpful to still have a way to disable
expensive normal computation for faster playback.

This commit adds a "Normals" scene simplify setting. To avoid a bunch
of complexity, it just influences which normals are requested from the
object by viewport rendering. In my tests, skipping calculating at
least doubled viewport FPS in a few test files with a large mesh with
custom normals. This works well because normals are cached and lazily
calculated.

Before #108014, toggling "Auto Smooth" was an easy way to disable evaluation of custom normals and face corner normals for faster viewport playback performance. Now that corner normals are calculated automatically as necessary, it's helpful to still have a way to disable expensive normal computation for faster playback. This commit adds a "Normals" scene simplify setting. To avoid a bunch of complexity, it just influences which normals are requested from the object by viewport rendering. In my tests, skipping calculating at least doubled viewport FPS in a few test files with a large mesh with custom normals. This works well because normals are cached and lazily calculated.
Hans Goudey added 141 commits 2023-10-20 17:28:04 +02:00
f44e13579a Progress removing auto smooth
This needs to wait until 4.0
55dd8b2db5 Progress
Need the normals shared cache changes to move forward here
db77fdd44b Revert changes in BMesh normal calculation
Now the changes are as simpe as possible-- in the entry point we just
disable the tagging with the old magic number
buildbot/vexp-code-patch-coordinator Build done. Details
8baa21e981
Fix versioning after change in main
7dadb241f3 Remove unhelpful and slow eager normal calculation
Calculating normals early (especially corner normals) turns out to be
slower here, and prevents optimizations like the renderer only
requesting the normals it needs, or only requesting normals based
on some scene simplify option that doesn't affect object evaluation.
It adds significant complexity too.`calc_loop_normals` was also set
but not used.
15143b0eb1 Mesh: Add viewport normals simplify option
Before #108014, toggling "Auto Smooth" was an easy way to disable
evaluation of custom normals and face corner normals for faster
viewport playback performance. Now that corner normals are calculated
automatically as necessary, it's helpful to still have a way to disable
expensive normal computation for faster playback.

This commit adds a "Normals" scene simplify setting. To avoid a bunch
of complexity, it just influences which normals are requested from the
object by viewport rendering. In my tests, skipping calculating at
least doubled viewport FPS in a few test files with a large mesh with
custom normals. This works well because normals are cached and lazily
calculated.
Hans Goudey added 1 commit 2023-10-20 17:31:13 +02:00
Hans Goudey requested review from Campbell Barton 2023-10-20 17:31:51 +02:00
Hans Goudey added the
Interest
EEVEE & Viewport
Interest
Modeling
labels 2023-10-20 17:32:03 +02:00
Ray molenkamp reviewed 2023-10-20 20:05:42 +02:00
@ -2122,1 +2120,3 @@
R_MODE_UNUSED_27 = 1 << 27, /* cleared */
R_EDGE_FRS = 1 << 25, /* R_EDGE reserved for Freestyle */
R_PERSISTENT_DATA = 1 << 26, /* Keep data around for re-render. */
R_SIMPLIFY_NORMALS = 1 << 27, /* cleared */
Member

There's seemingly some unintended whitespace changes? that /* cleared */ comment could likely use either removal or an update.

There's seemingly some unintended whitespace changes? that `/* cleared */` comment could likely use either removal or an update.
HooglyBoogly marked this conversation as resolved
Jacques Lucke reviewed 2023-10-20 23:23:04 +02:00
Jacques Lucke left a comment
Member

Am I missing something? It seems like use_simplify_normals is not used anywhere.

Am I missing something? It seems like `use_simplify_normals` is not used anywhere.
Author
Member

Ah, shoot, I think I did an incorrect merge in the last update. Thanks.

Ah, shoot, I think I did an incorrect merge in the last update. Thanks.
Hans Goudey added 2 commits 2023-11-08 10:16:13 +01:00
Hans Goudey added 1 commit 2023-11-27 16:27:19 +01:00
Campbell Barton requested changes 2023-11-30 11:33:22 +01:00
Campbell Barton left a comment
Owner

Noticed the meshes don´t refresh when this setting changes (tested with Suzzane, smoothed & sharp edges set).
Even though objects themselves don´t need to be re-calculated I think it´s expected this change will apply to the viewport immediately, instead of users having to toggle edit mode of force updates some other way to see the result.

Otherwise LGTM.

Noticed the meshes don´t refresh when this setting changes (tested with Suzzane, smoothed & sharp edges set). Even though objects themselves don´t need to be re-calculated I think it´s expected this change will apply to the viewport immediately, instead of users having to toggle edit mode of force updates some other way to see the result. Otherwise LGTM.
Hans Goudey added 1 commit 2023-11-30 15:34:40 +01:00
Hans Goudey added 1 commit 2023-12-01 05:42:18 +01:00
Hans Goudey added 3 commits 2023-12-07 17:14:41 +01:00
Hans Goudey requested review from Campbell Barton 2023-12-07 17:15:00 +01:00
Hans Goudey added 1 commit 2023-12-14 15:50:00 +01:00
Campbell Barton approved these changes 2023-12-15 01:29:53 +01:00
@ -2048,3 +2052,3 @@
}
static void rna_Scene_use_simplify_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
static void use_simplify_update(Main *bmain, Scene *sce, bool update_normals)

Prefer rna_Scene_use_simplify_update_impl when an implementation function needs to be split out, matching: rna_Object_internal_update_data_impl, rna_userdef_is_dirty_update_impl.

Prefer `rna_Scene_use_simplify_update_impl` when an implementation function needs to be split out, matching: `rna_Object_internal_update_data_impl`, `rna_userdef_is_dirty_update_impl`.
HooglyBoogly marked this conversation as resolved
Campbell Barton reviewed 2023-12-15 01:37:40 +01:00
@ -2047,1 +2047,4 @@
}
if (scene->r.mode & R_SIMPLIFY_NORMALS || update_normals) {
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);

Couldn't non-geometry objects skip the DEG_id_tag_update? e.g. check OB_TYPE_IS_GEOMETRY(ob) before tagging.

Couldn't non-geometry objects skip the `DEG_id_tag_update`? e.g. check `OB_TYPE_IS_GEOMETRY(ob)` before tagging.
HooglyBoogly marked this conversation as resolved
Hans Goudey added 1 commit 2023-12-16 00:07:05 +01:00
Hans Goudey added 2 commits 2023-12-16 00:18:21 +01:00
Hans Goudey merged commit 912c4c60d8 into main 2023-12-16 00:18:49 +01:00
Hans Goudey deleted branch mesh-normals-simplify-option 2023-12-16 00:18: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 project
No Assignees
4 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#113975
No description provided.