Commit Graph

724 Commits

Author SHA1 Message Date
Nicholas Bishop
0b16c9e201 Patch Bullet to make it's convex hull implementation usable in BMesh
* Add access to the original indices for vertices

* Add a very simple C API for convex hull

* Add this patch to the patches folder and update readme.txt
2012-10-23 23:54:02 +00:00
Campbell Barton
bc8f602601 style cleanup 2012-10-20 18:46:57 +00:00
Campbell Barton
536d9fec80 code cleanup:
- move object_iterators.c --> view3d_iterators. (ED_object.h had to include ED_view3d.h which isn't so nice)
- move projection functions from view3d_view.c --> view3d_project.c (view3d_view was becoming a mishmash of utility functions and operators).
- some some cmake includes as system-includes.
2012-10-17 04:13:03 +00:00
Daniel Genrich
827c70abd8 Update to stable Eigen 3.1.1
- Fixes several bugs within the Eigen library:
http://eigen.tuxfamily.org/index.php?title=ChangeLog#Eigen_3.1.1
2012-10-15 16:29:23 +00:00
Campbell Barton
3a947cf537 code cleanup: remove redundant casts 2012-10-14 08:49:01 +00:00
Campbell Barton
dc8340fa33 correct some include dirs not being included as SYSTEM paths in cmake. 2012-10-02 03:18:48 +00:00
Keir Mierle
e38c1a5ae7 Make Euclidean resection "always" succeed.
The Euclidean resection code had a magical constant, 1e-3, used to
compare the results of solving an equation. This failure detection
was well-intended, trying to prevent poor solutions from getting
made without notifying the caller. Unfortunately in practice, this
threshold is too conservative. Furthermore, it is not clear the
threshold should exist at all; the purpose of the Euclidean
resection is to come up with the best solution it can; other
methods (e.g. reprojection error) should be used to compare
whether the method succeeded.

This commit changes the Euclidean EPnP code to always succeed,
causing the previous fallback to projective resection to never
run. In most cases, this will result in better reconstructions.

This should, in most cases, fix the dreaded "flipping" problem.
2012-09-20 18:55:44 +00:00
Keir Mierle
5e433927b5 Fix variable naming in the planar tracker. 2012-09-20 02:27:34 +00:00
Keir Mierle
0af0da957d Add smarter tolerance checking in the planar tracker.
The planar tracker uses Ceres for the refinement stage. During
refinement, Ceres iteratively updates the parameters with the
latest best guess. If the change in the parameters falls below a
threshold, Ceres will abort successfully ("converged").

For the case of pure translation tracking, the parameters are
exactly the two pixel shifts (dx, dy), and measuring the change in
these parameters gives a meaningful termination criterion.
However, for all the other parameterizations like affine, where
the parameterization involves affine parameters that have no
physical interpretation, Ceres is left with no way to terminate
the solver early. With the existing code, often many iterations
are run long after Ceres has found a solution sufficiently
accurate for all tracking needs. No one needs tracking with
a quadrillionth of a pixel accuracy; that time is wasted.

This patch extends the existing iteration callback that is passed
in to Ceres to check if the pattern has fallen out of the search
window, to also check if the optimizer has made a tiny step. In
particular, if the maximum shift of any patch corner between two
successful optimizer steps is less than a threshold (currently
0.005 pixels), the track is declared successful and tracking
is terminated.

This leads to dramatic speed increases in some cases, with little
to no loss in track quality. This is especially apparent when
tracking patches with affine or perspective motion models. For
example, on some tracking cases I tried, the iterations Ceres took
went from 50 to 3.
2012-09-20 02:10:33 +00:00
Keir Mierle
a6f447427b Detect too-small planar tracking patches.
The planar tracker did not detect very skinny patches which have
effectively zero area and are untrackable. This adds detection and
rejection of patterns with zero area. This fixes a crash found by
during Mango production.
2012-09-19 22:25:02 +00:00
Keir Mierle
8a46b8454e Cleanup for when trackers fall out of the search window.
Sergey originally left a TODO() here, but his fix is the correct
one. I removed the TODO and fixed some comment issues.
2012-09-19 22:01:42 +00:00
Sergey Sharybin
16a698ad4a Fix crash when tracking in planar motion model (and maybe some other)
It was an Abort() caused by check for solver result not equal to USER_ABORT.

In some cases solver returns USER_ABORT due to BoundaryCheckingCallback
detects coordinates does not belong to image.

Somehow this callback wasn't called in previous version of Ceres and
in the same case marker was jumping. Now when the callback is called
it seems we could simply return failure of tracking without aborting
Blender.

Probably this is in fact some issue somewhere else, would double
check with Keir about this.
2012-09-19 12:43:39 +00:00
Sergey Sharybin
60e43ebf9c Ceres: resolve no previous declarations warnings
Currently done as patch applied on bundling, would forward it to Ceres developers.
2012-09-18 11:01:51 +00:00
Sergey Sharybin
e37ff1dd46 Libmv: resolved some compilation warnings (missed prototypes)
In some cases it was missed include of header file, in some other
cases symbol could be static.
2012-09-18 10:31:00 +00:00
Sergey Sharybin
c11ca1dc00 Libmv: fixed wrong function prototypes
Also mark non-public functions as static.
2012-09-18 07:09:07 +00:00
Campbell Barton
00c37e1ff6 code cleanup: correct include paths and comment 2012-09-17 04:08:36 +00:00
Sergey Sharybin
eacf3054aa Real fix for OSX CMake -- was a typo in build file generation file
Now Ceres re-bundling should go smooth :)
2012-09-16 14:43:44 +00:00
Jens Verwiebe
de72707b7d Fix OSX compile 2012-09-16 14:31:25 +00:00
Sergey Sharybin
3d84172bc8 Fix typo in one of previous commits 2012-09-16 13:58:15 +00:00
Sergey Sharybin
a4992871d6 Ceres: tweak namespace for hash classes for MSVC2010
Not sure if it'll solve all issues, but at least it should reduce
amount of errors.

