Age | Commit message (Collapse) | Author |
|
This is a follow-up to rB43875e8dd1d76ee, removing some
processing of non-existent node previews in the shader and
texture nodes systems.
|
|
Some nodes didn't check the type of the link's socket for filtering.
Do this with a combination of manually calling the node tree's validate
links function and using the helper function for declarations.
Also clean up a few cases that added geometry sockets manually
when they can use the simpler helper function.
|
|
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.
A few special operators for creating a reroute or a group input node
are also added to the search.
Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.
A small "+" is displayed next to the cursor to give a hint about this.
Further improvements are possible after this first iteration:
- Support custom node trees.
- Better drawing of items in the search menu.
- Potential tweaks to filtering of items, depending on user feedback.
Thanks to Juanfran Matheu for developing an initial patch.
Differential Revision: https://developer.blender.org/D8286
|
|
|
|
This replaces lost functionality from the old GN Attribute Map Range node.
This also adds vector support to the shader version of the node.
Notes:
This breaks forward compatibility as this node now uses data storage.
Reviewed By: HooglyBoogly, brecht
Differential Revision: https://developer.blender.org/D12760
|
|
Also remove unnecessary function to set a node type's
label function that duplicated its definition, and make
another function static.
|
|
|
|
|
|
Recommits part of rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
|
|
Re commits rBf72cc47d8edf849af98e196f721022bacf86a5e7 but without the unity build
|
|
The `node_storage` functions to retrieve const and mutable structs
from a node are generated by a short macro that can be placed at the
top of each relevant file. I use this in D8286 to make code snippets
in the socket declarations much shorter, but I thought it would be
good to use it consistently everywhere else too.
The functions are also useful to avoid copy and paste errors,
like the one corrected in the cylinder node in this commit.
Differential Revision: https://developer.blender.org/D13491
|
|
This reverts to following commits:
* rB5cad004d716da02f511bd34983ac7da820308676
* rB97e3a2d935ba9b21b127eda7ca104d4bcf4e48bd
* rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
* rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
* rBf72cc47d8edf849af98e196f721022bacf86a5e7
* rB3f7014ecc9d523997062eadd62888af5fc70a2b6
* rB0578921063fbb081239439062215f2538a31af4b
* rBc20098e6ec6adee874a12e510aa4a56d89f92838
* rBd5efda72f501ad95679d7ac554086a1fb18c1ac0
The original move to c++ that the other commits depended upon had some issues
that should be fixed before committing it again. The issues were reported in
T93797, T93809 and T93798.
We should also find a better rule for not using c-style casts going forward,
although that wouldn't have been reason enough to revert the commits.
Introducing something like a `MEM_new<T>` and `MEM_delete<T>`
function might help with the the most common case of casting the return
type of `MEM_malloc`.
Going forward, I recommend first committing the changes that don't
require converting files to c++. Then convert the shading node files
in smaller chunks. Especially don't mix fairly low risk changes like
moving some simple nodes, with higher risk changes.
|
|
Error in d5efda72f501. Was changing an iteration that would free items
to an iterator that is not safe for use in such cases.
There still seem to be significant issues with the rendering, but that's
a separate issue to be fixed.
|
|
- Added space below non doc-string comments to make it clear
these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.
Ref T92709
|
|
No functional changes, tests passed and I double checked the nodes by hand.
|
|
|
|
|
|
This improves both code finding, for example "color ramp" now has its own file.
And now each node has its own namespace so function names can be simplified
similar to rBfab39440e94
This commit also makes all file names use snake case instead of camel case.
Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13482
|
|
This commit adds the shader socket type to the new socket builder api.
As a test, this commit also converts the Add Shader node to the new API
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13485
|
|
- Create a new `bf_nodes_shader` library
- Enable unity builds for `bf_nodes_shader`, gives abount a 2.7x speed up for compile times
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13484
|
|
Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5
This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly
- The namespace name is derived from the file name.
That makes it possible to write some tooling that checks the names later on.
The filename extension (cc) is added to the namespace name as well.
This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.
- In the register function of every node, I added a namespace alias namespace `file_ns = blender::nodes::node_shader_*_cc`;.
This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect.
The name `file_ns` stands for "file namespace" and also indicates that this namespace corresponds to the current file.
In the future some nodes will be split up to separate files and given their own namespace
This will allow function names to be simplified similar to rBfab39440e94
Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13480
|
|
This change follows up on recent c --> c++ conversions
|
|
Fixes compilation errors after rBd5efda72f501
Re sorted some includes.
|
|
This will be useful in the future to use the new socket builder API
Aditional changes:
- Declare variables where initialized
- Do not use relative includes
Differential Revision: https://developer.blender.org/D13465
|
|
|
|
This was overlooked, as it seems there's no way for these strings to be
translated currently. Generally it's not that clear whether `N_` or
`TIP_` should be used in this case, but `TIP_` seems more consistent.
To avoid the cost of the translation lookup when the UI text isn't
necessary, we could allow the disabled hint argument to be optional.
Differential Revision: https://developer.blender.org/D13141
|
|
This will allow using a function I've declared in a C++ header.
|
|
|
|
Previously, there was a fixed grain size for all multi-functions. That was
not sufficient because some functions could benefit a lot from smaller
grain sizes.
This refactors adds a new `MultiFunction::call_auto` method which has the
same effect as just calling `MultiFunction::call` but additionally figures
out how to execute the specific multi-function efficiently. It determines
a good grain size and decides whether the mask indices should be shifted
or not.
Most multi-function evaluations benefit from this, but medium sized work
loads (1000 - 50000 elements) benefit from it the most. Especially when
expensive multi-functions (e.g. noise) is involved. This is because for
smaller work loads, threading is rarely used and for larger work loads
threading worked fine before already.
With this patch, multi-functions can specify execution hints, that allow
the caller to execute it most efficiently. These execution hints still
have to be added to more functions.
Some performance measurements of a field evaluation involving noise and
math nodes, ordered by the number of elements being evaluated:
```
1,000,000: 133 ms -> 120 ms
100,000: 30 ms -> 18 ms
10,000: 20 ms -> 2.7 ms
1,000: 4 ms -> 0.5 ms
100: 0.5 ms -> 0.4 ms
```
|
|
Previously, the function names were stored in `std::string` and were often
created dynamically (especially when the function just output a constant).
This resulted in a lot of overhead.
Now the function name is just a `const char *` that should be statically
allocated. This is good enough for the majority of cases. If a multi-function
needs a more dynamic name, it can override the `MultiFunction::debug_name`
method.
In my test file with >400,000 simple math nodes, the execution time improves from
3s to 1s.
|
|
Previously, node types had a callback that creates internal links. Pretty
much all nodes used the same callback though. The exceptions are the
reroute node (which probably shouldn't be mutable anyway) and some
input/output nodes that are not mutable.
Removing the callback helps with D13246, because it makes it easier
to reason about which internal links are created and when they change.
In the future, the internal links should be part of the node declaration.
|
|
This cleans up part of the code that still set the flag manually. Also, this
change helps with D13246 because it makes it easier to tag the node
tree as changed when the availability of a socket changed.
|
|
Goals of this refactor:
* Simplify creating virtual arrays.
* Simplify passing virtual arrays around.
* Simplify converting between typed and generic virtual arrays.
* Reduce memory allocations.
As a quick reminder, a virtual arrays is a data structure that behaves like an
array (i.e. it can be accessed using an index). However, it may not actually
be stored as array internally. The two most important implementations
of virtual arrays are those that correspond to an actual plain array and those
that have the same value for every index. However, many more
implementations exist for various reasons (interfacing with legacy attributes,
unified iterator over all points in multiple splines, ...).
With this refactor the core types (`VArray`, `GVArray`, `VMutableArray` and
`GVMutableArray`) can be used like "normal values". They typically live
on the stack. Before, they were usually inside a `std::unique_ptr`. This makes
passing them around much easier. Creation of new virtual arrays is also
much simpler now due to some constructors. Memory allocations are
reduced by making use of small object optimization inside the core types.
Previously, `VArray` was a class with virtual methods that had to be overridden
to change the behavior of a the virtual array. Now,`VArray` has a fixed size
and has no virtual methods. Instead it contains a `VArrayImpl` that is
similar to the old `VArray`. `VArrayImpl` should rarely ever be used directly,
unless a new virtual array implementation is added.
To support the small object optimization for many `VArrayImpl` classes,
a new `blender::Any` type is added. It is similar to `std::any` with two
additional features. It has an adjustable inline buffer size and alignment.
The inline buffer size of `std::any` can't be relied on and is usually too
small for our use case here. Furthermore, `blender::Any` can store
additional user-defined type information without increasing the
stack size.
Differential Revision: https://developer.blender.org/D12986
|
|
This solves the issue in a more general that can also be used to solve
similar issues for other nodes in the future. Nodes can specify their
"main" socket in their declaration so that we don't have to rely on
heuristics.
Differential Revision: https://developer.blender.org/D13108
|
|
We run into float precision issues here, clamp the number of octaves to
one less, which has little to no visual difference. This was empirically
determined to work up to 16 before, but with additional inputs like
roughness only 15 appears to work.
Also adds misisng clamp for the geometry nodes implementation.
|
|
As part of the refactor to the node declaration builders, we had hoped
to add a regular expression specifically for these socket names, but
recent discussions have revealed that using the translation marker
macros is the preferred solution.
If the names and descriptions were exposed to RNA, these would not
be necessary. However, that may be quite complicated, since sockets
are all instances of the same RNA types.
Differential Revision: https://developer.blender.org/D13033
|
|
Port brick shader node to GN
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12783
|
|
This patch improves performance by only assigning
or calculating data for connected sockets.
It is recommended that artists use the lowest dimensions setting
for noise based textures. E.g. Use 2D instead of 3D where possible.
Using a scoped timer and single thread on 256,000 points.
Smooth F1 3D : Debug build
Timer 'Optimised' took 9.39991 s
Timer 'Normal' took 16.1531 s
This optimisation is only for GN and not shaders.
Differential Revision: https://developer.blender.org/D12985
|
|
Port checker shader to GN
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12762
|
|
|
|
Port shader wave texture node
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12733
|
|
Port shader node magic texture
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12732
|
|
Port shader node musgrave texture
Differential Revision: https://developer.blender.org/D12701
|
|
Port shader Voronoi to GN
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12725
|
|
Reviewed By: HooglyBoogly, JacquesLucke
Differential Revision: https://developer.blender.org/D12717
|
|
Port White Noise shader to geometry nodes.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D12719
|
|
There is not enough time before the release to improve Random Walk to handle
all cases this was used for, so restore it for now.
Since there is no more path splitting in cycles-x, this can increase noise in
non-flat areas for the sample number of samples, though fewer rays will be traced
also. This is fundamentally a trade-off we made in the new design and why Random
Walk is a better fit. However the importance resampling we do now does help to
reduce noise.
Differential Revision: https://developer.blender.org/D12800
|
|
Move texture nodes to C++ and use new socket declaration
Brick, Checker, Image, Magic and Wave
Differential Revision: https://developer.blender.org/D12778
|
|
|
|
|