6 years agoDocs: touch ups in the bge.render doc introduction
Dalai Felinto [Thu, 22 Jan 2015 05:20:39 +0000 (03:20 -0200)]
Docs: touch ups in the bge.render doc introduction

6 years agobge.render.getStereoEye() and bge.types.LEFT_EYE/RIGHT_EYE
Dalai Felinto [Thu, 22 Jan 2015 04:42:40 +0000 (02:42 -0200)]
bge.render.getStereoEye() and bge.types.LEFT_EYE/RIGHT_EYE

This function allows the user to run specific code for each of the
rendered stereoscopic eyes in the Game Engine.

The initial use case is to set the camera projection matrix in
a scene.pre_draw callback function for each eye, to be used in VR
(Virtual Reality) installations.

Reviewed by Mitchell Stokes and Campbell Barton, thank you guys.

Sample Test Python Script:
import bge
import bgl
import blf

def init():
    """init function - runs once"""
    scene = bge.logic.getCurrentScene()

def write():
    """write on screen - depending on the eye"""
    width = bge.render.getWindowWidth()
    height = bge.render.getWindowHeight()

    # OpenGL setup
    bgl.gluOrtho2D(0, width, 0, height)

    eye = bge.render.getStereoEye()

    if eye == bge.render.LEFT_EYE:
        blf.position(0, (width * 0.2), (height * 0.3), 0)
        blf.size(0, 40, 72)
        blf.draw(0, "Left")

    else: # bge.render.RIGHT_EYE:
        blf.position(0, (width * 0.7), (height * 0.3), 0)
        blf.size(0, 40, 72)
        blf.draw(0, "Right")

6 years agoerror in last commit (missed in review)
Campbell Barton [Wed, 21 Jan 2015 23:56:52 +0000 (10:56 +1100)]
error in last commit (missed in review)

6 years agoOutliner: use enum for outliner_data_operation()
Campbell Barton [Wed, 21 Jan 2015 23:47:53 +0000 (10:47 +1100)]
Outliner: use enum for outliner_data_operation()

No functional change, D997 by @lichtwerk

6 years agoCycles: Support tube projection for images
Sergey Sharybin [Wed, 21 Jan 2015 19:37:09 +0000 (00:37 +0500)]
Cycles: Support tube projection for images

This way Cycles finally becomes feature-full on image projections
compared to Blender Internal and Gooseberry Project Team could
finally finish the movie.

6 years agoCycles: Support sphere mapping for the image texture
Sergey Sharybin [Wed, 21 Jan 2015 17:44:30 +0000 (22:44 +0500)]
Cycles: Support sphere mapping for the image texture

6 years agoCycles: Optimization for black world backgrounds
Thomas Dinges [Wed, 21 Jan 2015 19:06:53 +0000 (20:06 +0100)]
Cycles: Optimization for black world backgrounds

* If a Background node is set to a black color or zero strength,
it now gets removed from the shader graph.

* In case the graph is empty (no background node), the kernel will skip
evaluating it and save some rendertime. This can help quite a bit in scenes,
where the majority of the image consists of a black background.

In this case the render is ~16% faster.

Differential Revision:

6 years agoCleanup of BGE code CcdPhysicsEnvironment::CallbackTriggers()
Sybren A. Stüvel [Wed, 21 Jan 2015 17:42:24 +0000 (18:42 +0100)]
Cleanup of BGE code CcdPhysicsEnvironment::CallbackTriggers()

Refactored some code to be easier to read. Semantically the code is

  - Some conditions were negated to be able to return/continue early,
    rather than having the majority of the code inside an if-body.
  - Conditions were simplified (!(a == b)) turned into (a != b);
    repeated conditions calculated only once.
  - Unnecessary variables and one unnecessary condition were

Reviewers: campbellbarton, lordloki

Reviewed By: lordloki

Projects: #game_physics

Differential Revision:

6 years agoCMake/MSVC: Quotes around the path
Campbell Barton [Wed, 21 Jan 2015 14:52:17 +0000 (01:52 +1100)]
CMake/MSVC: Quotes around the path