Also added missed patch from previous commit.
2012-09-16 12:24:54 +00:00
Sergey Sharybin
02ef4cc33d Ceres: reshuffle include order to solve compilation error with MSVC
Not sure why exactly this happens, would need extra investigation
and should probably be also fixed in upstream.
2012-09-16 12:24:48 +00:00
Sergey Sharybin
bf6ab7a5e2 Libmv: remove unwind hack from CMake rules.
Such stuff better be solved in glog itself.

Should be pretty safe change since it was defined for CMake only
and AFAIR Jens wanted to get rid of this too.
2012-09-16 12:24:43 +00:00
Sergey Sharybin
a737bc49af Ceres: upgrade to version 1.3.0
This should contain real fixes for Windows, making it more robost and hopefully
faster (due to proper collection port) on that platform.

Also hack to fix Eigen alignment shouldn't be needed anymore.

Also on platforms which have got broken TR1 collections it's better to define
CERES_NO_TR1 instead of using Boost hacks. Made changes to Scons and CMake,
but can not check if this indeed works since i don't have OSX here.
2012-09-16 12:24:37 +00:00
Sergey Sharybin
d066ce9533 Ceres: remove debug-only code from bundling script, also move osx workaround to template 2012-09-16 12:23:00 +00:00
Brecht Van Lommel
becd442a36 Fix libmv build on OS X with 10.5 SDK. The tr1::unordered_map implementation
is broken in this SDK, now it uses the boost implementation instead.
2012-09-11 11:54:10 +00:00
Campbell Barton
2016791fee add missing files from cmakes lists 2012-09-05 00:52:35 +00:00
Campbell Barton
ed0489bb6e style cleanup: also spelling 2012-08-24 23:22:34 +00:00
Sergey Sharybin
1a5998bc4e Remove old boolean operation module
Carve proved it's a way to go, so the time have came to get rid of old
boolean operation module which isn't used anymore.

