WIP: Overlay Next: Shapes and Extras #109059

Draft
Miguel Pozo wants to merge 78 commits from pragma37/blender:pull-overlay-next-extras into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member
  • Port all Extra shapes.
  • Port most Extra passes.

Still WIP.
I'm creating the PR for feedback on the code organization, and whether it's a good design to follow for the rest of the engine.
It tries to follow the object-oriented style established in the initial Overlay Next PR, while adding some utility classes to avoid error-prone "boiler-plate" needed for most of the overlay types (OverlayPasses and OverlayType).

overlay_next_speaker.hh is the simplest example.
See overlay_next_light_probe.hh for a complex one.

* Port all Extra shapes. * Port most Extra passes. Still WIP. I'm creating the PR for feedback on the code organization, and whether it's a good design to follow for the rest of the engine. It tries to follow the object-oriented style established in the initial Overlay Next PR, while adding some utility classes to avoid error-prone "boiler-plate" needed for most of the overlay types (`OverlayPasses` and `OverlayType`). `overlay_next_speaker.hh` is the simplest example. See `overlay_next_light_probe.hh` for a complex one.
Miguel Pozo added the
Module
EEVEE & Viewport
label 2023-06-16 18:25:51 +02:00
Miguel Pozo added 78 commits 2023-06-16 18:26:04 +02:00
f0514484f5 DRW: Wrappers: Add TextureRef to wrap around GPUTexture pointers
This adds the possibility to use the C++ API for other GPUTexture.
968f5748c6 Merge branch 'main' into overlay-next
# Conflicts:
#	release/scripts/startup/bl_ui/space_userpref.py
#	source/blender/makesdna/DNA_userdef_types.h
#	source/blender/makesrna/intern/rna_userdef.c
cdb9b6a041 Overlay-Next: Add support for empties
Also added a shape cache and move the color selection to `Resources`.
ef0126f3a7 Merge branch 'main' into overlay-next
# Conflicts:
#	source/blender/makesdna/DNA_userdef_types.h
84ff44769f Overlay-Next: Add high level separation of selection code
This makes it possible to reuse the overlay engine code for selection
purpose, but without any overhead for the viewport drawing.

The separation is made clear by having a dummy selection implementation for
viewport drawing and an object implementation for object selection.
Other impementation might come later (like for depth picking).
78ae27bab3 Overlay-Next: Add depth Prepass basics
The depth prepass is supposed to replace the Basic engine:
- Draw object depth when the engine doesn't give correct depth buffer
- Used for object selection
16cc2446f5 Overlay-Next: Add shader module
This allows cleaner declarations of shaders as well as allowing easier
swapping of the whole shader module for selection & clipping.

This also allow to easier toggle between the old overlay engine and
overlay-next as they don't share the same shaders anymore.
ea66898bbe Select-Next: Introduce shader level patching to output selection ids
This leverage imageLoad/Store operations to remove the use of cumbersome
visibility queries.

Patching shaders should only require 4 lines of code (2 for includes, 2 for
the id passthrough).
3ac54f67bf Select-Next: Add result buffer injection
This allow compatibility with the old system.
7676b627c2 Merge branch 'main' into overlay-next
# Conflicts:
#	source/blender/draw/engines/select/select_engine.c
#	source/blender/draw/engines/select/shaders/infos/select_id_info.hh
96b8a8cbba Move the hot path back to header files
Revert a 5% performance decrease caused by the hh/cc split.
Miguel Pozo added this to the EEVEE & Viewport project 2023-06-16 18:26:14 +02:00
Miguel Pozo requested review from Clément Foucault 2023-06-16 18:27:01 +02:00
Miguel Pozo requested review from Jeroen Bakker 2023-06-16 18:27:15 +02:00
Clément Foucault requested changes 2023-06-29 15:12:49 +02:00
Clément Foucault left a comment
Member

Took me a while to get accustomed to it.

I think in general that the classes lacks documentations and meaningful naming. That's what makes the whole system a bit hard to understand.

The use of them however, looks clean.

I'm still a bit concern as I'm not sure this makes the code harder or easier to understand. Since this code is supposed to be modified by other developers that are not familiar with drawing concepts, I would prefer if we keep the bar low. But I am unsure what to do about it.