D940 by @TeeTrizZz

6 years agoFix: Joining armatures loses drivers
Joshua Leung [Wed, 21 Jan 2015 13:08:29 +0000 (02:08 +1300)]
Fix: Joining armatures loses drivers

Currently, when joining two armatures, the drivers of the armatures being merged
in are lost. This commit introduces a new AnimData API function for merging
animation data into another AnimData block.

* For now, this only copies the drivers over. As a result, manual effort will
  still be needed to go through and fix the drivers.

  I am working on automating that process, but it's more important that the
  drivers don't have to be created from scratch for now (since this is needed
  for the Goosberry rigging work).

6 years agoAdded new debug flag which can be used to lazy-init the SimDebug drawing.
Lukas Tönne [Wed, 21 Jan 2015 13:00:59 +0000 (14:00 +0100)]
Added new debug flag which can be used to lazy-init the SimDebug drawing.

A development addon can be used now to enable the debug drawing, without
the need to add UI code for this in the release files.

The SimDebug feature should also get an overall build flag and use
function stubs unless enabled. That way any possibility of overhead in
releases is eliminated.

6 years agoFix limit check before accessing array in opennl
Martin Ettl [Wed, 21 Jan 2015 12:18:39 +0000 (17:18 +0500)]
Fix limit check before accessing array in opennl

Please note that opennl is already modified (for double precision)
so re-integration is not really easy. Also, we'll eventually switch
to Eigen.

For until that let's just solve the condition in our bundled opennl.

6 years agoFix T43158: pixels in the 3d-view was mis-aligned
Campbell Barton [Wed, 21 Jan 2015 12:01:50 +0000 (23:01 +1100)]
Fix T43158: pixels in the 3d-view was mis-aligned

Change the pixel offset for regions, it make oversampling blurry when drawing pixel aligned values.
See T41749

6 years agoRemoved generic debug1..4 values from the cloth data.
Lukas Tönne [Wed, 21 Jan 2015 09:07:11 +0000 (10:07 +0100)]
Removed generic debug1..4 values from the cloth data.

These were used as UI buttons during development. If such parameters are
needed again later they should instead be added in the (now global)
SimDebugData and made accessible with a dev addon or so.

6 years agoUI: support alt+wheel for expanded enums
Campbell Barton [Wed, 21 Jan 2015 05:27:21 +0000 (16:27 +1100)]
UI: support alt+wheel for expanded enums

6 years agoFix T43247: Don't open pulldown when a popup overlaps it
julianeisel [Wed, 21 Jan 2015 02:45:00 +0000 (03:45 +0100)]
Fix T43247: Don't open pulldown when a popup overlaps it

Auto-opening of pulldown menus didn't take overlapping popups into account.

6 years agoBKE_screen: add BKE_screen_find_area_xy
Campbell Barton [Wed, 21 Jan 2015 02:43:46 +0000 (13:43 +1100)]
BKE_screen: add BKE_screen_find_area_xy

Use from eyedropper & screen operators
also define SPACE_TYPE_ANY for readability.

6 years agoFix Python CTest's, ignore 'addons_contrib'
Campbell Barton [Wed, 21 Jan 2015 01:56:30 +0000 (12:56 +1100)]
Fix Python CTest's, ignore 'addons_contrib'

Too many contrib addons are in an unstable state making the test not so useful.

Thanks to Sergey initial patch: D1012, redid mostly - but outcome is the same.

6 years agoRemove 'addons_extern' was used before git move
Campbell Barton [Wed, 21 Jan 2015 01:56:03 +0000 (12:56 +1100)]
Remove 'addons_extern' was used before git move

6 years agoCleanup: style
Campbell Barton [Wed, 21 Jan 2015 00:57:11 +0000 (11:57 +1100)]
Cleanup: style

6 years agoUpdate icons after recent cleanup in svg file.
Bastien Montagne [Tue, 20 Jan 2015 20:49:57 +0000 (21:49 +0100)]
Update icons after recent cleanup in svg file.

