Commit Graph

4066 Commits

Author SHA1 Message Date
Omar Emara
405ec79a0a Fix #112883: GPU compositor crops viewed image
The GPU compositor crops the viewed images to the render resolution.
While the original size and content of the input to the viewer should be
retained as is.

This patch fixes that by specializing compositors that can use composite
outputs to be able to view images of any arbitrary size. This is still
missing the translation offset of the viewer, but this shall be tackled
separately.
2023-10-12 14:03:12 +03:00
Clément Foucault
c8e0a9765e EEVEE-Next: Sphere Probe: Allow evaluation of volume probe
This avoid too dark surfaces if there is no light
in the scene. This prevent energy loss.
2023-10-12 12:50:56 +02:00
Clément Foucault
de2ea031bc Fix EEVE-Next: Broken Parallax
Parallax distance was not actually use.
It was affecting the world and had
unwanted effect if lower than
influence radius.
2023-10-12 12:41:15 +02:00
Clément Foucault
1f12b90ef2 Cleanup: EEVEE-Next: Use references for bind_resources 2023-10-12 12:19:41 +02:00
Clément Foucault
1b4b6bc2f4 Fix EEVEE-Next: Forward Pipeline: Missing resource binds 2023-10-12 12:15:15 +02:00
Jeroen Bakker
83b23d37e7 EEVEE: Fix Compilation Errors
The push constant `double_sided` and `Surfel.double_sided` collided. Due
to the macros that the vulkan backend is creating it isn't possible to
use the same attribute name as an existing push constant.

Pull Request: https://projects.blender.org/blender/blender/pulls/113576
2023-10-12 08:57:25 +02:00
Campbell Barton
b4504c7840 Cleanup: spelling in comments 2023-10-12 16:03:18 +11:00
Clément Foucault
df523f3bf1 EEVEE-Next: Add back lightprobe influence
I had to do a huge refactor in order to do this.

The way ReflectionProbe were referencing the UBO
data was conflicting with the way EEVEE-Next
object should behave.

So like light, shadow and irradiance grids, every
probe is synced with it's GPU data as base struct
and the data is just copied into the UBO
when using `set_view`.

To simplify many parts of the reflection probe
code, I isolated the atlas coordinate of a probe
to its own struct that can be easily copied.

Pull Request: https://projects.blender.org/blender/blender/pulls/113518
2023-10-11 20:19:37 +02:00
Miguel Pozo
1ba16edaf0 EEVEE-Next: Rename light probes
Update to the new naming convention for `Light Probes`:

`Reflection Cubemap` -> `Sphere`
`Reflection Plane` -> `Plane`
`Irradiance Grid` -> `Volume`

Note that this breaks the Python API (`bpy.types.LightProbe.type`).

Pull Request: https://projects.blender.org/blender/blender/pulls/113452
2023-10-11 19:38:42 +02:00
Campbell Barton
91ec9bc5a7 Cleanup: don't use DOXYGEN blocks for inline comments 2023-10-11 10:49:07 +11:00
Clément Foucault
a82e9586c4 Fix EEVEE-Next: Compilation on Metal 2023-10-10 23:52:04 +02:00
Miguel Pozo
e235913c0d Fix: EEVEE-Next: Handle ObjectKey padding bytes 2023-10-10 17:55:23 +02:00
Miguel Pozo
26154aae81 Fix: EEVEE-Next: Bake regression
Missing `hiz_buffer.set_source` call after 80a6a8efe9
2023-10-10 17:40:28 +02:00
Jeroen Bakker
25a1cea8e2 EEVEE-Next: Scene Reflection Probe Resolution
This PR reuses the scene specific reflection probe resolution for all
reflection light probes in the scene. The target is to have a automatic
detection for the resolution. But as long as we don't have a mechanism
for detection it is better to not introduce a new UI element that will
be removed within the foreseen future.

This setting is currently used by EEVEE and EEVEE-Next. EEVEE supports
resolutions upto 4096px. This will be clamped to 2048 when using
EEVEE-Next.

The motivation for this is that EEVEE-Next will soon replace
EEVEE and 4096 can then be removed from the choices that the user can
made. Adding as separate option could need synchronization, and that
option would also be temporary as it will be removed by the resolution
detection mechanism.

Pull Request: https://projects.blender.org/blender/blender/pulls/113491
2023-10-10 14:50:17 +02:00
Clément Foucault
80a6a8efe9 EEVEE-Next: Ray-Tracing: Add Planar Tracing
This traces planar lightprobe captures just like
the screen-space tracing does.

