Commit Graph

57511 Commits

Author SHA1 Message Date
Lukas Tönne
755734c12f Second variant of the copy-to-select operator for particles to only
copy the active particle system (and not remove existing in the process).
2015-01-20 09:30:11 +01:00
Lukas Tönne
6d65107656 Make removal of existing particle systems on copying optional.
This will be most useful when copying individual particle systems
one-by-one (to be implemented).
2015-01-20 09:30:11 +01:00
Lukas Tönne
04226e324e Added space selection option to the particle system copy operator.
By default this now copies from one object's local space to another
object's local space (instead of the previous world space). This is
more useful when transferring particles between objects, because it
doesn't require moving objects on top of each other, as long as they
have similar shapes.
2015-01-20 09:30:11 +01:00
Lukas Tönne
53135f91d2 Removed debugging code. 2015-01-20 09:30:11 +01:00
Lukas Tönne
0666de06f3 Fix for particle system copy: This has to make sure the ORIGSPACE data
layer is available.

Otherwise particle mapping to the new mesh cannot work with subdivided
and constructively-modified meshes.
2015-01-20 09:30:11 +01:00
Lukas Tönne
2a41d8ebdc Added a "specials" menu button next to the particle systems list for
accessing the copy operator.
2015-01-20 09:30:11 +01:00
Lukas Tönne
2a3279bb87 Changed the workflow for the particle system copy operator to the common
active-to-selected pattern.
2015-01-20 09:30:11 +01:00
Lukas Tönne
91b70d3c56 New operator for copying (hair) particle systems from one object to
another, including edit data (grooming).

This uses basically the same method as the existing connect/disconnect
feature. The main difference is that it allows working with multiple
objects and transferring the //particle/hair data// instead of the
//mesh// data (which is what connect/disconnect expects). This is a much
more realistic workflow when rigging, topology etc. changes and
groomed hair has to be transferred to the changed model.
2015-01-20 09:30:11 +01:00
Lukas Tönne
8f9f55498e Removed unused particles pointer from particle edit data. 2015-01-20 09:30:11 +01:00
Lukas Tönne
2fe96f3f88 New texture influence option for particle kink amplitude (as opposed to
frequency).
2015-01-20 09:30:11 +01:00
Lukas Tönne
9698182227 Renaming "Kink" texture influence to "Kink Frequency" to be more
specific.
2015-01-20 09:30:11 +01:00
Lukas Tönne
68608c5428 Spiral rotation axis was not always fully normalized, avoid an assert. 2015-01-20 09:30:11 +01:00
Lukas Tönne
dcfa75bc89 Make random child length work again with the spiral kink mode. 2015-01-20 09:30:11 +01:00
Sergey Sharybin
c2a7f26cbc Add missing stub to the player, so buildbot keeps delivering gooseberry builds 2015-01-20 09:30:10 +01:00
Lukas Tönne
6c908790e7 Allow clumping and roughness in Spiral kink mode as well.
This requires interpolating the parent key properties, because no single
parent key can be mapped to each key on the children any more.
2015-01-20 09:30:10 +01:00
Lukas Tönne
90e46ae6c0 Optional randomization factors for the spiral radius and axis orientation. 2015-01-20 09:30:10 +01:00
Lukas Tönne
76c7d693d9 Support in Cycles for the extra spiral keys in hair paths. 2015-01-20 09:30:10 +01:00
Lukas Tönne
6edeb43c16 Nicer calculation of the kink axis and result of the spiraling for
negative radius.
2015-01-20 09:30:10 +01:00
Lukas Tönne
9f3a840df2 Removed unused old code. 2015-01-20 09:30:10 +01:00
Lukas Tönne
374188cdfe Disable the path length check for spiral kink mode.
This test is terribly expensive for some reason and not necessary for
for the spiral mode anyway.
2015-01-20 09:30:10 +01:00
Lukas Tönne
14af65b3ef Fix for calculation of the key velocity on the last child hair segment. 2015-01-20 09:30:10 +01:00
Lukas Tönne
307c4a4df9 Another crappy approach to spirals on hairs, crazy expensive though.
Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-01-20 09:30:10 +01:00
Lukas Tönne
9bf7633936 Spiral kink mode for particles.
This is BAD code, but the particle kinking does not make it easy to
write a non-local modifier that requires neighboring positions,
curvature, etc. The feature is needed for Gooseberry.
2015-01-20 09:30:10 +01:00
Lukas Tönne
c2306919b7 Optional clumping noise feature for simulating twisted hair strands.
This adds another level of clumping on child hairs. When enabled, child
hairs chose a secondary clumping target using a Voronoi pattern. This
adds visual detail on a smaller scale, which is useful particularly when
the number of parents is relatively small.