Note differences in those five icons are invisible by eye, just for sake of consistency.

6 years agoCleanup SVG icon file, pass II.
Bastien Montagne [Tue, 20 Jan 2015 19:05:54 +0000 (20:05 +0100)]
Cleanup SVG icon file, pass II.

Name each icon group from its define in Blender.

Simplifies searching for a given icon (in one way or the other), and could also be
useful one day in some scripting.

Also, removed/fixed more empty and stray groups...

Finally, found that we have several svg icons not linked to any defines, and one define
with no icon (dyntopo), would be nice to sort this one way or the other too.

6 years agoCleanup SVG icons file: pass I.
Bastien Montagne [Tue, 20 Jan 2015 14:18:34 +0000 (15:18 +0100)]
Cleanup SVG icons file: pass I.

Made sure each icon has its own, 'private' group.
Removed empty groups, and some stray paths and rects (among other benefits,
'make icons' do not generate anymore that half o dozen of empty icons one had to remove
by hand before committing ;) ).

Note: double checked, only five generated icons differ (on binary level) from before,
with no actual visual diff.

6 years agoMade SimDebugData into a single global instance.
Lukas Tönne [Tue, 20 Jan 2015 17:29:31 +0000 (18:29 +0100)]
Made SimDebugData into a single global instance.

This way it doesn't have to be stored as DNA runtime pointers or passed
down as a function argument. Currently there is now no property or
button to enable debugging, this will be added again later.

6 years agoOutliner: "Show Active" - if active is a child, open tree to show child
julianeisel [Tue, 20 Jan 2015 16:32:54 +0000 (17:32 +0100)]
Outliner: "Show Active" - if active is a child, open tree to show child

Previously, if the active object was a child, "Show Active" only showed the
parent object. Now it also opens the tree to take children into account.

Patch D974 by @lichtwerk with some minor edits, reviewed by me.

6 years agoFix for BI rendering of hair spirals: Was not taking the extra points
Lukas Tönne [Tue, 20 Jan 2015 15:38:03 +0000 (16:38 +0100)]
Fix for BI rendering of hair spirals: Was not taking the extra points
into account.

6 years agoDe-duplicate large block of shared code for GL vert attribs
Nicholas Bishop [Tue, 20 Jan 2015 13:17:08 +0000 (14:17 +0100)]
De-duplicate large block of shared code for GL vert attribs

Code in ccgdm_draw_attrib_vertex() was entirely the same as the top
portion of the code in cddm_draw_attrib_vertex(). Moved this code to a
new function, DM_draw_attrib_vertex().

ccgdm_draw_attrib_vertex() was removed in favor of calling
DM_draw_attrib_vertex(). cddm_draw_attrib_vertex() still does a couple
extra things, so it still exists but calls DM_draw_attrib_vertex().

In the interest of easy code review, no changes made to the code in
DM_draw_attrib_vertex() other than the new name and an added comment.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision:

6 years agoFix UI glitch: Ctrl/Shift didnt refresh the UI
Campbell Barton [Tue, 20 Jan 2015 12:02:15 +0000 (23:02 +1100)]
Fix UI glitch: Ctrl/Shift didnt refresh the UI

6 years agoFix transform glitch: Ctrl/Shift didn't refresh
Campbell Barton [Tue, 20 Jan 2015 12:14:06 +0000 (23:14 +1100)]
Fix transform glitch: Ctrl/Shift didn't refresh

6 years agoCleanup: use const
Campbell Barton [Tue, 20 Jan 2015 11:41:30 +0000 (22:41 +1100)]
Cleanup: use const

6 years agoFix for crash when using virtual parent hairs and clumping.
Lukas Tönne [Tue, 20 Jan 2015 10:42:33 +0000 (11:42 +0100)]
Fix for crash when using virtual parent hairs and clumping.

The paths for parents and children are generated using the same function
with a rather obscure test to distinguish them. Modifiers (clump, kink,
roughness) should not be applied to parents though.

