Mesh: Improvements to position and normal draw extraction #116902
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116902
Loading…
Reference in New Issue
No description provided.
Delete Branch "HooglyBoogly/blender:mesh-extract-normal-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently there are two vertex buffers that contain mesh normals. First, the
normals are extracted and stored interleaved with positions. Then there is
a second vertex buffer for just normals. Interleaving them makes some
sense, since they change together, but it fights with the contiguous storage
benefits of
Mesh
and generally makes code more difficult to optimize.This PR removes the normals interleaved with the positions and changes
the code for extracting positions and normals from meshes to be simpler
and faster, mainly by not using the "extract iterators" as described by the
#116901 design task. That moves most of the branching outside of hot
loops, so we don't do the same work for every mesh element. This also
gives us the option of not calculating or extracting normals in more
situations like wireframe display in the future.
This is only a small part of the work for #116901, so the state of the code
after this PR will have more design inconsistencies. I'll keep working to
resolve those in the future.
In general I observed at least a 5-40% improvement in FPS in playback
of files with large meshes.
Some performance numbers with various test files I had locally:
2m face sculpt
15 FPS
21 FPS
crab monster:
rdata 0ms iter 19ms (frame 24ms)
rdata 0ms iter 18ms (frame 22ms)
16m grid:
rdata 0ms iter 182ms (frame 892ms)
rdata 0ms iter 107ms (frame 457ms)
large molecular nodes mesh:
93 FPS playback
97 FPS playback
@ -33,3 +33,3 @@
#include "mesh_extractors/extract_mesh.hh"
// #define DEBUG_TIME
#define DEBUG_TIME
Seems like an unintended change.
Thanks, yeah I still have some more cleanup to do here :)
Mesh: Improvements to position and normal draw extractionto WIP: Mesh: Improvements to position and normal draw extractionWIP: Mesh: Improvements to position and normal draw extractionto Mesh: Improvements to position and normal draw extractionMesh: Improvements to position and normal draw extractionto WIP: Mesh: Improvements to position and normal draw extractionWIP: Mesh: Improvements to position and normal draw extractionto Mesh: Improvements to position and normal draw extraction@blender-bot build
@blender-bot build
@ -39,4 +43,2 @@
/* WARNING Adjust #PosNorLoop struct accordingly. */
GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
GPU_vertformat_alias_add(&format, "vnor");
vnor
should be kept as alias to vertex normal for edit mode. I don't know where this resides after this patch.Here, removing
GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
makes the aliasvnor
and alias ofpos
If
nor
is present in multiple VBO, the latest VBO in aGPUBatch
takes predecence.I guess this is no longer wanted after this patch, where only one of the normal (vnor/lnor) would be bound to a
GPUBatch
.@blender-bot build
As discussed in person, this breaks everything using vertex normals.
Vertex normals need to be introduced back in some common batches for that to work.
@blender-bot build