Natural fibres behave in a similar way when they become sticky and
intertwined. Hairs close to each other form a first twisted strand, then
combine into larger strands. Similar features can be found in ropes:
http://en.wikipedia.org/wiki/Hair_twists
http://en.wikipedia.org/wiki/Rope

Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-01-20 09:30:10 +01:00
Lukas Tönne
7f219137cf Disable scope updates in texture and image paint modes.
Scope update is very slow for high resolutions, and currently blocks
the UI thread(!). This is especially terrible in paint modes, where
each stroke causes a scope update and unacceptable freezing.

The scopes update method tries to avoid this somewhat by skipping if the
toolbar is disabled, but this doesn't help when painting where brush
tools etc. are frequently needed. It's also a bad-level poll, with the
core system accessing a UI element.

Eventually scope updates should become a low-priority background job,
as well as becoming threaded. Until then this polling provides a usable
workaround to the most outrageous cases.
2015-01-20 09:30:09 +01:00
Lukas Tönne
d1246969ed Curve-based control for "roughness" (noise displacement) of child hair. 2015-01-20 09:30:09 +01:00
Lukas Tönne
c86d55d5e7 Curve-based control for child path tapering.
This is an alternative method to the current fixed function with a
clump factor and "shape" parameter. This function is quite limited and
does not give the desired result in many cases (e.g. long, parallel
rasta strands are problematic). So rather than trying to add more
parameters there is now a fully user-defined optional curve for setting
the tapering shape.
2015-01-20 09:30:09 +01:00
Lukas Tönne
4c82367fd8 Moved kink, clump and roughness functions into the dedicated source file. 2015-01-20 09:30:09 +01:00
Lukas Tönne
4f1c0a181d Reorganizing hair child code a little bit to make it not totally insane.
This contains a few pieces of code for a future "modifier" system that
would allow more flexible combination of effects. Eventually a node
system is the way to go, but the current code makes that impossible.
2015-01-20 09:30:09 +01:00
Lukas Tönne
b292d783f2 Separate context freeing from task freeing in threaded particle updates
to prevent double-freeing/invalid mem access.

This can happen with the "virtual parents" feature, which generates both
parent and child paths. Each task free function also freed the shared
context, leading to double freeing.
2015-01-20 09:30:09 +01:00
Lukas Tönne
1727a165dd Properly register the mathutils.interpolate submodule. 2015-01-20 09:30:09 +01:00
Lukas Tönne
1b6f5ecbf4 Fix for invalid access to undefined hair data in edge-only cloth meshes.
Cloth data is used both for hair and actual cloth, which makes things
really difficult. The face number was used for distinguishing the two
types (no faces == hair mesh), but the extra hair data necessary for
hair sim is generated by particles and not available for edge-only cloth
meshes. This really needs to be sanitized ...

Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:09 +01:00
Lukas Tönne
bb76e96339 Presets for hair dynamics.
This is necessary because the hair dynamics settings are not part of the
ParticleSettings datablock, but part of the convoluted cloth modifier
inside the particle system struct. In the future this will be recoded
properly, but in the meantime presets provide a simple an unobtrusive
way to have reusable dynamics settings for hair.

Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
2015-01-20 09:30:09 +01:00
Lukas Tönne
db2ac79fc7 Radical simplification of the wind effect on hair, since the previous
approach does not work very well.

Using a cross section estimate still causes large oscillations due to
varying hair force based on angles. It also requires a sensible hair
thickness value (particle radius) which is difficult to control and
visualize at this point.