6 years agoCleanup: warnings
Campbell Barton [Tue, 20 Jan 2015 10:06:21 +0000 (21:06 +1100)]
Cleanup: warnings

6 years agoCode cleanup: Unused variable in RNA callback
Sergey Sharybin [Tue, 20 Jan 2015 10:05:39 +0000 (15:05 +0500)]
Code cleanup: Unused variable in RNA callback

6 years agoFix T42844: Compositor scale offset
Sergey Sharybin [Tue, 20 Jan 2015 09:46:21 +0000 (14:46 +0500)]
Fix T42844: Compositor scale offset

Different interpolation methods in compositor could lead to 0.5 pixel offset in
final renders. This is because of some inconsistency in integer coordinates
which might mean pixel corner or pixel center.

Should be all fine now.

6 years agoFixed missing import in particles UI script.
Lukas Tönne [Tue, 20 Jan 2015 09:36:05 +0000 (10:36 +0100)]
Fixed missing import in particles UI script.

6 years agoFix error in freestyle api
Campbell Barton [Tue, 20 Jan 2015 08:53:29 +0000 (19:53 +1100)]
Fix error in freestyle api

6 years agoFixed merge errors.
Lukas Tönne [Tue, 20 Jan 2015 08:38:39 +0000 (09:38 +0100)]
Fixed merge errors.

6 years agoFix for incorrect DNA field name in versioning, causes constant
Lukas Tönne [Mon, 19 Jan 2015 14:09:44 +0000 (15:09 +0100)]
Fix for incorrect DNA field name in versioning, causes constant
resetting of clump noise size on reload.


6 years agoUse separate flags to enable/disable clump and roughness curves for
Lukas Tönne [Mon, 19 Jan 2015 12:32:53 +0000 (13:32 +0100)]
Use separate flags to enable/disable clump and roughness curves for
child hairs.

This allows disabling the curves temporarily without losing the setup.


6 years agoFix for slow deformation-motionblur in Cycles using the new spiral kink
Lukas Tönne [Fri, 16 Jan 2015 15:04:10 +0000 (16:04 +0100)]
Fix for slow deformation-motionblur in Cycles using the new spiral kink

This was caused by variation of the number of keys on child hairs due
to shortening of hair curves based on euclidian distances. The other
kink modes also shorten hairs, but use the parametric distance instead,
which does not vary with deformation of hairs.

6 years agoSecond variant of the copy-to-select operator for particles to only
Lukas Tönne [Fri, 16 Jan 2015 10:42:13 +0000 (11:42 +0100)]
Second variant of the copy-to-select operator for particles to only
copy the active particle system (and not remove existing in the process).

6 years agoMake removal of existing particle systems on copying optional.
Lukas Tönne [Fri, 16 Jan 2015 10:07:00 +0000 (11:07 +0100)]
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).

6 years agoAdded space selection option to the particle system copy operator.
Lukas Tönne [Thu, 15 Jan 2015 19:36:51 +0000 (20:36 +0100)]
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.

6 years agoRemoved debugging code.
Lukas Tönne [Thu, 15 Jan 2015 17:18:03 +0000 (18:18 +0100)]
Removed debugging code.

6 years agoFix for particle system copy: This has to make sure the ORIGSPACE data
Lukas Tönne [Thu, 15 Jan 2015 17:15:52 +0000 (18:15 +0100)]
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.

6 years agoAdded a "specials" menu button next to the particle systems list for
Lukas Tönne [Thu, 15 Jan 2015 11:53:28 +0000 (12:53 +0100)]
Added a "specials" menu button next to the particle systems list for
accessing the copy operator.

6 years agoChanged the workflow for the particle system copy operator to the common
Lukas Tönne [Thu, 15 Jan 2015 11:35:19 +0000 (12:35 +0100)]
Changed the workflow for the particle system copy operator to the common
active-to-selected pattern.

6 years agoNew operator for copying (hair) particle systems from one object to
Lukas Tönne [Thu, 15 Jan 2015 10:51:30 +0000 (11:51 +0100)]
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.

