Commit Graph

7301 Commits

Author SHA1 Message Date
Ray Molenkamp ae25298774 Cleanup: CMake: Modernize bf_blenfont dependencies
Pretty straightforward

- Remove any bf_blenfont paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115365
2023-11-24 18:29:09 +01:00
Ray Molenkamp b683bcc46c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any bf_intern_clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115323
2023-11-24 17:12:24 +01:00
Jason Fielder 18f7d158fe GPU: cleanup texture view usage flags
Texture usage flag `GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW`
was originally implemented and used too conservatively for many
cases in which the underlying API flags were not required.

Renaming to `GPU_TEXTURE_USAGE_FORMAT_VIEW` to reflect
the only essential use case for when a texture view is initialized with
a different texture format to the source texture. Texture views can
still be created without this flag when mip range or base level is
adjusted,

This flag is still required by stencil views and internally by the Metal
backend for certain feature support such as SRGB render toggling.

Patch also includes some small changes to the Metal backend to
adapt to this new compatibility and correctly capture all texture view
use-cases.

Related to #115269

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/115300
2023-11-24 15:21:00 +01:00
Clément Foucault ab7505c7ce EEVEE-Next: Disable distant light if world contains absorption
This restrict the usage of distant light if the world shader
contains absorption phenomenon.

Why this is needed is described in #114062.

At the same time, this removes the parameter for enabling
volume light as this is now an auto-detected optimization.

This also contains a few small cleanups.

Pull Request: https://projects.blender.org/blender/blender/pulls/115284
2023-11-24 13:51:07 +01:00
Clément Foucault 2ece99891b Fix: EEVEE-Next: Metal shader compilation error
`vertex` is the name of the function entry point and is
defined as a macro. Renaming fixes the issue.
2023-11-23 23:53:23 +01:00
Miguel Pozo 13139f593e Fix: EEVEE-Next: Add transparency blending back
The flag was incorrectly removed in 440f39f2e5
2023-11-23 20:22:34 +01:00
Miguel Pozo 1d2a27d49e Fix: EEVEE-Next: Motion Vectors for non float4 position buffers
Use a compute shader to copy non float4 position vertex buffers into the
`geometry_steps` buffer.

Fix #113730
Fix #114775
Fix #114144

Pull Request: https://projects.blender.org/blender/blender/pulls/115309
2023-11-23 19:49:56 +01:00
Miguel Pozo ae1e2951c7 Fix #115144: isect_data_setup compiler error
Rename `isect_data_setup` functions to avoid shader compiler errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/115175
2023-11-23 16:02:10 +01:00
Miguel Pozo cb9584b561 Fix #114482: EEVEE-Next: Wrong Texture Coordinates
Fix Texture Coordinates in World material and screen_coordinates
when using overscan.

Pull Request: https://projects.blender.org/blender/blender/pulls/115057
2023-11-23 15:58:08 +01:00
Miguel Pozo 3197881ca3 Fix #114302: EEVEE Next: Curves material compilation errors
Add missing includes and remove the attributes_lib from shaders
that don't need them.

Pull Request: https://projects.blender.org/blender/blender/pulls/114598
2023-11-23 15:47:56 +01:00
Harley Acheson ff04d50eee Cleanup: Make format
Formatting changes resulting from running Make Format
2023-11-22 12:50:31 -08:00
Clément Foucault 440f39f2e5 Fix: EEVEE-Next: blending of dithered material
The code removed in #115066 forgot to remove the
blend method.
2023-11-22 19:21:47 +01:00
Clément Foucault 2c8fbde612 Fix: EEVEE-Next: Ambient Occlusion pass broken 2023-11-22 18:31:52 +01:00
Clément Foucault beee7db425 Cleanup: EEVEE-Next: Remove use of deprecated DRWView API 2023-11-22 18:08:46 +01:00
Clément Foucault 14d4da7555 EEVEE-Next: Add back transparent render pass
Straight forward implementation.
2023-11-22 17:48:58 +01:00
Miguel Pozo 7ab622475d Fix: EEVEE-Next: MaterialKey
Options are no longer smaller than sizeof(*mat).
2023-11-22 16:40:12 +01:00
Miguel Pozo b4f62180fb Fix #114291: EEVEE-Next: Deferred tranparency blending
Disable blending in the deferred pass.