The new model is based purely on per-vertex forces, which seems to be
much more stable. It's also somewhat justified by the fact that each
hair vertex represents a certain mass.

Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:09 +01:00
Lukas Tönne
f0e8690526 Fix for wind force function call. 2015-01-20 09:30:09 +01:00
Lukas Tönne
5c7adf5be2 Improved force field effects on hair strands.
The previous calculation was modulated with the angle between the wind
direction and the segments, which leads to very oscillating behavior.

Now the formula includes an estimate for the geometric cross section
of a hair segment based on the incident angle and the hair thickness
(currently just the particle size). This gives a more stable behavior
and more realistic response to wind.

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:09 +01:00
Lukas Tönne
658fc3ddbc New python submodule mathutils.interpolate for various mesh interpolation and weighting methods.
This module will contain mirrored functions for calculating and applying
weights for points on a mesh. This includes barycentric and UV weighting
and possibly more advanced global weighting such as harmonic weights.

The naming should follow this scheme:
<type>_{2d,3d}_{calc,apply}

e.g.
poly_2d_calc
poly_2d_apply
uv_3d_calc
...

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D939
2015-01-20 09:30:09 +01:00
Lukas Tönne
3b938f3d7f Fix for missing library linking in blenderplayer. 2015-01-20 09:30:08 +01:00
Lukas Tönne
3f3c19e391 Another fix for particle instance child lookups, was not subtracting
parent amount.
2015-01-20 09:30:08 +01:00
Lukas Tönne
c3c19509b3 Fix for invalid particle pointer access in mixed particle/child loop. 2015-01-20 09:30:08 +01:00
Lukas Tönne
790b931956 Better update function for particle settings affecting nested cloth
modifier.
2015-01-20 09:30:08 +01:00
Lukas Tönne
60bf6c123f Fix for applying the bending randomness factor.
A stupid hack is needed here, changing the way the factor is applied to
angular bending springs. In cloth sim the bending factor of individual
springs is applied as a mix value between the bending stiffness and a
max value, but this max value isn't even used in hair sim so that
approach becomes useless.

Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:08 +01:00
Lukas Tönne
d031831a05 Randomness factor for hair bending stiffness.
This helps to create some variation in a hair system, which can
otherwise become very uniform and boring. It's yet another confusing
setting in a system that should have been nodified, but only option for
now (broken windows ...)

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:08 +01:00
Lukas Tönne
64a4d4ed25 Fix for particle instance initial frames.
These were not orthonormal and tended to flip with changing hair
direction, now use the particle hair matrix which is stable wrt. the
mesh surface.
2015-01-20 09:30:08 +01:00
Lukas Tönne
bd033721c2 Fix for particle instance modifier: use a stable parallel-transport
framing method instead of the Frenet frame.

The Frenet frame is very succeptible to sudden twists along straight
sections of a curve where the second derivative (curvature) becomes 0.
2015-01-20 09:30:08 +01:00
Lukas Tönne
674c98bd06 Nicer hashing functionality for sim debugging using a variadic macro
to support multiple hash identifiers.

Using explicit hashing functions for every sim debug call defeats the
purpose of having a quick feedback system. Now this can be done simply
by passing an arbitrary number of hash inputs (integers) at the end of
the function calls, which are then combined by a system of variadic
macros (based on the ELEM feature). Up to 8 identifiers are supported
currently, but more could be added easily if needed.

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:08 +01:00
Lukas Tönne
52384179f4 Some tweaking of value ranges for hair target density and removed
density factor (already included in grid velocity).

Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:08 +01:00
Lukas Tönne
2da21b30ae Inverted effect of target density was unstable, the divergence term
needs to be substracted instead.
2015-01-20 09:30:08 +01:00
Lukas Tönne
325990ff6e Use dedicated debug values in cloth settings instead of abusing unused
other values.

Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 09:30:08 +01:00
Lukas Tönne
faa112cd27 Fixed wrong stride values used for offsetting the index of Eigen values.
The Eigen solver for hair grids uses an extra margin of 1, which means
greater stride values.
2015-01-20 09:30:08 +01:00