6 years agoRemoved unused particles pointer from particle edit data.
Lukas Tönne [Wed, 14 Jan 2015 15:06:24 +0000 (16:06 +0100)]
Removed unused particles pointer from particle edit data.

6 years agoNew texture influence option for particle kink amplitude (as opposed to
Lukas Tönne [Wed, 14 Jan 2015 11:29:19 +0000 (12:29 +0100)]
New texture influence option for particle kink amplitude (as opposed to

6 years agoRenaming "Kink" texture influence to "Kink Frequency" to be more
Lukas Tönne [Wed, 14 Jan 2015 11:03:55 +0000 (12:03 +0100)]
Renaming "Kink" texture influence to "Kink Frequency" to be more

6 years agoSpiral rotation axis was not always fully normalized, avoid an assert.
Lukas Tönne [Wed, 14 Jan 2015 10:48:51 +0000 (11:48 +0100)]
Spiral rotation axis was not always fully normalized, avoid an assert.

6 years agoMake random child length work again with the spiral kink mode.
Lukas Tönne [Wed, 14 Jan 2015 09:08:45 +0000 (10:08 +0100)]
Make random child length work again with the spiral kink mode.

6 years agoAdd missing stub to the player, so buildbot keeps delivering gooseberry builds
Sergey Sharybin [Wed, 14 Jan 2015 08:05:13 +0000 (13:05 +0500)]
Add missing stub to the player, so buildbot keeps delivering gooseberry builds

6 years agoAllow clumping and roughness in Spiral kink mode as well.
Lukas Tönne [Tue, 13 Jan 2015 19:58:28 +0000 (20:58 +0100)]
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.

6 years agoOptional randomization factors for the spiral radius and axis orientation.
Lukas Tönne [Tue, 13 Jan 2015 18:41:25 +0000 (19:41 +0100)]
Optional randomization factors for the spiral radius and axis orientation.

6 years agoSupport in Cycles for the extra spiral keys in hair paths.
Lukas Tönne [Tue, 13 Jan 2015 18:18:46 +0000 (19:18 +0100)]
Support in Cycles for the extra spiral keys in hair paths.

6 years agoNicer calculation of the kink axis and result of the spiraling for
Lukas Tönne [Tue, 13 Jan 2015 17:37:24 +0000 (18:37 +0100)]
Nicer calculation of the kink axis and result of the spiraling for
negative radius.

6 years agoRemoved unused old code.
Lukas Tönne [Tue, 13 Jan 2015 17:03:47 +0000 (18:03 +0100)]
Removed unused old code.

6 years agoDisable the path length check for spiral kink mode.
Lukas Tönne [Tue, 13 Jan 2015 16:59:41 +0000 (17:59 +0100)]
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.

6 years agoFix for calculation of the key velocity on the last child hair segment.
Lukas Tönne [Tue, 13 Jan 2015 16:28:53 +0000 (17:28 +0100)]
Fix for calculation of the key velocity on the last child hair segment.

6 years agoAnother crappy approach to spirals on hairs, crazy expensive though.
Lukas Tönne [Tue, 13 Jan 2015 16:24:20 +0000 (17:24 +0100)]
Another crappy approach to spirals on hairs, crazy expensive though.


6 years agoSpiral kink mode for particles.
Lukas Tönne [Mon, 12 Jan 2015 19:24:50 +0000 (20:24 +0100)]
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.

6 years agoOptional clumping noise feature for simulating twisted hair strands.
Lukas Tönne [Mon, 12 Jan 2015 15:03:12 +0000 (16:03 +0100)]
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:


6 years agoDisable scope updates in texture and image paint modes.
Lukas Tönne [Mon, 12 Jan 2015 13:21:23 +0000 (14:21 +0100)]
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.

6 years agoCurve-based control for "roughness" (noise displacement) of child hair.
Lukas Tönne [Fri, 9 Jan 2015 14:58:18 +0000 (15:58 +0100)]
Curve-based control for "roughness" (noise displacement) of child hair.

6 years agoCurve-based control for child path tapering.
Lukas Tönne [Fri, 9 Jan 2015 13:24:19 +0000 (14:24 +0100)]
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.

6 years agoMoved kink, clump and roughness functions into the dedicated source file.
Lukas Tönne [Fri, 9 Jan 2015 10:44:05 +0000 (11:44 +0100)]
Moved kink, clump and roughness functions into the dedicated source file.

6 years agoReorganizing hair child code a little bit to make it not totally insane.
Lukas Tönne [Fri, 9 Jan 2015 10:31:00 +0000 (11:31 +0100)]
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.

6 years agoSeparate context freeing from task freeing in threaded particle updates
Lukas Tönne [Thu, 8 Jan 2015 11:40:27 +0000 (12:40 +0100)]
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.

6 years agoProperly register the `mathutils.interpolate` submodule.
Lukas Tönne [Wed, 31 Dec 2014 08:58:47 +0000 (09:58 +0100)]
Properly register the `mathutils.interpolate` submodule.

6 years agoFix for invalid access to undefined hair data in edge-only cloth meshes.
Lukas Tönne [Mon, 22 Dec 2014 10:54:24 +0000 (11:54 +0100)]
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 ...


6 years agoPresets for hair dynamics.
Lukas Tönne [Fri, 19 Dec 2014 13:56:02 +0000 (14:56 +0100)]
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.


6 years agoRadical simplification of the wind effect on hair, since the previous
Lukas Tönne [Thu, 18 Dec 2014 12:52:31 +0000 (13:52 +0100)]
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.


6 years agoFix for wind force function call.
Lukas Tönne [Mon, 19 Jan 2015 19:20:03 +0000 (20:20 +0100)]
Fix for wind force function call.

6 years agoImproved force field effects on hair strands.
Lukas Tönne [Tue, 16 Dec 2014 18:40:29 +0000 (19:40 +0100)]
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.


6 years agoNew python submodule `mathutils.interpolate` for various mesh interpolation and weigh...
Lukas Tönne [Mon, 15 Dec 2014 18:45:01 +0000 (19:45 +0100)]
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:


Reviewers: campbellbarton

Differential Revision:

6 years agoFix for missing library linking in blenderplayer.
Lukas Tönne [Mon, 1 Dec 2014 17:15:53 +0000 (18:15 +0100)]
Fix for missing library linking in blenderplayer.

6 years agoAnother fix for particle instance child lookups, was not subtracting
Lukas Tönne [Fri, 21 Nov 2014 15:00:24 +0000 (16:00 +0100)]
Another fix for particle instance child lookups, was not subtracting
parent amount.

6 years agoFix for invalid particle pointer access in mixed particle/child loop.
Lukas Tönne [Thu, 20 Nov 2014 16:15:16 +0000 (17:15 +0100)]
Fix for invalid particle pointer access in mixed particle/child loop.

6 years agoBetter update function for particle settings affecting nested cloth
Lukas Tönne [Tue, 18 Nov 2014 09:37:34 +0000 (10:37 +0100)]
Better update function for particle settings affecting nested cloth

6 years agoFix for applying the bending randomness factor.
Lukas Tönne [Tue, 18 Nov 2014 09:30:11 +0000 (10:30 +0100)]
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.


6 years agoRandomness factor for hair bending stiffness.
Lukas Tönne [Mon, 17 Nov 2014 18:44:42 +0000 (19:44 +0100)]
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 ...)


6 years agoFix for particle instance initial frames.
Lukas Tönne [Mon, 17 Nov 2014 16:45:21 +0000 (17:45 +0100)]
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.

6 years agoFix for particle instance modifier: use a stable parallel-transport
Lukas Tönne [Mon, 17 Nov 2014 13:16:35 +0000 (14:16 +0100)]
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.

6 years agoNicer hashing functionality for sim debugging using a variadic macro
Lukas Tönne [Sun, 16 Nov 2014 13:59:33 +0000 (14:59 +0100)]
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.


6 years agoSome tweaking of value ranges for hair target density and removed
Lukas Tönne [Sat, 15 Nov 2014 11:40:34 +0000 (12:40 +0100)]
Some tweaking of value ranges for hair target density and removed
density factor (already included in grid velocity).


6 years agoInverted effect of target density was unstable, the divergence term
Lukas Tönne [Fri, 14 Nov 2014 16:11:33 +0000 (17:11 +0100)]
Inverted effect of target density was unstable, the divergence term
needs to be substracted instead.

6 years agoUse dedicated debug values in cloth settings instead of abusing unused
Lukas Tönne [Fri, 14 Nov 2014 15:48:01 +0000 (16:48 +0100)]
Use dedicated debug values in cloth settings instead of abusing unused
other values.


6 years agoFixed wrong stride values used for offsetting the index of Eigen values.
Lukas Tönne [Fri, 14 Nov 2014 14:51:23 +0000 (15:51 +0100)]
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.

6 years agoHair grid code was using an invalid hair segment at each hair end with
Lukas Tönne [Fri, 14 Nov 2014 13:55:56 +0000 (14:55 +0100)]
Hair grid code was using an invalid hair segment at each hair end with
zero vectors, leading to bad density values.


6 years agoA bunch of debug drawing changes.
Lukas Tönne [Fri, 14 Nov 2014 13:45:46 +0000 (14:45 +0100)]
A bunch of debug drawing changes.


6 years agoCorrected the divergence and gradient calculation for the hair grid
Lukas Tönne [Fri, 14 Nov 2014 13:41:55 +0000 (14:41 +0100)]
Corrected the divergence and gradient calculation for the hair grid
solver input and output.

This uses the central difference method (instead of combined forward/
backward difference), which makes it easier to correctly account for
grid borders.

6 years agoFallback method for defining density in the hair grid using discrete
Lukas Tönne [Fri, 14 Nov 2014 10:10:45 +0000 (11:10 +0100)]
Fallback method for defining density in the hair grid using discrete

This is just an intermediate method to make sure the density is valid.
Eventually the closest-point method should be used, but for testing
the poisson solver this is easier to debug.


6 years agoAdded a margin to the number of cells used in the poisson grid solver,
Lukas Tönne [Fri, 14 Nov 2014 09:42:09 +0000 (10:42 +0100)]
Added a margin to the number of cells used in the poisson grid solver,
to ensure we always have one layer of empty cells around the fluid.

6 years agoFix for merge errors and leftover unused code lines.
Lukas Tönne [Mon, 19 Jan 2015 19:01:37 +0000 (20:01 +0100)]
Fix for merge errors and leftover unused code lines.

6 years agoImplementation of a target density feature for the hair simulation.
Lukas Tönne [Thu, 13 Nov 2014 15:06:39 +0000 (16:06 +0100)]
Implementation of a target density feature for the hair simulation.

This allows setting a target density which the fluid simulation will
take into account as an additional term in the pressure Poisson
equation. Based on two papers
"Detail Preserving Continuum Simulation of Straight Hair" (McAdams et al. 2009)
"Two-way Coupled SPH and Particle Level Set Fluid Simulation" (Losasso et al. 2008)

Currently the target pressure is specified directly, but it will be
a lot more convenient to define this in terms of a geometric value such
as "number of hairs per area" (combined with hair "thickness").


6 years agoAnother fix for off-by-one hair grid resolution errors.
Lukas Tönne [Thu, 13 Nov 2014 15:05:17 +0000 (16:05 +0100)]
Another fix for off-by-one hair grid resolution errors.

6 years agoRewriting the grid rasterization function for hair segments.
Lukas Tönne [Thu, 13 Nov 2014 15:01:36 +0000 (16:01 +0100)]
Rewriting the grid rasterization function for hair segments.

6 years agoDraw actual hair keys when the "Guide Hair" setting is enabled.
Lukas Tönne [Thu, 13 Nov 2014 14:15:02 +0000 (15:15 +0100)]
Draw actual hair keys when the "Guide Hair" setting is enabled.

Without this certain debug tasks become very hard to visualize.