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
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
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
It was a missing case in the code which is responsible for in the code
which is responsible for filling in VBO data. It is now implemented for
vertex and corner attributes.
Co-Authored-By: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/113536
Pass the mesh to the drawing functions so it doesn't have to be
retrieved from the PBVH. It's nice to rely less on the PBVH `me`
pointer, since it's a fairly ugly "back pointer" which isn't necessarily
good design.
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
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
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
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
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
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
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
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
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
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
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
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
Instead of using a lambda with a FunctionRef argument, just write the
loops explicitly. This results in a bit more boilerplate code and a bit
more repetition, but the overall design and flow is much simpler. Based
on the results in f10965dcb8, it can improve performance too.
The assert was assuming that the attribute request is properly
initialized and that was not the case: the "special" data layers
like coordinates, normals, masks, and face sets did not initialize
domain in the attribute request.
The domain is now properly initialized. As well as there is an
assert added in other PBVH types for the face sets. It is possible
to add asserts in more places, but it is not directly related to
this CL.
Pull Request: https://projects.blender.org/blender/blender/pulls/113354
Two aspects to this change:
- Do not clear face sets when enabling dynamic topology
- Draw face sets in viewport when dynamic topology is enabled
Newly added faces in the dynamic topology will have face
sets properly assigned. It is only edge collapse which can
potentially lead to undesired results w.r.t face set boundaries.
That will be worked on further as follow up development.
Pull Request: https://projects.blender.org/blender/blender/pulls/113348
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
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
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
Previously the colors were just uploaded as white, the default value.
Even if they aren't interpolated properly, it is still helpful to see
the colors. At worst, the unaffected parts of the mesh will still look
right.
A previous commit made vertex colors interpolate properly, but
face corner colors will still reset to their default value.
As a reminder, only color and byte color attributes are currently
supported for the specialized PBVH drawing.
Pull Request: https://projects.blender.org/blender/blender/pulls/113333
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
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
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.
Enable tests for EEVEE Next.
As a workaround for allowing the use of EEVEE Next (still an
experimental feature) with `--factory-startup`, `arg_handle_engine_set`
enables the feature when `-E BLENDER_EEVEE_NEXT` is used.
In addition, EEVEE Next is always registered, so it's available when
calling `WM_init`.
If it's actually disabled, it will be immediately unregistered after that.
Notes:
- `get_gpu_device_type` always fails with error:
> GPU API is not available in background mode
- Setup and tests are the same as EEVEE. There are many tests that
only make sense for Cycles, and many EEVEE Next features that are
not actually tested.
Pull Request: https://projects.blender.org/blender/blender/pulls/112161
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
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
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
This patch implements the Keying Screen node for the Realtime
Compositor. Draw data was introduced to the Movie Clip ID to allow
caching of the keying screen.
Pull Request: https://projects.blender.org/blender/blender/pulls/113055
This add a way to use a software clip plane in the
prepass shader (surf_depth_frag.glsl).
The benefit of using this instead of gl_ClipDistance
is that the rasterization pattern is given to match.
Which means that only the prepass shader have to use
this.
This is slow and should only be enabled when needed.
Overlay engine is currently responsible to initialize the framebuffers
depth_in_front texture. This is a hack and hasn't been ported to
Overlay-Next (yet). This PR skips copying the depth_in_front texture
when it isn't initialized yet.
Issue detected when working on Vulkan backend due its more
strictness.
Pull Request: https://projects.blender.org/blender/blender/pulls/113188
Caused by fb556c75df
The ideal would be to increase the version file, but this would make
the versioning code a bit messy, and it was a recent error
(it shouldn't affect many users).
`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 use `DRW_drawdata_get`.
* 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/112544
Since garbage collection of texture pools happens every time
`drw_manager_init` is called, interleaved calls to different
`DRW_draw`/`DRW_render` functions can result in a constant cycle of
creating/releasing textures.
This PR changes texture pools to only release textures that have not
been used for N garbage collection cycles.
I chose 8 as default since I think is high enough to avoid the issue
while it's unlikely to cause any major spike in memory consumption.
Pull Request: https://projects.blender.org/blender/blender/pulls/113024
Shadow Map Ray Tracing is a technique that ray cast against the shadow
depth buffer. The technique is described in "Soft Shadows by
Ray Tracing Multilayer Transparent Shadow Maps".
Note that we only implement the single layer approach since storing
multiple depth is prohibitively expensive.
Pull Request: https://projects.blender.org/blender/blender/pulls/111809
The case when there were no material indices, multiple materials, and
the mesh used hiding wasn't handled after 55970fa367.
This is a simple parallel loop adding up the non-hidden triangles.
Hair and Curves need to call `DRW_curves_update` before
`geometry_steps_fill`, otherwise the copied geometry is just
uninitialized data.
However, doing so triggers an assertion:
> DRW_render_instance_buffer_finish had not been called before drawing.
This PR ports the `DRW_hair/curves_pos_buffer_get` functions to the new
`draw::Manager` API, so it can be called at any arbitrary point.
It also changes `VelocityModule::geometry_map` to use `uint64` keys
instead of `ID` pointers, since the same particle system can be used on
different objects and have multiple geometries.
Notes:
* The new functions are only used for
`VelocityModule::step_object_sync` on image renders. Using them
elsewhere would require modifying the old draw manager to do the
init/update/free setup.
* Only the compute shader version has been ported.
Pull Request: https://projects.blender.org/blender/blender/pulls/112425
Implement a clip distance to irradiance grids, so surfaces farther than
the threshold don't generate surfels.
Align the capture view matrix to the probe rotation.
Pull Request: https://projects.blender.org/blender/blender/pulls/112863
This makes the SSS processing more isolated to avoid
side effects in other passes.
Also this allow more optimization using LDS.
The radiance buffer is created by a setup phase using
direct and indirect lighting.
Splitting this into its own compute pass also fixes
a pass merging issue on Metal.
Pull Request: https://projects.blender.org/blender/blender/pulls/112901
This avoid confusion outside of the shader node GLSL code.
The issue also is that Metal allow float to cast to bool
implicitly but this create a compilation error on
OpenGL.
Scenes that only uses a world probe would didn't work. Raytracing
would look for the closest light probe, didn't find any and shader
would use undefined behavior to sample in the reflectionProbes texture.
In some cases this resulted in correct results when the world was
located on layer 0 with subdivision 0. In any other case this would
sample incorrect incoming light what lead to black reflections.
This PR fixes this by returning the world probe when no nearest light
probe cound be found.
Pull Request: https://projects.blender.org/blender/blender/pulls/112893
This adds a new entry to the split sum LUT to isolate
the effect of the F82 tint.
The application of the tint part is similar to cycles
and uses the same way for precomputing the `b` factor.
Results matches almost perfectly to the extent of the
split sum approximation.
Note that this removes the unused LTC MAG LUT for
EEVEE next to make space for the new table. It can still
be added back if needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/112881
Texture Atomics have been added in Metal 3.1
and enable the original implementations of
shadow update and irradiance cache baking.
However, a fallback solution will be
required for versions under macOS 14.0 utilising
buffer-backed textures instead.
This patch also includes a stub implementation if
building/running on older macOS versions which
provides locally-synchronized texture access in
place of atomics. This enables some effects to be
partially tested, and ensures non-guarded use
of imageAtomic functions does not result
in compilation failure.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/112866
This keeps the behavior similar to the Disney BRDF, where 0.5
is neutral and lower/higher values respectively decrease/increase
the dielectric specular. But it's more correct in that it's not
an arbitrary scale on Fresnel, but rather adjusting the IOR.
Ref #99447
Ref #112848
Pull Request: https://projects.blender.org/blender/blender/pulls/112552
Enable visual keying of bones that are influenced by an IK constraint.
This wasn't possible before, as the visual keying system only checked
constraints on the bone itself, and not whether the bone was part of an
IK chain.
This commit introduces a new `bPoseChannel::constflag` value
`PCHAN_INFLUENCED_BY_IK` that is set whenever the pose bone is part of
an IK chain.
The `pchan->constflag` field is computed during depsgraph evaluation. If
the depsgraph is active, it is now also written back to the original
pchan, so that it can be used in the "should visual keying be used"
function.
Fixes: #76791 "Different results when keyframing visual transforms and
applying transforms manually on IK constraint". Note that visually
keying does *not* copy the visual pose to the current pose. Furthermore,
when visually keying only part of the IK chain, the result of
re-evaluating the IK constraint (for example by moving the scene forward
and then backward by one frame) may still produce a different result, as
the IK chain now has a different start orientation.
Note that commit explicitly does not cover Spline IK constraints. They
can introduce heavy shear, especially with the default settings, which
cannot be represented by keys on loc/rot/scale.
For historical reference: 876cfc837e
introduces the 'use visual keying' preference option, where Blender
automatically chooses whether or not to use visual keying. This is why
there is a function at all that determines whether to use visual keying
or not.
Rename the `bPoseChannel::flag` `PCHAN_HAS_TARGET` to `PCHAN_HAS_NO_TARGET`
as that is actually the meaning of the flag (in the majority of the code).
Since the flag was so confusingly named, there were some mixups in the
armature overlay drawing code as well, which have been fixed now too.
The Pixelate effect has an antialiasing switch that cleans up
pixels mostly, but still has some inbetween artifacts that are
a little frustrating to deal with. This makes it so that pixels are
completely hard-edged when AA is disabled.
Pull Request: https://projects.blender.org/blender/blender/pulls/112605
Blender 4.0 requires OpenGL 4.3 which always support SSBO's.
Platforms that don't support enough SSBO bind points will be marked
as unsupported.
Users who start Blender on those platforms will be informed via a
dialog. This PR also updates the `--debug-gpu-force-workarounds`
to match our minimum requirements. Note that some bugs are still
there that should be solved in other PRs:
* Workbench only renders the object using a unit matrix this is because
there is a bug in the workaround for shader_draw_parameters
* Navigating with middle mouse button is not working. Unsure what the
cause is, but might be a missing feature check in the OpenGL backend.
Related to #112224
Pull Request: https://projects.blender.org/blender/blender/pulls/112572
This implement the diffuse tracing as simple
screen-space ray trace. This is extremely inefficient
and should only be used for reference purpose.
The real screen space diffuse implementation will
be done in another PR.
Depends on #112507
![image](/attachments/a2c0a9d9-3206-4dc7-acf8-0c37851ad10b)
Pull Request: https://projects.blender.org/blender/blender/pulls/112539
This allow to move the light evaluation up in the deferred pipeline and
avoid coupling two different steps into one. This add more flexibility
in the implementation of deferred lighting and indirect lighting
algorithms.
This splits the reflection probe evaluation to its own
shader since it is quite different now.
Pull Request: https://projects.blender.org/blender/blender/pulls/112507
This moves the pre-computation offline and store the pre-computed
table in the binary. The pre-computed tables are quite small and are
not a concern with respect to binary size increase.
This rewrites the precomputation to use manually fitted
approximations for both burley and random walk.
The approximations fix a discrepancy between cycles and EEVEE
SSS translucency look. The absolute maximum error is below 2%.
I believe better results could be achieved with automatic fitting
tools.
Note that Cycles Burley translucency profile has some issues as it
does not give a smooth profile. The profile is biased near the end
of the lower radii. For this reason, the fit was done on a white
diffuse with (1,1,1) radii which does not exhibit this artifact.
Note that while this adds the profile for random walk, it isn't
currently used because the profile type is not yet passed down
the deferred path.
The fitting data can be found attached to this PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/112512
This allow to move the light evaluation up in
the deferred pipeline and avoid coupling two
different steps into one. This add more
flexibility in the implementation of
deferred lighting and indirect lighting
algorithms.
This splits the reflection probe evaluation
to its own shader since it is quite different
now.
A float array use different alignment and reservation rules on
GPU versus CPU. Before this change the _pad1 was aligned to 16 bytes as
it was defined as an array, but on CPU this alignment doesn't
happen.
This is fixed by using 3 floats in stead of a float array for padding.
Pull Request: https://projects.blender.org/blender/blender/pulls/112565
This finalize the implementation of the screen space tracing
for EEVEE-Next.
Refractive objects can now have screen space reflection too
and self reflect.
This keeps the feedback radiance buffer principle of the
Classic EEVEE so that we still get infinite bounces by default.
There are some conflict with refraction tracing and ambient
occlusion nodes. Materials using screen space refraction will
not be able to detect occlusion from any refractive surface using
screen space refraction including itself.
They also won't be visible to screen space reflections from other
materials *not* using screen space refraction.
This should be added to the list of limitations for now.
Note that the current approach to feed the radiance is to copy
the radiance buffer. This has the nice property of only containing
the currently rendered objects and not project transparent objects
or other non-yet rendered object onto the depth behind them.
Pull Request: https://projects.blender.org/blender/blender/pulls/112341
because it contains reflectance and transmittance, so BSDF would be a
morep proper name.
Also rename BSDF to BRDF at places where only reflectance is returned.
the `refract()` function require the relative IOR of the media where V
is in to the media where L is in. Because this only affects the
visibility term, the difference is quite small
* Fix#112284 and other non-reported sculpt-related regressions in the
new Workbench.
* Cleanup ObjectState setup.
* Update `sculpt_batches_get` to support getting per material batches
while passing SculptBatchFeatures.
* Make material indices 0 based in Workbench.
Pull Request: https://projects.blender.org/blender/blender/pulls/112344
- Adds tint control, which simulates volumetric absorption inside the coating.
This results in angle-dependent saturation and affects all underlying layers
(diffuse, subsurface, metallic, transmission). It provides a physically-based
alternative to ad-hoc effects such as tinted specular highlights.
- Renames the component from "Clearcoat" to "Coat", since it's no longer
necessarily clear now. This matches naming in e.g. other renderers or OpenPBR.
- Adds an explicit Coat IOR input, in preparation for future smarter IOR logic
around the interaction between Coat and main IOR. This used to be hardcoded
to 1.5.
- Removes hardcoded 0.25 weight multiplier, and adds versioning code to update
existing files accordingly. OBJ import/export still applies the factor.
- Replaces the GTR1 microfacet component with regular GGX. This removes a corner
case in the Microfacet code, solves #53038, and makes us more consistent with
other standard surface shaders. The original Disney BSDF used GTR1, but it
doesn't appear that it caught on in the industry.
Co-authored-by: Weizhen Huang <weizhen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/110993
5cf7089e43 added the `BuiltinBits::LAYER` to shaders with a geometry
stage. This causes compilation errors when
`GLContext::layered_rendering_support` is false (otherwise the flag
does nothing).
This PR moves the `LAYER` flags to the `no_geom` shader versions and
adds a check to `ShaderCreateInfo::finalize()` to ensure the `LAYER` flag
is not used in shaders with a geometry stage.
Pull Request: https://projects.blender.org/blender/blender/pulls/112245
`overlay_edit_mesh_face` has an attribute for its vertex normals,
but only used in the vertex shader when it isn't a face shader.
Removing this attribute fixes some performance validation warnings
in the Vulkan backend.
Pull Request: https://projects.blender.org/blender/blender/pulls/112269
The `VIEWLAYER_PT_eevee_next_layer_passes_data` class name was
re-used by mistake for Workbench Next in ba982119cd,
and the actual EEVEE Next class was then removed in 678dc456e3.
This adds back the UI as it was, and the missing passes (Vector and
Position) it referenced.
Pull Request: https://projects.blender.org/blender/blender/pulls/112162
In image renders, after the first motion blur step,
non deformed geometry was being marked as deformed,
since all their geometry lengths are 0.
This caused velocity_local_pos_get to read wrong/unitialized values.
Merge all the small UBOs used by the engine to save binding slots.
Each module is still responsible for filling its own data (by storing a
reference to it at construction) and this data is still private for other
modules.
The engine instance pushes the data to the GPU at the end of
`end_sync`, so only the modules that modify their data outside of the
sync functions need to manually call `Instance::push_uniform_data()`.
Pull Request: https://projects.blender.org/blender/blender/pulls/112046
Add the features missing from #107176
* Irradiance integration.
* Self-shadows.
* Receive shadows from shadow maps.
Shadow tagging works by iterating all the froxels in a
compute shader and tagging the exact same position
that will be sampled by the volume scatter shader.
Froxels that are fully transmissive, have no scattering,
or are behind opaque geometry, are skipped.
It also adds a LoD bias parameter for shadow tagging,
driven by the volumetric tile size.
This works for punctual shadows, but directional lights
would need a way to support re-direction between levels
at sampling time, which is out of the scope of this PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/110809
Some shaders using gl_Layer/gpu_Layer were missing
the correct usage bit in the shader create info. Shaders
also need to inherit feature usage bits from included
additional_info.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/111751
Resource IDs and tile shfits often meant buffers were
accessed outside of their valid range. Patch ensures
resource IDs are unpacked and shift ranges are
shifted into the positive range to avoid inconsistent
behaviour with negative modulo operations.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/111808
This ports the LUT using compute shader.
All LUT are computed by the same compute shader
to avoid boiler plate code to add new LUTs.
As for the generation code itself it is mostly the
same except for the use of `hammersley_2d` instead of
regular grid sampling. Regular grid did not improve
anything and was a bit more cumbersome.
This also bumps the number of samples very high
for more precision.
The new utility class for computing the LUT has
methods to write the content to a PFM image file
or as C++ array header.
The hash tables and vector blenlib headers were pulling many more
headers than they actually need, including the C base math header,
our C string API header, and the StringRef header. All of this
potentially slows down compilation and polutes autocomplete
with unrelated information.
Also remove the `ListBase` constructor for `Vector`. It wasn't used
much, and making it easy to use `ListBase` isn't worth it for the
same reasons mentioned above.
It turns out a lot of files depended on indirect includes of
`BLI_string.h` and `BLI_listbase.h`, so those are fixed here.
Pull Request: https://projects.blender.org/blender/blender/pulls/111801
Fix render regions and make them work with overscan:
- Clarify and improve the naming used by the Film module.
- Convert Display texel coordinates to Film texel coordinates before
calling `film_process_data`, and convert from Film texel coordinates to
Render texel coordinates in `film_sample_get`.
- Returns the actual display extent (and not the film extent) in
`Film::display_extent_get` so the overscan camera matrix is computed
correctly when using render regions.
Regression caused by 567a2e5a6f.
Pull Request: https://projects.blender.org/blender/blender/pulls/111691
changes include:
* Use microfacet normal instead of macronormal. Previously Cycles used
macronormal for Glass BSDF and Transmission component in Principeld
BSDF, leading to artefacts at grazing angles. This has been corrected
in 5f9b518a8b and 89218b66c2. Now change EEVEE to match this behaviour.
* GGX distribution is now darker due to the shadowing-masking term,
while Multiscatter GGX preserves energy. This now matches Cycles too.
Pull Request: https://projects.blender.org/blender/blender/pulls/111687
Add three cached topology maps to `Mesh`, to avoid computations when
mesh data isn't changed. Choosing the right maps to cache is a bit
arbitrary, but generally we have to start somewhere. The limiting
factor is memory usage (all the new caches combined have a
comparable footprint to a UV map).
For now, the caches added are:
- Vertex to face corner
- Vertex to face
- Face corner to face
These caches are used in quite a few places already;
- Face corner normal calculation
- UV value merging
- Setting sharp edges from face angles
- Data transfer modifier
- Voxel remesh attribute remapping
- Sculpt mode painting
- Sculpt mode normal calculation
- Vertex paint mode
- Split edges geometry node
- Mesh topology geometry nodes
Caching topology maps means they don't have to be rebuilt every time
they're used. Meshes copied but without topology changes can share
the cache, further reducing re-computations. For example, FPS with a
large mesh using the "Corners of Vertex" node went from 1.8 to 2.3.
Entering sculpt mode is slightly faster too.
There is some obvious work for future commits:
- Use caches in attribute domain interpolation
- More multithreading of second phase of map building
- Update/build caches eagerly in some geometry nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/107816
The `EdgeHash` and `EdgeSet` data structures are designed specifically
as a hash of an order agnostic pair of integers. This specialization can
be achieved much more easily with the templated C++ data structures,
which gives improved performance, readability, and type safety.
This PR removes the older data structures and replaces their use with
`Map`, `Set`, or `VectorSet` depending on the situation. The changes
are mostly straightforward, but there are a few places where the old
API made the goals of the code confusing.
The last time these removed data structures were significantly changed,
they were already moving closer to the implementation of the newer
C++ data structures (aa63a87d37).
Pull Request: https://projects.blender.org/blender/blender/pulls/111391
* `RUNTIME_LUT_CREATION` is disabled by default, but if set to `true`,
the new `bxdf_lut_frag.glsl` should generate the LUT that is submitted
in this commit. This new LUT is very close to the previously stored one.
* Generate the LUT by Monte-Carlo sampling with \(I = 1/N\sum\frac{f}{p}\),
except that the samples are not random, but mapped from a regular grid,
following previous approach to avoid interpolation artefacts caused by
noise.
* Added comments to make the computed quantities and the LUT usage more
clear.
* Glass with `IOR < 1` is now slightly darker due to single-scattering.
The lost energy will be recovered in a future commit.
* The special cases of `IOR == 0`, `roughness == 0` and `roughness == 1`
are handled well during microfacet sampling and evaluation, no need to
clamp.
* When `IOR == 1`, in theory BRDF is zero and BTDF is one, but we do not
make it a special case to allow smooth transition.
Pull Request: https://projects.blender.org/blender/blender/pulls/111632
Move control over the color of bones from bone groups to the bones
themselves. Instead of using bone groups (which are defined on the pose,
and thus owned by the object), the color is stored on:
- the bone (`struct Bone`, or RNA `armature.bones['bone_name'].color`)
- a possible override on the pose bone (`struct bPoseChannel`, or RNA
`ob.pose.bones['bone_name'].color`).
When the pose bone is set to its default color, the color is determined
by the armature bone. In armature edit mode, the armature bone colors
are always used, as then the pose data is unavailable.
Versioning code converts bone group colors to bone colors. If the
Armature has a single user, the group color is stored on the bones
directly. If it has multiple users, the group colors will be stored on
the pose bones instead.
The bone group color is not removed from DNA for forward compatibility,
that is, to avoid immediate dataloss when saving a 3.6 file with 4.0.
This is part of the replacement of bone groups & armature layers with
bone collections. See the design task at #108941.
Pull request: https://projects.blender.org/blender/blender/pulls/109976