Using SDL's initialization logic, this is mainly a change for XDG
as LIBDECOR already required a configure event before accessing
the underlying XDG window.
While I didn't notice functional changes with this change window
flickering on startup remains an issue with some compositors
(KDE & river). Debugging these issues is simpler when both windowing
decoration systems work in a similar way & window configuration
is guaranteed to have run before the window is returned.
(via #xdg_surface_ack_configure).
since the color is applied both at entry and exit, using the square root
of the color would make the perceived color closer to the desired one.
This also makes the transition smoother when changing the `Transmission`
value in the UI, and matches the behaviour of EEVEE.
Now that there are different Fresnel types and the reflectance can be tinted,
it is better to sample based on the actually used Fresnel type, instead of
the original Fresnel. This also avoids computing Fresnel multiple times.
Pull Request: https://projects.blender.org/blender/blender/pulls/112158
This PR enabled device features that are required for EEVEE-Next.
Enabling these features would allow an initial screen drawn by
EEVEE-Next.
Note:
* Changes to EEVEE-Next after this commit, might require other changes
* Not all features are working, but a basic diffuse cube without shadows
is.
* Vulkan views are not correct and leads to incorrect lighting.
Pull Request: https://projects.blender.org/blender/blender/pulls/112519
Since 34b44878449d67a56fd2, attributes are always made mutable when
accessed from the RNA API. This can result in unnecessary copies, which
increases memory usage and reduces performance.
Cycles is the only user of the C++ RNA API, which we'd like to remove
in the future since it doesn't really make sense in the big picture.
Hydra is now a better alternative for external render engines.
To start that change and fix the unnecessary copies, this commit
moves to use Blender headers directly for accessing attribute and
other geometry data. This also removes the few places that still had
overhead from the RNA API after the changes ([0]) in 3.6. In a simple
test with a large grid, I observed a 1.76x performance improvement,
from 1.04 to 0.59 seconds to extract the mesh data to Cycles.
[0]: https://wiki.blender.org/wiki/Reference/Release_Notes/3.6/Cycles#Performance
Pull Request: https://projects.blender.org/blender/blender/pulls/112306
This was causing a warning when using OSL, since the OSL implementation
didn't implement the input.
Since the socket isn't really implemented on the Blender side anyways,
just get rid of it.
Also, the SVM code uses the shading normal while OSL used the geometric normal.
The SVM logic was changed a while ago to not adjust normals for curves,
but this wasn't applied to OSL as well, causing differences in SVM/OSL renders.
This has two main advantages: First, it allows to get rid of the extra closure
since the remaining float can just be moved to the main closure allocation.
Second, previously sd->N was completely unused and therefore unintialized,
which ended up causing issues for the Normal render pass.
The check for control characters didn't account for delete (127).
This wasn't noticeable in most cases as delete is mapped to delete text.
Pressing Shift-Delete would enter 127 control character in the
text-editor, 3D text & Python console. This happened X11 & Wayland,
I didn't check other platforms.
When evaluating emission, no closures can be allocated, so the existing code
would end up returning albedo 1.0, which then caused the layering code to set
the weight of lower layers to zero.
SVM doesn't do this, neither does the OSL testrender from what I can tell, and
in other cases we already handle the inversion on the OSL side if needed.
This patch updates the experimental MetalRT code path to use new [curve primitives](https://developer.apple.com/videos/play/wwdc2023/10128/) which were recently added in macOS 14. This replaces the previous custom box intersection implementation, allowing the driver to better optimise curve acceleration structures for the GPU. On existing hardware, this can speed up MetalRT renders by up to 40% for scenes that use hair / curve primitives extensively.
The MetalRT option will only be available on macOS >= 14, and requires Xcode >= 15 to build (otherwise the option will be compiled out).
Authored by Marco Giordano, Michael Jones, and Jason Fielder
---
Before / after render times (M1 Max MacBook Pro, macOS 14 beta, MetalRT enabled):
```
Custom box intersection MetalRT curve primitives Speedup
fishy_cat 111.5 80.5 1.39
koro 114.4 86.7 1.32
sinosauropteryx 291.8 279.2 1.05
spring 142.3 142.2 1.00
victor 442.7 347.7 1.27
```
---
Pull Request: https://projects.blender.org/blender/blender/pulls/111795
- Changes defaults from Emission Color 0.0, Emission Strength 1.0 to be the
other way around (Color 1.0, Strength 0.0), suggested by @brecht
- Makes emission component occluded by sheen and coat
(to simulate e.g. dust-covered light sources)
- Moves transparency into the Principled SVM/OSL node, to allow for future
support for e.g. transparent shadows in thin sheet mode.
Note that there are optimization opportunities here (mostly skipping the
non-transparent components for transparent shadow evaluation, and skipping
the parts that don't affect emission for light evaluation), but I have a
separate point for those in the Principled V2 planning since there's some
other optimization topics as well.
Co-authored-by: Weizhen Huang <weizhen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/111155
Previously, the Principled BSDF used the Subsurface input to scale the radius.
When it was zero, it used a diffuse closure, otherwise a subsurface closure.
This sort of scaling input makes sense, but it should be specified in distance
units, rather than a 0..1 factor, so this commit changes the unit and renames
the input to Subsurface Scale.
Additionally, it adds support for mixing diffuse and subsurface components.
This is part of e.g. the OpenPBR spec, and the logic behind it is to support
modeling e.g. dirt or paint on top of skin. Before, materials would be either
fully diffuse (radius=0) or fully subsurface.
For typical materials, this mixing factor will be either zero or one
(just like metallic or transmission), but supporting fractional inputs makes
sense for e.g. smooth transitions at boundaries.
Another change is that there is no separate Subsurface Color anymore - before,
this was mixed with the Base Color using the Subsurface input as the factor,
but this was not really useful since that input was generally very small.
And finally, the handling of how the path enters the material for random walk
subsurface scattering is changed. Before, this always used lambertian (diffuse)
transmission, but this caused some problems, like overly white edges.
Instead, two different methods are now used, depending on the selected mode.
In Fixed Radius mode, the code assumes a simple medium boundary, and performs
refraction into the material using the main Roughness and IOR inputs.
Meanwhile, when not using Fixed Radius, the code assumes a more complex
boundary (as typically found on organic materials, e.g. skin), so the entry
bounce has a 50/50 chance of being either diffuse transmission or refraction
using the separate Subsurface IOR input and a fixed roughness of 1.
Credit for this method goes to Christophe Hery.
Pull Request: https://projects.blender.org/blender/blender/pulls/110989
- 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
Ghost uses vulkan in its public headers but none of the projects that
depend on ghost had the vulkan headers in its includes nor did
bf_intern_ghost expose this vulkan dependency itself publicly yet.
bf_windowmanager also did not express its dependency on
bf_intern_ghost yet used its headers.
this change fixes both issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/112259
Shader draw parameter support is needed for Workbench-next. (Almost) All
devices that we support also supports shader draw parameters. This PR
doesn't include a workaround for devices that don't have support.
For end-users this PR will allow workbench-next to render the object on
the correct location. Before this patch they were always drawn on the origin.
The catch is that OpenGL uses gl_InstanceID which always starts counting at 0.
Vulkan has gl_InstanceIndex which holds the correct instance number. By
subtracting the gl_InstanceIndex from gl_BaseInstance will get the correct
gl_InstanceID.
This patch also activates some device extensions to perform in shader printf
statements inside a shader. Documentation for this will be added to the dev
docs how to use them.
Pull Request: https://projects.blender.org/blender/blender/pulls/111461
was mixing real geometry normal, smoothed geometry normal and
bump-mapped normal.
Use `(sd->type & PRIMITIVE_CURVE) ? sc->N : sd->Ng` consistently instead.
We already have two other functions doing very much the same thing.
`bsdf_microfacet_sample()` seems to be the only place where this
function was used; there we always sample visible normals, so the extra
`inside` check is not needed.
1. move early-out logic even earlier
2. reduced the scope of some variables
3. return `label` at the end of `bsdf_microfacet_sample()`. Return
`LABEL_NONE` in the invalid case. The previous distinction was
unnecessary because samples with zero contribution are assigned with
`LABEL_NONE` in `integrate_surface_bsdf_bssrdf_bounce()` anyway.
the motivation was to give closures with low weight a higher pdf to pick
at the first bounce, in case the next interaction has high contribution.
However, there are several issues:
1. this is too much fine-tuned for a specific case, and only works well
when there is a strong contribution after reflection and very little
contribution after the transmission;
2. the logic in `bsdf_microfacet.h` was added when merging reflection
and refraction into a glass closure, since then it doesn't even work
well in the above case when mixed with other closures;
3. The behavior is inconsistent in `bsdf_microfacet_eval()` and
`bsdf_microfacet_sample()`;
4. such cases should be handled by more modern and more general methods
such as path guiding and denoiser;
5. it makes the code flow harder to follow
Delete this trick for now to pick the closures solely based on their
`sample_weight`. Can be added back (with proper fix in
`bsdf_microfacet`) if indeed necessary.
Recent versions of DPC++ dropped using the environment variable
SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_IN_ORDER_QUEUE=0 we were setting.
We're now also setting SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE=0 by default
to keep a consistent behavior.
The API for the kernels library is defined, there is no need to
export more than that. This change only affects linux since hidden
visiblity is the default on Windows.
The recursive building has an early output, which could leave the node
without the requested child initialized, causing the access to the left
child to crash later on in the builder function.
Simply add an extra is-canceled check to avoid access of possibly
non-initialized tree structure.
Pull Request: https://projects.blender.org/blender/blender/pulls/112132
by doing the subtraction first and then take the dot product. This
offers higher precision than taking the dot product first and then
subtract the result, especially in the cases where the ray origin is
very far away from the sphere center.