Pull Request: https://projects.blender.org/blender/blender/pulls/115066
2023-11-22 15:10:24 +01:00
Jeroen Bakker fdf9750df9 EEVEE-Next: Cleanup Lookdev as its shaders are never deferred compiled
Code assumed that lookdev shaders could be deferred compiled, but
that is never the case. This PR cleans up some related code and
mechanisms that were introduced because we thought it was the case.

Pull Request: https://projects.blender.org/blender/blender/pulls/114368
2023-11-22 14:44:57 +01:00
Clément Foucault a001cf9f2b EEVEE-Next: Displacement Option
This add the displacement option to EEVEE materials.
This unifies the option for Cycles and EEVEE.

The displacement only option is not matching cycles
and not particularly useful. So we decided to not
support it and revert to displacement + bump.

Pull Request: https://projects.blender.org/blender/blender/pulls/113979
2023-11-21 19:55:38 +01:00
Xavier Hallade 14500953ed Overlay: Wireframe: avoid using custom depth bias with xray enabled
e000dcb849 has a performance
impact as it prevents early depth test, it's best to restrict it to when
xray is disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/114466
2023-11-21 19:23:59 +01:00
Clément Foucault 3097d5d821 EEVEE-Next: Add horizon scan to raytracing module
This uses the principles outlined in
Screen Space Indirect Lighting with Visibility Bitmask
to compute local and distant diffuse lighting.

This implements it inside the ray-tracing module as a fallback when the
surface is too rough. The threshold for blending between technique is
available to the user.

The implementation first setup a radiance buffer and a view normal
buffer. These buffer are tracing resolution as the lighting quality is
less important for rough surfaces. These buffers are necessary to avoid
re-projection on a per sample basis, and finding and rotating the
surface normal.

The processing phase scans the whole screen in 2 directions and outputs
local incomming lighting from neighbor pixels and the remaining
occlusion for everything that is outside the view.

The final steps filters the result of the previous phase while applying
the occlusion on the probe radiance to have an energy conserving mix.

Related #112979

Pull Request: https://projects.blender.org/blender/blender/pulls/114259
2023-11-21 16:24:14 +01:00
Miguel Pozo 9320742b45 Fix #114651: EEVEE-Next: SSS NaNs
Before #112901, subsurface scattering was skipped if its radius was
less than 1 pixel.
Aside from an optimization, this also avoided divisions by zero in
`burley_eval`.
This just brings back the early return when `pixel_footprint < 1.0`.

Pull Request: https://projects.blender.org/blender/blender/pulls/114928
2023-11-21 15:47:51 +01:00
Jason Fielder 3f3f4c3478 EEVEE Next: Ensure HiZ buffer update flag is cleared
HiZ dirty flag was previously not cleared upon update
resulting in duplicate updates in several places, without
source depth input having changed.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115235
2023-11-21 12:44:27 +01:00
Hans Goudey 8d2b203a3d Cleanup: Remove unnecessary keywords in C++ header 2023-11-20 22:12:27 -05:00
Hans Goudey ea78af4b5d Cleanup: Move draw_subdivision.h to C++ 2023-11-20 22:07:11 -05:00
Hans Goudey 301731692e Cleanup: Access sculpt attributes with C++ attribute API
Access masks and face sets through the `BKE_attribute.hh` API. This
us more flexibility long term, and makes code a bit simpler in the
meantime.
2023-11-20 13:14:34 -05:00
Hans Goudey f2bcd73bd2 Mesh: Move sculpt mask to a generic attribute
Store paint masks as generic float attributes, with the name
`".sculpt_mask"`. This is similar to 060a534141, which made
the same change for face sets. The benefits are general
consistency, nicer code, and more support in newer areas
that deal with attributes like geometry nodes.

The RNA API is replaced with one created in Python. The new
API only presents a single layer as an attribute class, so it
should be simpler to use in general:
- Before: `object.data.vertex_paint_masks[0].data[0].value`
- After: `object.data.vertex_paint_mask.data[0].value`