This is implemented as a separate shader that
loads the ray before the screen trace and
check if it can be traced against any available
planar probe. If it does it marks the ray as
traced (negative pdf) so that the screen tracing
pass does not override the result or try to
trace it.

Pull Request: https://projects.blender.org/blender/blender/pulls/113453
2023-10-10 12:55:18 +02:00
Jeroen Bakker
9c52b4e606 Fix #113470: EEVEE-Next doesn't stop sampling
After performing a transformation EEVEE-Next non-stops resets the
sampling. The cause is that the `recalc` flag that are stored in the
Object isn't consumed. When transforming it was always filled with
`ID_RECALC_TRANSFORM` and kept on resetting the sampling.

Regression introduced by PR #113252.

Pull Request: https://projects.blender.org/blender/blender/pulls/113484
2023-10-10 11:49:37 +02:00
Campbell Barton
137f8dd7bc Cleanup: spelling in comments 2023-10-10 09:44:57 +11:00
Hans Goudey
8f27baf388 Merge branch 'blender-v4.0-release' 2023-10-09 23:54:43 +02:00
Hans Goudey
976eaae02f Cleanup: Move BKE_object.hh to C++
Simplifies the fix to #111120, where the object bounds functions
may return a C++ type instead of `BoundBox`.

Pull Request: https://projects.blender.org/blender/blender/pulls/113462
2023-10-09 23:41:53 +02:00
Miguel Pozo
f54205cfdd EEVEE Next: Optional surfel backface culling
Allow disabling surfels backfaces from contributing to volume probes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113362
2023-10-09 17:02:14 +02:00
Germano Cavalcante
ffaf3e30ef DRW: Simplify Selection Engine
The selection engine has some complex tricks that improve performance.
These are:
- Only draws objects whose bounding box intersects the selection
threshold;
- If the viewport or objects are not "dirty", it does not clean the
texture IDs and only adds objects that have not yet been drawn;
- Only updates the depth buffer if a new object is drawn;
- Skip drawing if no object is found;

These tricks were initially implemented so that this engine could be
used for snapping.

But this initial idea has changed and now the engine is only used to
select Vertices, Edges or Faces.

Due to this limited use, these tricks bring no real benefit.
In fact, it's even worse with the Retopology Overlay, as it forces the
Depth buffer to be redrawn.

This commit removes these tricks and only keeps those that indicate
whether the drawing needs to be updated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113308
2023-10-09 11:06:53 -03:00
Jeroen Bakker
701c14acea EEVEE-Next: Support for Intel ARC GPUs
This PR adds support for Intel ARC GPUs. Due barriers inside a non
uniform control flow the Intel ARC can stall the whole system.

The cause is that a barrier is used, but some threads in the shader
have completed. The barriers might wait until it gets the signal from
the exited threads and stalls the system.

Although some implementations support it it is safer to limit the
number of HiZ levels.

Pull Request: https://projects.blender.org/blender/blender/pulls/113447
2023-10-09 15:29:26 +02:00
Jeroen Bakker
f6df5d3514 Fix: EEVEE-Next: Planar Probes First Sample
When the first planar probe is added to the scene, or the last probe
is removed from the scene the samples needs to be reset. This removes
artifacts when only a single sample is used.

Pull Request: https://projects.blender.org/blender/blender/pulls/113440
2023-10-09 14:49:49 +02:00
Miguel Pozo
25160def62 Fix: EEVEE-Next: Nvidia compilation error
Workaround Error: C1317: qualified actual parameter #1 cannot be converted to less qualified parameter
2023-10-09 13:17:19 +02:00
Jeroen Bakker
03040f3b7f Cleanup: Make format 2023-10-09 12:49:02 +02:00
Miguel Pozo
744bdb84f7 Merge branch 'blender-v4.0-release' 2023-10-09 12:13:18 +02:00
Bastien Montagne
df0d7c9c3d WM Jobs: Refactor all worker status variables into a single shared struct.
Move the three current 'status variables' (stop, update and progress)
into a single 'WorkerStatus' struct. This is cleaner and will allow for
future workin this area without having to edit tens of 'startjob'
callbacks signatures all the time.

No functional change expected here.

Note: jobs' specific internal code has been modified as little as
possible, in many cases the job's own data still just store pointers to
these three values. Ideally in the future more refactor will be using a
single pointer to the shared `wmJobWorkerStatus` data instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/113343
2023-10-09 12:12:22 +02:00
Miguel Pozo
2b805e777a Fix: Workbench: resolve_shader_cache initialization 2023-10-09 12:10:56 +02:00
Jeroen Bakker
79c0cd0646 Fix: EEVEE-Next: Planar Reflection During Sculpting
This PR fixes an issue that the shading pass isn't filled when
sculpting. Was detected when querying code that landed
in main.

