Overlay-Next: Light Probe #125828

Merged
Clément Foucault merged 6 commits from laurynas/blender:overlay-next-lightprobe into main 2024-08-05 17:20:28 +02:00
Contributor

Overlay-Next version of light probe.

Rel #102179

Overlay-Next version of light probe. Rel #102179
Laurynas Duburas added 1 commit 2024-08-03 09:07:03 +02:00
Laurynas Duburas added 1 commit 2024-08-03 09:08:19 +02:00
Laurynas Duburas reviewed 2024-08-03 09:16:42 +02:00
@ -0,0 +143,4 @@
const uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y *
prb->grid_resolution_z;
ps_dots_.push_constant("gridModelMatrix", matrix);
ps_dots_.draw_procedural(GPU_PRIM_POINTS, 1, cell_count, 0, {0}, select_id.get());
Author
Contributor

First try was put matrices and select_ids into simple Vector<std::pair<float4x4, select:ID>> and then
in LightProbes::end_sync to call draw_procedural for each pair. That way code looked cleaner and only PassSimple was used. But selection by dots didn't work as I couldn't think of a way to get select_id in shader passed with draw_procedural.

First try was put matrices and select_ids into simple `Vector<std::pair<float4x4, select:ID>>` and then in `LightProbes::end_sync` to call `draw_procedural` for each pair. That way code looked cleaner and only `PassSimple` was used. But selection by dots didn't work as I couldn't think of a way to get `select_id` in shader passed with `draw_procedural`.

This is simpler and more in line with what we want.

You already get a lot of performance saving by doing a procedural draw so batching them together is not saving much.

This is simpler and more in line with what we want. You already get a lot of performance saving by doing a procedural draw so batching them together is not saving much.
laurynas marked this conversation as resolved
Laurynas Duburas reviewed 2024-08-03 09:17:58 +02:00
@ -0,0 +58,4 @@
ps_dots_.shader_set(res.shaders.extra_grid.get());
ps_dots_.bind_ubo("globalsBlock", &res.globals_buf);
ps_dots_.bind_texture("depthBuffer", &res.depth_tx);
ps_dots_.push_constant("isTransform", (G.moving & G_TRANSFORM_OBJ) != 0);
Author
Contributor

This expression bothers me.

This expression bothers me.

Why? is that the global access that bothers you?

Why? is that the global access that bothers you?
Author
Contributor

Yes. Thought that there is a replacement like for G_draw.block_ubo.
If you see no problem, I'm fine too.

Yes. Thought that there is a replacement like for `G_draw.block_ubo`. If you see no problem, I'm fine too.

For these globals that are supposed to be globals by design (at least for now) that's fine.

For these globals that are supposed to be globals by design (at least for now) that's fine.
laurynas marked this conversation as resolved
Laurynas Duburas requested review from Clément Foucault 2024-08-03 09:19:57 +02:00
Laurynas Duburas added 1 commit 2024-08-03 09:25:42 +02:00
Laurynas Duburas changed title from WIP: Overlay-Next: Light Probe to Overlay-Next: Light Probe 2024-08-03 09:26:22 +02:00
Clément Foucault requested changes 2024-08-03 16:13:01 +02:00
Dismissed
Clément Foucault left a comment
Member

Some nitpicky comments. Didn't test yet. But code looks good.

Some nitpicky comments. Didn't test yet. But code looks good.
@ -122,3 +122,3 @@
theme_color[3] = -max_ff(la.radius, FLT_MIN);
call_buffers_.spot_buf.append(data, select_id);
if ((la.mode & LA_SHOW_CONE) && !DRW_state_is_select()) {
if ((la.mode & LA_SHOW_CONE) && selection_type_ != SelectionType::ENABLED) {

It is better to test against DISABLED in case we add more enum types. Also it is clearer to test equality in general.

It is better to test against `DISABLED` in case we add more enum types. Also it is clearer to test equality in general.
fclem marked this conversation as resolved
@ -764,0 +786,4 @@
constexpr float sin_pi_3 = 0.86602540378f;
constexpr float cos_pi_3 = 0.5f;
const Array<float2, 6> points = {
float2{0.0f, 1.0f} * r,

We tend to prefer float2(0.0f, 1.0f) as it matches our type cast style : https://developer.blender.org/docs/handbook/guidelines/c_cpp/#c-type-cast

Arguably this is not written anywhere. But float2( returns 1000+ matches in the codebase while float2{ only 50+. So I would rather keep it consistent.

This can be done in a followup cleanup commit to fix all occurences inside overlay next.

We tend to prefer `float2(0.0f, 1.0f)` as it matches our type cast style : https://developer.blender.org/docs/handbook/guidelines/c_cpp/#c-type-cast Arguably this is not written anywhere. But `float2(` returns 1000+ matches in the codebase while `float2{` only 50+. So I would rather keep it consistent. This can be done in a followup cleanup commit to fix all occurences inside overlay next.
laurynas marked this conversation as resolved
@ -764,0 +833,4 @@
}
/* lightprobe_grid */
{

empty line

empty line
laurynas marked this conversation as resolved
Laurynas Duburas added 2 commits 2024-08-03 19:31:44 +02:00
float2 list initialization to constructor call
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
524c23393c
Clément Foucault added the
Interest
Overlay
label 2024-08-05 12:51:56 +02:00
Clément Foucault approved these changes 2024-08-05 16:46:00 +02:00

@blender-bot build

@blender-bot build
Clément Foucault added 1 commit 2024-08-05 16:51:07 +02:00
Clément Foucault merged commit f340d7037c into main 2024-08-05 17:20:28 +02:00
Laurynas Duburas deleted branch overlay-next-lightprobe 2024-08-05 19:54:38 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
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#125828
No description provided.