Still kept BOP interface but move it to BSP module. At some point it
could be cleaned up further (like perhaps removed extra abstraction
level or so) but would be nice to combine such a refactor with making
BSP aware of NGons.

Tested on linux using both cmake and scons, possible regressions on
windows/osx. Would check windoes build just after commit.
2012-08-02 16:42:30 +00:00
Sergey Sharybin
cad8609172 Code cleanup: silence some -Wnarrowing warnings from C++11 2012-08-01 15:02:09 +00:00
Mitchell Stokes
977188e373 Fixing [#32210] "Character physics type colliding with sensor type" reported by Daniel Stokes (kupoman) by applying a patch found in this Bullet bug report: https://code.google.com/p/bullet/issues/detail?id=525 2012-07-30 03:45:15 +00:00
Campbell Barton
f608b3c444 code cleanup:
- building without python works again
- rename maxi/mini to i_max/i_min (so thay are available for function names)
- some minor edits to IK stretch setting (no functional changes).
2012-07-29 17:49:14 +00:00
Daniel Genrich
24a00f14af Fix compile errors on VC++ 2012 RC1.
Note: Compile still fails during ceres compile (namespace tr1 problems).
2012-07-27 18:18:13 +00:00
Campbell Barton
7180551890 fix for carve memory leak, update carve to hg bf36d92ff093
reported: http://code.google.com/p/carve/issues/detail?id=33
2012-07-04 16:07:01 +00:00
Campbell Barton
0c8ebad16e add cmake option WITH_SYSTEM_OPENJPEG so linux can build cycles without having libopenjpeg installed. 2012-06-23 14:23:44 +00:00
Campbell Barton
263be14811 rename WITH_BUILTIN_GLEW, WITH_SYSTEM_GLEW & negate. 2012-06-23 13:42:14 +00:00
Campbell Barton
c250ab893c update libopenjpeg from 1.3 to 1.5, since 1.3 has a bug saving alpha channels.
the patches/ dir is NOT applied but perhaps we can get OSX and BSD working using the opj_config.h
2012-06-21 09:47:30 +00:00
Campbell Barton
f5f25b81e8 style cleanup:
also fix for building ghost test and fix double free in one of the tests
2012-06-17 09:58:26 +00:00
Sergey Sharybin
554107b6a1 Disable fixed-sized specializations for schur solver
As far as i remember Keir, this should be safe for our usages of ceres
and it should save noticeable amount of time and used memory when
compiling blender with libmv support.

Quick tests with tracking went smooth after this.
2012-06-14 13:33:37 +00:00
Campbell Barton
17d5ac0abf quiet compiler warning 2012-06-14 10:54:14 +00:00
Sergey Sharybin
552887251f Masking support for motion tracks
Added option to use Grease Pencil datablock as a mask for pattern
when doing motion tracking. Option could be found in Tracking Settings
panel.

All strokes would be rasterized separately from each other and every
stroke is treating as a closed spline.

Also added option to apply a mask on track preview which is situated
just after B/B/W channel button under track preview.
2012-06-12 11:13:53 +00:00
Antony Riakiotakis
5f1eec564f Fix compilation of new tracker for MinGW/MinGW64 2012-06-11 13:00:35 +00:00
Sergey Sharybin
6ab087ff99 Scale search area when doing planar tracking
Helps keeping features tracked when there's large scale happens
without need to manually re-adjust search area.

Currently using factor of pattern's boundbox scale, but probably
could be done in more accurate way?
2012-06-11 11:40:54 +00:00
Guillermo S. Romero
379cf37b38 SVN maintenance. 2012-06-11 02:29:25 +00:00
Sergey Sharybin
84b734a4df Commit patch from Stephan Kassemeyer sent to ML
This patch aims to solve unaligned operation assert
happens in Eigen library.

This is short-term solution which in fact shall be reverted
as soon as real solution would be added to Ceres. Meanwhile
this should be acceptable to have for a while.
2012-06-10 15:28:29 +00:00
Sergey Sharybin
25bb441301 Planar tracking support for motion tracking
===========================================

Major list of changes done in tomato branch:

- Add a planar tracking implementation to libmv
  This adds a new planar tracking implementation to libmv. The
  tracker is based on Ceres[1], the new nonlinear minimizer that
  myself and Sameer released from Google as open source. Since
  the motion model is more involved, the interface is
  different than the RegionTracker interface used previously
  in Blender.

  The start of a C API in libmv-capi.{cpp,h} is also included.

- Migrate from pat_{min,max} for markers to 4 corners representation

  Convert markers in the movie clip editor / 2D tracker from using
  pat_min and pat_max notation to using the a more general, 4-corner
  representation.

  There is still considerable porting work to do; in particular
  sliding from preview widget does not work correct for rotated
  markers.

  All other areas should be ported to new representation:

  * Added support of sliding individual corners. LMB slide + Ctrl
    would scale the whole pattern
  * S would scale the whole marker, S-S would scale pattern only
  * Added support of marker's rotation which is currently rotates
    only patterns around their centers or all markers around median,

    Rotation or other non-translation/scaling transformation of search
    area doesn't make sense.

  * Track Preview widget would display transformed pattern which
    libmv actually operates with.

- "Efficient Second-order Minimization" for the planar tracker

  This implements the "Efficient Second-order Minimization"
  scheme, as supported by the existing translation tracker.
  This increases the amount of per-iteration work, but
  decreases the number of iterations required to converge and
  also increases the size of the basin of attraction for the
  optimization.

- Remove the use of the legacy RegionTracker API from Blender,
  and replaces it with the new TrackRegion API. This also
  adds several features to the planar tracker in libmv:

  * Do a brute-force initialization of tracking similar to "Hybrid"
    mode in the stable release, but using all floats. This is slower
    but more accurate. It is still necessary to evaluate if the
    performance loss is worth it. In particular, this change is
    necessary to support high bit depth imagery.

  * Add support for masks over the search window. This is a step
    towards supporting user-defined tracker masks. The tracker masks
    will make it easy for users to make a mask for e.g. a ball.

    Not exposed into interface yet/

  * Add Pearson product moment correlation coefficient checking (aka
    "Correlation" in the UI. This causes tracking failure if the
    tracked patch is not linearly related to the template.

  * Add support for warping a few points in addition to the supplied
    points. This is useful because the tracking code deliberately
    does not expose the underlying warp representation. Instead,
    warps are specified in an aparametric way via the correspondences.

- Replace the old style tracker configuration panel with the
  new planar tracking panel. From a users perspective, this means:

  * The old "tracking algorithm" picker is gone. There is only 1
    algorithm now. We may revisit this later, but I would much
    prefer to have only 1 algorithm. So far no optimization work
    has been done so the speed is not there yet.

  * There is now a dropdown to select the motion model. Choices:

        * Translation
        * Translation, rotation
        * Translation, scale
        * Translation, rotation, scale
        * Affine
        * Perspective

  * The old "Hybrid" mode is gone; instead there is a toggle to
    enable or disable translation-only tracker initialization. This
    is the equivalent of the hyrbid mode before, but rewritten to work
    with the new planar tracking modes.

  * The pyramid levels setting is gone. At a future date, the planar
    tracker will decide to use pyramids or not automatically. The
    pyramid setting was ultimately a mistake; with the brute force
    initialization it is unnecessary.

- Add light-normalized tracking

  Added the ability to normalize patterns by their average value while
  tracking, to make them invariant to global illumination changes.

Additional details could be found at wiki page [2]

  [1] http://code.google.com/p/ceres-solver
  [2] http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker
2012-06-10 15:28:19 +00:00
Sergey Sharybin
59ef51aa27 Initial Ceres integration into Blender
Currently only put sources of Ceres library into extern/libmv/third_party and
setup CMake and SCons building systems.

Integration details:

- Even CMake build files are not re-used from Ceres's trunk: they're using some
  automatic stuff detection like glog, pthreads, protobuf and so and it's not
  so clear how to re-use that files without modifications.
  And IMO it's easier if build files are getting re-generated automatically to
  match Blender-specific setup rather than keeping changes made locally in
  Blender in sync when re-bundling Ceres library. Especially in case when it's
  already needed to support SCons build system.
- Integrated only actual sources, all tests were stripped. Probably it'll be nice
  to have them, but they'll need clear integration with current module test stuff
  in Blender.
- Suitesparse was disabled. It'll help a lot having it, but there are some difficulties
  making cholmod working fine on windows. Would be added in future
- collections_port.cc was also stripped. It's not used by Ceres's upstream and
  it gives compilation error (undefined uint32 -- looks like namespace issue).
- Currently all schur eliminators are included. Not sure if it makes sense,
  also not sure if it makes sense having them switchable on and off -- IMO better
  to have single configuration which works and does not require special tweaks
  after everything was set up.

To bundle updated version of Ceres:
- Go to extern/libmv/third_party/ceres folder
- Run ./bundle.sh

This will checkout fresh Ceres snapshot of Windows branch (which is currently
most interesting from integration into Blender POV), apply all patches listed
in patches/series and copy needed files into Blender's working copy. This will
also re-generate CMake/SCons build rules.

If you'll need extra files from Ceres repository which are not present in
Blender, you'll need to copy them manually and then run ./mkfiles.sh from
extern/libmv/third_party/ceres folder which will update list of files used
by Blender.

Thanks to Leir Mierle and Sameer Agarwal (and all others who helped developing
Ceres) this library and thanks to Keir Mierle with help integrating it into Blender!
2012-06-10 15:27:41 +00:00
Sergej Reich
82d3d9f2ba Update Bullet to version 2.80 (bullet svn revision 2537)
Remove Jamfiles and other unused files that stuck around during previous updates.

Add patches for local changes to the patches directory.

Update readme.txt, it had outdated infromation.
2012-06-08 16:13:01 +00:00
Benoit Bolsee
dfc19a1ff7 BGE patch #28476: Character object physics type
===============================================
This patch adds a new "Character" BGE physics type which uses Bullet's btKinematicCharacter for simulation instead of full-blown dynamics. It is appropiate for (player-controlled) characters, for which the other physics types often result unexpected results (bouncing off walls, sliding etc.) and for which simple kinematics offers much more precision.

"Character" can be chosen like any other physics type in the "Physics" section of the properties window. Current settings for tweaking are "Step Height" (to make the object automatically climb small steps if it collides with them), "Fall Speed" (the maximum speed that the object can have when falling) and "Jump Speed", which is currently not used.

See http://projects.blender.org/tracker/?func=detail&atid=127&aid=28476&group_id=9
for sample blends and a discussion on the patch: how to use it and what influences the behavior of the character object.

Known problem: there is a crash if the "compound" option is set in the physics panel of the Character object.
2012-05-28 21:36:29 +00:00
Campbell Barton
857dedbc58 style cleanup 2012-05-27 00:36:50 +00:00
Sergey Sharybin
a7a79322bf Make blender compilable by gcc-4.7 and strict compilation flags:
- Remove strict flags from files, which are using FFmpeg stuff
  We're still using some symbols which are marked as deprecated.
  Ideally, we shall switch to new API, but it's a bit larger challenge
  because we don't want to break compatibility withotu actual need.
- Replace MAKE_ID with BT_MAKE_ID in bullet library.
  This is needed to prevent re-definition of MAKE_ID in bullet library.
  Seems it's only used to read blender files, so should be quite safe
  change.
2012-05-14 13:31:38 +00:00