Pull Request: https://projects.blender.org/blender/blender/pulls/113439
2023-10-09 11:03:20 +02:00
Jeroen Bakker
5f49efc084 Fix: EEVEE-Next: Crash Removing Last Planar Probe
When deleting the last planar probe in the scene the color and
depth textures are resized with 0 layers. This isn't allowed.

This is fixed by adding an early exit and creating dummy textures.

Pull Request: https://projects.blender.org/blender/blender/pulls/113437
2023-10-09 09:35:02 +02:00
Jeroen Bakker
61b463d5e4 EEVEE-Next: Planar Probe Pipeline
This PR is contains the initial capture pipeline for planar probes.

It requires work to generate the correct view to capture and to include
the result during ray tracing. These will be developed in a separate PR.

This PR detects if a planar probe is active in the scene. If this is
the case the planar probe pipeline will be activated. During rendering
this is done by querying the depsgraph, during viewport drawing this
is done during sync. If an planar probe is detected and the pipeline
wasn't activated. The pipeline will be activated and the sampling
will be reset to ensure the pipeline is filled with all objects.

Per object the user can set the visibility of the object in planar
reflections.
![image](/attachments/fcfb40f9-f174-491c-bfba-e7f00f49aa1c)

For a reflection plane the resolution and clipping offset can be set.
EDIT: Resolution option was removed because too complex to
implement with the little time we have at the moment.
![image](/attachments/e42ad9ce-8af8-45d1-aa3a-630db1901ad3)

Related to #112966

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113203
2023-10-08 19:49:58 +02:00
Clément Foucault
3cca8680e0 EEVEE-Next: Split Thickness Approximation
This moves the thickness from shadow map
approximation out of the lighting and shadowing
loop. Instead of using the thickness from
the shadow tracing from each individual light
before SSS evaluation, we precompute the
average thickness from all shadowed light.
This is then mixed with the nodetree thicknes.

## SSS Translucency
This add back SSS transmission support by using
the mentionned thickness computation, and applying the
transmission profile on it. This is then applied on top of a
flipped normal LTC computation.

Pull Request: https://projects.blender.org/blender/blender/pulls/113401
2023-10-08 00:29:06 +02:00
Clément Foucault
7c694c9d04 EEVEE-Next: Refactor Light evaluation
This allow splitting shadow and light evaluation.
This is the first step to deferred shadowing.

The evaluate closure types can be dynamically
set which mean we can have arbitrary BSDF
evaluation inside the same shader.

This also contain some refactor to `light_lib.glsl`
for more consistency and less clutter.

Note that this breaks the SSS translucency
as the shadow evaluation changes for these.
A new solution for this feature is to be found

Pull Request: https://projects.blender.org/blender/blender/pulls/113257
2023-10-08 00:15:41 +02:00
Campbell Barton
4b3e7b3928 License headers: add SPDX header 2023-10-07 18:13:22 +11:00
Clément Foucault
5e43bf3483 EEVEE-Next: Refactor Lightprobe irradiance evaluation
This refactor the lightprobes sample so that we always query
the spherical probe and the volume probe.

Then, given the BSDF type, we reconstruct the incoming radiance
differently depending on the ray probability blending between
the spherical and volume probe depending on ray probability.

Moreover, we implement cubemap normalization using
volume probe spherical harmonic data at spherical probe
position and at the shading point position.

Pull Request: https://projects.blender.org/blender/blender/pulls/113301
2023-10-06 23:37:38 +02:00
Clément Foucault
eb9d765eea Fix EEVEE-Next: Broken compilation on Metal 2023-10-06 17:53:29 +02:00
Miguel Pozo
c567f7ccae Merge branch 'blender-v4.0-release' 2023-10-06 15:36:37 +02:00
Miguel Pozo
fe39456ba5 Workbench: Fix: Performance Regressions
Optimize Workbench performance so it's on par with the previous
implementation.
Most of these changes are barely noticeable on powerful GPUs,
but can cause a notable performance improvement on old or low-end
hardware.

* Avoid unnecessary texture copies and draw directly to the viewport
   textures.
* Optimize-out depth/stencil reads, using stencil testing instead.
* Avoid using `Texture::clear` and use framebuffer clears instead.
* Avoid framebuffer state changes (always use the same attachments).
* Avoid constant variation of acquired `TextureFromPool`s.

Fix #113010