Took me a while to get accustomed to it. I think in general that the classes lacks documentations and meaningful naming. That's what makes the whole system a bit hard to understand. The use of them however, looks clean. I'm still a bit concern as I'm not sure this makes the code harder or easier to understand. Since this code is supposed to be modified by other developers that are not familiar with drawing concepts, I would prefer if we keep the bar low. But I am unsure what to do about it.
@ -2428,3 +2428,3 @@
({"property": "enable_workbench_next"}, ("blender/blender/issues/101619", "#101619")),
({"property": "use_grease_pencil_version3"}, ("blender/blender/projects/40", "Grease Pencil 3.0")),
({"property": "enable_overlay_next"}, ("blender/blender/issues/102179", "#102179")),
({"property": "use_grease_pencil_version3"}, ("blender/blender/projects/40", "Grease Pencil 3.0")),

Unwanted change

Unwanted change
@ -0,0 +60,4 @@
float3 size;
BKE_boundbox_calc_size_aabb(bb, size);
if (boundtype == OB_BOUND_BOX) {

Use switch

Use `switch`
@ -0,0 +362,4 @@
Object *camera_object = DEG_get_evaluated_object(state.depsgraph, v3d->camera);
const bool is_select = state.selection_type != SelectionType::DISABLED;
const bool is_active = (ob == camera_object);
const bool look_through = (is_active && (rv3d->persp == RV3D_CAMOB));

is_camera_view

is_camera_view
@ -0,0 +12,4 @@
namespace blender::draw::overlay {
class CollisionPasses : public BoundPassesBase {

I would just merge that with the BoundPasses and avoid the base class. This would avoid splitting the drawing buffers.

I would just merge that with the `BoundPasses` and avoid the base class. This would avoid splitting the drawing buffers.
@ -88,0 +108,4 @@
return;
}
const select::ID select_id = resources.select_id(ob_ref);

I would not put the select_id creation there. It would create id for object that might not be drawn. Also it is further for the code that actually uses it.

I would not put the select_id creation there. It would create id for object that might not be drawn. Also it is further for the code that actually uses it.
@ -269,0 +412,4 @@
}
};
class OverlayPasses {

This class is too generic of a name. It should be GeometryPass since it is instanciated twice in OverlayType.

This class is too generic of a name. It should be `GeometryPass` since it is instanciated twice in `OverlayType`.
@ -269,0 +420,4 @@
PassSimple ps_;
enum ExtraType { DEFAULT, DEFAULT_ALWAYS, BLEND_CULL_FRONT, BLEND_CULL_BACK, MAX };

Document each values. Not sure what's the difference between DEFAULT and DEFAULT_ALWAYS.

Document each values. Not sure what's the difference between `DEFAULT` and `DEFAULT_ALWAYS`.
@ -75,11 +78,44 @@ ShaderModule::ShaderModule(const SelectionType selection_type, const bool clippi
extra_shape = selectable_shader("overlay_extra", [](gpu::shader::ShaderCreateInfo &info) {
info.storage_buf(0, Qualifier::READ, "ExtraInstanceData", "data_buf[]");

I would rename ExtraInstanceData to ShapeInstanceData so that we can use ShapeInstanceBuf instead of the less meaningful ExtraInstanceBuf.

I would rename `ExtraInstanceData` to `ShapeInstanceData` so that we can use `ShapeInstanceBuf` instead of the less meaningful `ExtraInstanceBuf`.
This pull request has changes conflicting with the target branch.
  • scripts/startup/bl_ui/space_userpref.py
  • source/blender/draw/engines/overlay/overlay_next_empty.hh
  • source/blender/draw/engines/overlay/overlay_next_private.hh
  • source/blender/draw/engines/overlay/overlay_next_shader.cc
  • source/blender/draw/engines/overlay/overlay_next_shape.cc
  • source/blender/draw/intern/draw_command.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u pull-overlay-next-extras:pragma37-pull-overlay-next-extras
git checkout pragma37-pull-overlay-next-extras
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 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#109059
No description provided.