Pull Request: https://projects.blender.org/blender/blender/pulls/115119
2023-11-20 17:42:01 +01:00
Miguel Pozo 4dc1c23384 Fix #114742: Draw: Buffers never shrink
The buffers from the new Draw Manager increase their size as needed,
but they never shrink.

Add `StorageArrayBuffer::trim_to_next_power_of_2` function that can
downsize the buffer following the same heuristic as `get_or_resize`.
Add `StorageVectorBuffer::trim_and_clear`, which calls
`trim_to_next_power_of_2` automatically.

Pull Request: https://projects.blender.org/blender/blender/pulls/114857
2023-11-20 12:23:12 +01:00
Jason Fielder b8c84d03cd Fix #107025: Resolve incorrect UV stretch color on macOS
Modify `UVStretchAngle` vertex struct alignment to match
4-byte struct alignment for Metal. This includes reordering
array elements to the front and adding additional padding
to the struct in Metal such that the raw-data write size
matches the padded vertex format.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/114923
2023-11-20 08:45:56 +01:00
Hans Goudey dd902d97ab Cleanup: Add missing forward struct declaration 2023-11-19 17:31:37 -05:00
Miguel Pozo f27e87db7a Fix #114918: Workbench: Negative scaled sculpt mesh artifacts 2023-11-17 16:37:59 +01:00
Omar Emara c5eb420c74 Viewport Compositor: Allow access to depth pass
This patch allows access to the depth pass in the Viewport Compositor.

Since the depth information require full precision, making use of the
pass requires the full precision option for now. In the future, this
pass will always be stored using full precision regardless of the
precision option.
2023-11-16 15:04:47 +02:00
Hans Goudey 3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Hans Goudey 4bcdc57fc8 Refactor: Move object runtime data to separate allocation
Move object runtime data to a separate header and allocate it separately
as `blender::bke::ObjectRuntime`. This is how node, mesh, curves, and
point cloud runtime data is stored.

Benefits:
- Allow using C++ types in object runtime data
- Reduce space required for Object struct in files
- Increase conceptual separation between DNA and runtime data
- Remove the need to add manual padding in runtime data
- Include runtime struct definition only in files that require it

Pull Request: https://projects.blender.org/blender/blender/pulls/113957
2023-11-15 18:46:07 +01:00
Hans Goudey 6d18fe76b5 Fix: Incorrect default used when retrieving material indices 2023-11-15 16:16:22 +01:00
Hans Goudey 1a8b5bcd43 Fix #114841: Sculpt Multires drawing broken with no mask
The GPU buffer type was replaced with `float` in 4151691552,
but the "no mask" case wasn't changed. We still assigned a `uchar` value
to a `float` pointer, which made the drawing look random. Instead do the
same fill we use for other PBVH types.

Pull Request: https://projects.blender.org/blender/blender/pulls/114846
2023-11-14 16:28:46 +01:00
Hans Goudey 7b51d32dd9 Cleanup: Move BKE_modifier.h to C++ 2023-11-14 09:30:40 +01:00
Miguel Pozo f1c7089a2f Fix #114001: EEVEE-Next: Wrong compositing with volumes+transparency
Ensure the correct framebuffer is bound in transparent_ps.
2023-11-13 16:52:58 +01:00
Hans Goudey 583bd9662e Cleanup: Remove C header from C++ math header
Remove some redundancy between headers, more fully
separate the C++ headers from the older C headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/114705
2023-11-11 21:09:54 +01:00
Jeroen Bakker 0c9433bf44 Vulkan: Retarget Depth Range
OpenGL uses a depth range between -1 and 1, which is then normalized.
Metal & Vulkan uses a depth range between 0 and 1, which is already normalized.

The final plan would be to default to a depth range between 0 and 1, but
for now the depth ranges are retargetted so they won't be clipped away.

This solves the next issues for users:
- Navigate control will be rendered correctly
- Ortographic view clipping artifacts
- EEVEE light evaluation