Pull Request: https://projects.blender.org/blender/blender/pulls/113251
2023-10-06 15:31:44 +02:00
Miguel Pozo
57cfe20e5b EEVEE-Next: Fix DupliObject ObjectKey
Fixed version of #112544 (reverted).

`DRW_drawdata_get` reuses the same `DrawData` for all duplis,
so they all end up using the same `ObjectHandle` and `ObjectKey`,
which breaks motion vectors.

* Don't rely on `DRW_drawdata_get` for storing `ObjectKey`s.
* Simplify `ObjectKey`.

This also solves the issue of objects created "on the fly" always having
the `ID_RECALC_ALL` flag.

Pull Request: https://projects.blender.org/blender/blender/pulls/113252
2023-10-06 15:29:50 +02:00
Jeroen Bakker
44882ceb7b EEVEE-Next: Several Fixes Reflection Probes Workflow
This fixes several issues related to using reflection probes in EEVEE-Next.

- When using a single sample, the reflection probes weren't always updated.
- Composite world background in reflection probes
- Removing reflection probes wasn't working
- Update UBO when world and reflection probes are active in the scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/113347
2023-10-06 14:43:19 +02:00
Falk David
7e87435cf4 GPv3: Initial drawing tool
This PR implements an initial drawing tool that can already be used for testing.
While this is not fully feature complete (compared to the current grease pencil draw tool) the following is already implemented:

* Pressure support for radius and opacity.
* Material color and vertex color support.
* New active smoothing algorithm based on curve fitting.
* Simplify algorithm as a post-process step.

Some deliberate limitations include:
* The drawing plane is always the front plane. Drawing on surfaces is also not supported.
*

The current approach has not been optimized for performance yet. The goal was to have a straightforward implementation
first and then focus on performance later.

There are numerous parameters in the code that are hard-coded for now. These should be exposed at some point, potentially as user settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/110093
2023-10-06 10:49:54 +02:00
Campbell Barton
71b1712d79 Cleanup: spelling in comments 2023-10-06 12:50:27 +11:00
Miguel Pozo
40f93532bb Fix: EEVEE-Next: Irradiance Grid baking
Regression caused by e2cef1c713
2023-10-05 19:37:04 +02:00
Jason Fielder
57a3ab29cc Metal: EEVEE Next: Optimize Virtual shadow maps for Apple Silicon
Optimization of EEVEE Next's Virtual Shadow Maps for TBDRs.
The core of these optimizations lie in eliminating use of
atomic shadow atlas writes and instead utilise tile memory to
perform depth accumulation as a secondary pass once all
geometry updates for a given shadow view have been updated.

This also allows use of fast on-tile depth testing/sorting, reducing
overdraw and redundant fragment operations, while also allowing
for tile indirection calculations to be offloaded into the vertex
shader to increase fragment storage efficiency and throughput.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/111283
2023-10-05 19:02:39 +02:00
Bastien Montagne
acde11f159 Cleanup: wmJobs: Use defined startjob callback type everywhere.
For some reasons, `WM_jobs_stop` and `WM_jobs_kill` would use their own
'type' of function pointer - and not even a matching one!

Among (many) other reasons why this was bad, it required very stupid
casting from code using these functions - and made editing wmJob `startjob`
signature needlessly complicated.
2023-10-05 16:13:15 +02:00
Jeroen Bakker
355f457cd4 EEVEE-Next: Fix Reflection Probes Sampling
When the scene has reflection probes the sampling would be reset
each frame making the viewport always redraw and not resolve.

The reason was a logic error that was introduced when we introduced
a less flickering update for reflection probes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113281
2023-10-05 11:27:31 +02:00
Jeroen Bakker
f1c0ec3c4b EEVEE-Next: Remove Unused Resources in Probe Capture Pipeline
The probe capture pipeline still had some bindings from the previous
implementation. This could result in overwriting the `gbuf_header_tx`
with the incorrect texture as it was sharing the same binding.

This PR removes the unused light probe bindings.

Pull Request: https://projects.blender.org/blender/blender/pulls/113276
2023-10-05 10:52:47 +02:00
Jeroen Bakker
3d1da2532b EEVEE-Next: Fix Crash With Exact 128 Resources
When the scene has exact 128 resources or a multiple in the scene
Blender crashes as the velocity buffer doesn't allocates the
right amount of space inside its buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/113277
2023-10-05 10:52:26 +02:00
Campbell Barton
6f23344a7a Merge branch 'blender-v4.0-release' 2023-10-05 13:58:49 +11:00
Campbell Barton
9d20632925 Cleanup: ensure trailing newline, delete trailing space 2023-10-05 13:57:14 +11:00