Retargetting happens at the end of the vertex stage or when a geometry
stage is present at the end of the geometry stage. Derivatives using
depth would have a different value compared to OpenGL, but would match
Metal backend. OpenGL performs clipping and generates derivatives based
on the original depth value.

`gl_FragCoord` and clipping would have some precision differences as clipping
and normalizing are done in a different order but would match Metal.

Geometry shaders should use `gpu_EmitVertex` to ensure that the retargetting
is done per vertex.

Pull Request: https://projects.blender.org/blender/blender/pulls/114669
2023-11-10 12:32:06 +01:00
Campbell Barton a615dcdfa8 Cleanup: add missing header to CMake, sort file lists 2023-11-10 09:40:05 +11:00
Campbell Barton 6bba008325 Cleanup: format 2023-11-09 09:34:49 +11:00
Martijn Versteegh 596aab27bd Merge branch 'blender-v4.0-release' 2023-11-08 21:32:30 +01:00
Martijn Versteegh aaf6937631 Fix #112697: Skip non-existing UV maps on VBO upload
Fix #112697: Skip unavaliable UV maps on VBO upload

The list of available UV maps is generated for the evaluated object,
however if any modifier generates UV maps (for example Geometry
Nodes) it is possible the evaluated object contains UV maps which are
not present in the base mesh. So when only the base mesh is uploaded,
for example in the UV editor, UV maps present in the list are not
guaranteed to exist.

Pull Request: https://projects.blender.org/blender/blender/pulls/114558
2023-11-08 21:31:22 +01:00
Miguel Pozo f2a7145a57 Fix #114404: EEVEE-Next: Render region enforced even when disabled 2023-11-08 19:13:26 +01:00
Hans Goudey ece4b6e84d Cleanup: Remove unused functions
See 7b89a0a580, ae1b4a6a28
2023-11-08 10:18:37 +01:00
Sergey Sharybin 7b89a0a580 Cleanup: Mark unused arguments as such
Pull Request: https://projects.blender.org/blender/blender/pulls/114619
2023-11-08 09:44:58 +01:00
Omar Emara 474b6fa070 Realtime Compositor: Support full precision compositing
This patch adds support for full precision compositing for the Realtime
Compositor. A new precision option was added to the compositor to change
between half and full precision compositing, where the Auto option uses
half for the viewport compositor and the interactive render compositor,
while full is used for final renders.

The compositor context now need to implement the get_precision() method
to indicate its preferred precision. Intermediate results will be stored
using the context's precision, with a number of exceptions that can use
a different precision regardless of the context's precision. For
instance, summed area tables are always stored in full float results
even if the context specified half float. Conversely, jump flooding
tables are always stored in half integer results even if the context
specified full. The former requires full float while the latter has no
use for it.

Since shaders are created for a specific precision, we need two variants
of each compositor shader to account for the context's possible
precision. However, to avoid doubling the shader info count and reduce
boilerplate code and development time, an automated mechanism was
employed. A single shader info of whatever precision needs to be added,
then, at runtime, the shader info can be adjusted to change the
precision of the outputs. That shader variant is then cached in the
static cache manager for future processing-free shader retrieval.
Therefore, the shader manager was removed in favor of a cached shader
container in the static cache manager.

A number of utilities were added to make the creation of results as well as
the retrieval of shader with the target precision easier. Further, a
number of precision-specific shaders were removed in favor of more
generic ones that utilizes the aforementioned shader retrieval
mechanism.

Pull Request: https://projects.blender.org/blender/blender/pulls/113476
2023-11-08 08:32:00 +01:00
Gilberto Rodrigues 3fddfb48be Fix #114571: Retopology Overlay Face Color Regression
Fix #114571: Retopology Overlay Face Color Regression

Missed in dfd1b63cc7

Pull Request: https://projects.blender.org/blender/blender/pulls/114589
2023-11-07 21:43:01 +01:00
Miguel Pozo 7c68e9a94c Fix #114524: EEVEE-Next: Wrong normal map node result
The new draw manager stores the object scale as a regular flag.
Update `node_normal_map` to read it correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/114587
2023-11-07 18:58:31 +01:00