Commit Graph

1221 Commits

Author SHA1 Message Date
64e4f9967f Fix T46403: motion tracking not workig with Xcode 7 on OS X.
Caused by use of the uninitialized shape_ variable in Resize().
2015-10-10 04:09:37 +02:00
Bastien Montagne
8159718faf BLI: add SVD solver for mat3 (using eigen3). 2015-10-09 21:26:33 +02:00
Sergey Sharybin
9744c8ca58 CMake: Another attempt to solve compilation error on Windows 2015-09-17 14:29:56 +05:00
Sergey Sharybin
a712459603 CMake: Attempt to fix compilation error on Windows after recent changes 2015-09-17 14:17:00 +05:00
Sergey Sharybin
0b959458ff CMake: Don't modify global CFlags when enabling/disabling OpenJpeg 2015-09-16 19:10:41 +05:00
Sergey Sharybin
42e15b9dd3 Fix T46051: Loading certain Jpeg causes system alert sound (Win32)
The issue was caused by RedCode library printing binary string to the terminal.
2015-09-09 16:18:37 +05:00
Sergey Sharybin
dfc672f8bb SCons: Fix for really nasty bug with polluting configuration environment
The issue was caused by the following construction:

  def = env['SOMETHING']
  defs.append('SOMETHING_MORE')

Since first assignment was actually referencing environment option it was totally
polluted hawing weird and wonderful side effects on all other areas of Blender.
2015-08-04 18:06:28 +02:00
Sergey Sharybin
3d36489672 OpenSubdiv: Commit of OpenSubdiv integration into Blender
This commit contains all the remained parts needed for initial integration of
OpenSubdiv into Blender's subdivision surface code. Includes both GPU and CPU
backends which works in the following way:

- When SubSurf modifier is the last in the modifiers stack then GPU pipeline
  of OpenSubdiv is used, making viewport performance as fast as possible.

  This also requires graphscard with GLSL 1.5 support. If this requirement is
  not met, then no GPU pipeline is used at all.

- If SubSurf is not a last modifier or if DerivesMesh is being evaluated for
  rendering then CPU limit evaluation API from OpenSubdiv is used. This only
  replaces the legacy evaluation code from CCGSubSurf_legacy, but keeps CCG
  structures exactly the same as they used to be for ages now.

This integration is fully covered with ifdef and not enabled by default
because there are several TODOs to be solved first:

- Face varying data interpolation is not really cleanly implemented for GPU
  in OpenSubdiv 3.0. It is also not implemented for limit evaluation API.

  This basically means we'll have really hard time supporting UVs.

- Limit evaluation only works with adaptivly subdivided meshes so far, which
  basically means all the points of CCG are pushed to the limit. This gives
  different result from old code.

- There are some serious optimizations possible on the topology refiner
  creation, which would speed up initial OpenSubdiv mesh creation.

- There are some hardcoded asumptions in the GPU and DerivedMesh areas which
  could be generalized.

  That's something where Antony and Campbell can help, making it so the code
  is structured in a way which is reusable by all planned viewport projects.

- There are also some workarounds in the dependency graph to make sure OpenGL
  buffers are only freed from the main thread.

Those who'll be wanting to make experiments with this code should grab dev
branch (NOT master) from

  https://github.com/Nazg-Gul/OpenSubdiv/tree/dev

There are some patches applied in there which we're working on on getting
into upstream.
2015-07-20 22:29:26 +02:00
Sergey Sharybin
bbed6af857 CMake: Disable Werror in extern/libmv for now
It gives issues with Glog compiled in release mode.

Need to revisit the directory layout here and compiler flag, because technically
libmv is now more an intern/ library and i'll actually prefer it to be covered
with strict flags as well. But it's a bit tricky because of libraries which we
don't maintain are in the libmv subfolder.
2015-07-18 11:16:25 +02:00
Sergey Sharybin
2199a3e38b CMake: Add option to enable -Werror cflag in some areas
It is rather annoying attitude nowadays to use const qualifier all over the
place, including using it for multi-dimensional arrays. This isn't really
supported in GCC prior to version 5.0 because it considers such an arrays
to be a "pointer to a const pointer" which gives implicit casting errors.

It's not possible to disable this particular type of warnings treated as
errors in any GCC version prior to 5.0 as well, meaning currently usage of
-Werror globally in Blender code is not possible at all.

This commit makes it possible to use -Werror in areas which are complaint
with older GCC versions. New advanced CMake options are:

- WITH_COMPOSITOR_WERROR
- WITH_LIBMV_WERROR
- WITH_CYCLES_WERROR
2015-07-18 10:49:51 +02:00
Bastien Montagne
582e7a6347 Add a skeleton of C API for Eigen3.
Title says pretty much everything. For now, only thing available is a solver of eigen
values/vectors for self-adjoint matrices.

We can easily add more when needed.

Thanks to Sergey and Campbell for quick review.
2015-07-13 18:05:38 +02:00
Campbell Barton
cd7853be22 CMake: quiet warnings in GTest 2015-06-23 14:34:52 +10:00
Campbell Barton
36d47ce203 Fix leak in BMesh convex hull operator 2015-05-30 16:17:04 +10:00
Campbell Barton
5d30c23c35 doxygen: corrections/updates
Also add depsgraph & physics
2015-05-20 14:12:22 +10:00
Sergey Sharybin
650fbd09f7 OpenCL wrangler: Add some of the extension defines 2015-05-15 13:22:47 +05:00
Campbell Barton
6f0f1dc3be Cleanup: warnings 2015-04-19 22:03:42 +10:00
Campbell Barton
15d3d8560d Cleanup: remove unused face normals
also use const
2015-04-17 23:50:23 +10:00
Sergey Sharybin
917b8754f9 Tracking: Fix one frame memory leak when tracking last frame 2015-03-25 13:20:37 +05:00
Sergey Sharybin
0f0e080a26 Fix T44110: Plane track doesn't work when built with scons
For some reason recent change in avoiding non-aligned eigen vectors
was behaving differently for cmake and scons. Made it a bit different
now by storing scalars. This is more robust approach anyway, because
it's not really guaranteed Mat.col() gives a pointer inside data,
depending on column-major vs. row-major storage.

This is to be backported to 2.74 branch.
2015-03-24 14:05:49 +05:00
Campbell Barton
4b88541d59 CMake: unbundle eigen3
Optionally use systems eigen3 library.

T41989 by @hasufell with edits
2015-03-19 15:41:41 +11:00
Campbell Barton
2df4444def CMake: exclude Colamd when OpenNL's disabled 2015-03-19 14:48:52 +11:00
Campbell Barton
bb825d02f8 CMake: unbundle LZO library
Patch T41989 by @hasufell
2015-03-13 22:36:01 +11:00
Sergey Sharybin
3f572fe7d2 Fix T43905: Crash happens when press Create Plane Track
It was only happening on 32bit platforms because of alignment
differences when allocating class.

Now got rid of copy of eigen matricies stored by value in the
residual block which solves aligment issues and should also
give some unmeasurable speedup.
2015-03-06 14:58:16 +05:00
Campbell Barton
d17e6c10df Cleanup: quiet minilzo warnings 2015-03-06 17:47:23 +11:00
Ines Almeida
b7033e3d4e BGE physics: adding links to bullet documentation 2015-02-19 11:20:18 +00:00
Campbell Barton
65574b0b03 cleanup: shebang lines
D888 by @sambler
2015-01-29 15:56:23 +11:00
Sergey Sharybin
653c6f2edd SDL wrangler: Support loading SDL2 libraries of different names
Seems different distros might have different naming rules, so need
to adopt our code for that.
2015-01-14 00:26:43 +05:00
Campbell Barton
72ca952641 correct permissions 2015-01-08 23:01:15 +11:00
Sergey Sharybin
59742167ce Just another attempt to make MSVC happy
No idea why standalone libmv remo was all fine with the code..
2014-12-31 19:04:29 +05:00
Sergey Sharybin
bca434de78 Hopefully fix compilation error after recent update 2014-12-31 16:42:40 +05:00
Sergey Sharybin
caa2306d16 Libmv: Update to latest upstream version
Main purpose of this is to bring new gflags library which is more likely
to have a fix for undefined order of static variables initialization and
also to bring new glog where some compilation error are fixed (which are
only visible with more strict checks with clang and c++11 enabled).
2014-12-31 16:02:04 +05:00
Sergey Sharybin
2617d37034 Libmv: Reshuffle CMake and SCons configuration files
The main idea is to share as much code between cases when feature-full built
is done and only logging is needed, so all the defines and include directories
are guaranteed to be the same.

This would hopefully make it so MinGW compilation is all happy about Cycles
logging for both CMake and SCons.
2014-12-11 11:58:03 +05:00
Sergey Sharybin
8600dc6365 Fix T42800: Blender suddenly closes after pressing solve camera motion
Couple of issues:

- Fist/last frame calculation was wrong

- Keyframe selection might silently fail leading to unpredictable math
  errors all over the place. Now if keyframe selection fails solver wouldn't
  run.
2014-12-04 20:02:05 +05:00
Sergey Sharybin
627f27502f Cycles: Support logging when building with SCons
Basically, title says ti all, the option is called WITH_BF_CYCLES_LOGGING
2014-12-03 22:46:56 +05:00
Sergey Sharybin
80d1d624d3 Support dynamic loading of SDL libraries
This is mainly to address old issue when one need to have SDL library installed
in order to use our official builds. Some hip distros already installs SDL,
but it's not quite the same across all the variety of the distros.

We also now switching to SDL-2.0, most of the distros have it in repositories
already, so it shouldn't be huge deal to install it if needed.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D878
2014-11-17 17:43:18 +05:00
Sergey Sharybin
fa6c45b092 Cycles: Fix compilation error with enabled looging but disabled libmv 2014-11-15 04:01:31 +05:00
Sergey Sharybin
f82f1513e0 Booleans: Boost is no longer a dependency for Carve
SCons is currently broken on my laptop, so can't test if it works for sure,
so please do tests of that.
2014-11-13 18:26:21 +05:00
Sybren A. Stüvel
53297e62eb Fixed warning about redefining the __SSE__ macro in VS2013 2014-11-05 21:55:17 +05:00
Sergey Sharybin
aa91a36864 Libmv: Code cleanup, avoid C11 feature with structure re-definition 2014-11-01 03:18:40 +05:00
Sergey Sharybin
26e440838f Libmv: Code cleanup, mixed class/struct in declaration/definition 2014-11-01 02:57:05 +05:00
Sergey Sharybin
f312f890f1 Libmv: Support disabled color channels in tracking settings
This was never ported to a new tracking pipeline and now it's done using
FrameAccessor::Transform routines. Quite striaghtforward, but i've changed
order of grayscale conversion in blender side with call of transform callback.

This way it's much easier to perform rescaling in libmv side.
2014-10-30 23:29:53 +05:00
Sergey Sharybin
606329d0f8 Libmv: Replace region tracker with autotracker in Blender
The title actually tells it all, this commit switches Blender to use the new
autotrack API from Libmv.

From the user point of view it means that prediction model is now used when
tracking which gives really nice results.

All the other changes are not really visible for users, those are just frame
accessors, caches and so for the new API.
2014-10-30 23:12:19 +05:00
Sergey Sharybin
7013d55580 Libmv: Add autotrack API to the C-API
Pretty much straightforward changes, nothing to be mentioned specially.
2014-10-30 23:07:46 +05:00
Keir Mierle
b15a056230 Libmv: Initial commit of unfinished AutoTrack API
This starts the creating the new AutoTrack API. The new API will
make it possible for libmv to do full autotracking, including
predictive tracking and also support multiple motion models (3D
planes etc).

The first goal (not in this patch) is to convert Blender to use
the new API without adding any new functionality.

This API currently contanins:

- Frame accessor to access frames which are stored in Blender side.
- New Tracks implementation
- New Reconstruction implementation

Currently this API only tested on doing the same frame-to-frame
tracking as the old API allowed to do. But it also supports now
predictive tracking which is based on the Kalman filter.
2014-10-30 23:03:34 +05:00
Jens Verwiebe
c8d10d115c OSX/CLEW: silence hundreds of warnings: 'weak_import' attribute only applies to variables and functions 2014-10-24 14:25:02 +02:00
Jason Wilkins
88fe896243 Checked each of my (jwilkins) XXX notes.
The ones in extern/glew-es have been changed to NOTE instead of XXX

GHOST_ContextEGL.cpp: It really does seem that it is not possible to query the swap interval using EGL

GHOST_WidnowCocoa.h: The comment referring to Carbon is clearly out of date, so I removed it.

math_geom.c: The node about not using tmax again is correct, but the code is kept for a future maintainer who will need to know how to compute it if they modify that code.

paint_image_proj.c (2698): The question about integer truncation does not appear to have been resolved.  It still seems to be an incorrectly implementation of rounding (I'd suggest using the round function instead of this hack).
2014-10-22 20:03:25 -05:00
Sergey Sharybin
ad4980ce5e Code cleanup: Mostly whitespace 2014-10-10 02:17:46 +06:00
Sergey Sharybin
c1004b1b77 Libmv: Update Ceres to latest upstream
just to be sure we're dealing with the latest git version when troubleshooting
one annoying OSX issue..
2014-10-09 11:30:59 +02:00
Jason Wilkins
8d084e8c8f Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
2014-10-07 15:47:32 -05:00
Campbell Barton
a8705e99ee Sculpt: minor speedup for dyntopo
Add retake to range-tree to avoid double lookup.
2014-10-07 21:02:08 +02:00
Campbell Barton
37474e50ce Cleanup: use bool 2014-10-07 20:40:11 +02:00
Sergey Sharybin
db62a80869 Libmv: Remove old workaround for 10.5 hash tables
We on'don't really support 10.5 anymore for my knowledge and in any case
the defined symbol was never checked in the sources, so this workaround
was basically doing nothing for quite some time now.
2014-10-02 13:01:34 +06:00
Sergey Sharybin
178f8400ee Libmv: Add an option to disable schur specializations build-time
This way folks with few ram or those who wants to hack into Ceres
code might compile Blender much faster.
2014-10-02 13:01:34 +06:00
Sergey Sharybin
5ab4c6b7aa Libmv: Silence some warnings about C11 usage
This makes headers a bit less clean (with the anonymous structs
mainly and headers inclusion from another header.

Makes compilation with clang a bit less noisy.
2014-10-02 13:01:34 +06:00
Sergey Sharybin
ff53b046f2 Libmv: update ceres to latest upstream version
This brings faster BlockRandomAccessSparseMatrix::SymmetricRightMultiply.
2014-09-30 14:50:05 +06:00
Sergey Sharybin
56a5f17846 Libmv: Enable explicit Schur complement matrix by default
Gives up to 2x speed up of camera solving process in average scene.
In the really huge one it might be slower, but that we need to investigate.
2014-09-30 00:43:04 +06:00
Sergey Sharybin
b16e924251 Libmv: Update Ceres to the latest upstream version
Mainly to let ITERATIVE_SCHUR use an explicit Schur Complement matrix.
2014-09-30 00:39:45 +06:00
Kévin Dietrich
e1afaa02bf Fix T41974: blender ships vulnerable minilzo version
Update lzo library due to security issue

Update lzo to latest version. This fixes a security issue (reported in T41974)

This also fixes some (false-positive) valgrind warnings.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D803
2014-09-28 01:35:12 +06:00
Sergey Sharybin
e237424046 Tracking: Make sure INC_SYS is always fine 2014-09-27 15:41:46 +06:00
Sergey Sharybin
84dfec76eb Tracking: Cleanup of the bundler script 2014-09-27 00:50:41 +06:00
Sergey Sharybin
58a9569628 SCons: Don't compile libmv stub when libmv is actually enabled
Really weird linux and windows didn't have duplicated symbols error.
2014-09-26 14:28:04 +06:00
Sergey Sharybin
13d8671a1a Cycles: Add support of Glog logging
This commit makes it possible to use Glog library for the debug logging.
For now only possible when using CMake and in order to use the logging
the WITH_CYCLES_LOGGING configuration variable is to be enabled.

When this option is not enabled or when using Scons there's no difference
in Cycles behavior at all, when using logging and no output to the console
impact is gonna to be minimal.

This is done in order to make it possible to have debug logging persistent
in code (without need to add it when troubleshooting some bug and removing
it afterwards).

For now actual logging is not placed yet, only all the functions needed for
the logging are written and so.
2014-09-25 17:08:32 +06:00
Sergey Sharybin
058e3f087e Tracking: Decouple C-API module into more granular files
This way maintaining the C-API is a bit less tedious job
and makes code cleaner to follow.

Should be no functional changes.
2014-09-25 17:04:56 +06:00
Sergey Sharybin
42abfe4853 Update Ceres to latest upstream version
As usual brings fixes and speed improvements.
2014-09-25 13:04:17 +06:00
Sergey Sharybin
181e7f98b2 Tracking: Enable Schur specializations
This would give some performance boost when solving huge scenes,
amount of boost depends on particular scene.

For now enable all of the specializations, in the future we might
add some local patches and restrict only unneeded ones.
2014-09-25 13:04:16 +06:00
Sergey Sharybin
0fe70b5e28 Fix T41360: Crash on Boolean Modifier
The issue was caused by the wrong attributes maps in certain
circumstances after union intersections.

Namely issue might have happen when more than one iteration of
union was happening and it was caused by the fact that new faces
might be allocated on the same address as freed face from the
old mesh.

Didn't find a nicer fix for this apart from correcting the whole
attributes map after each union step.

We could try removing attributes for the meshes which are getting
deleted, but in asymptotic it's gonna to give exactly the same
complexity as the current approach.
2014-08-11 20:55:52 +06:00
Benoit Bolsee
3a53ed8d1b Remove an assert in Bullet for the Character physics.
This assert happens all the time for character physics in debug mode.
In release mode, the assert is skipped but the code is still incorrect
although it does not cause any crash strangely.
2014-08-10 00:39:22 +02:00
Nicholas Bishop
e123434397 Fix a few typos in carve-capi.h
The typos didn't cause any bug, but the mis-ordered parameter names in CarveExporter_InitGeomArrays were confusing.

Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D709
2014-08-05 10:36:45 -04:00
Jens Verwiebe
5efa7fa534 Fix possible harmful warning: the value of the size argument in 'strncat' is too large, change the argument to be the free space in the destination buffer minus the terminating null byte 2014-08-05 12:03:31 +02:00
Sergey Sharybin
b9c8572d71 Fix wrong assert happening in the CUEW 2014-08-05 15:28:59 +06:00
Sergey Sharybin
77b7e1fe9a Deduplicate CUDA and OpenCL wranglers
For now it was mainly about OpenCL wrangler being duplicated
between Cycles and Compositor, but with OpenSubdiv work those
wranglers were gonna to be duplicated just once again.

This commit makes it so Cycles and Compositor uses wranglers
from this repositories:

  - https://github.com/CudaWrangler/cuew
  - https://github.com/OpenCLWrangler/clew

This repositories are based on the wranglers we used before
and they'll be likely continued maintaining by us plus some
more players in the market.

Pretty much straightforward change with some tricks in the
CMake/SCons to make this libs being passed to the linker
after all other libraries in order to make OpenSubdiv linked
against those wranglers in the future.

For those who're worrying about Cycles being less standalone,
it's not truth, it's rather more flexible now and in the future
different wranglers might be used in Cycles. For now it'll
just mean those libs would need to be put into Cycles repository
together with some other libs from Blender such as mikkspace.

This is mainly platform maintenance commit, should not be any
changes to the user space.

Reviewers: juicyfruit, dingto, campbellbarton

Reviewed By: juicyfruit, dingto, campbellbarton

Differential Revision: https://developer.blender.org/D707
2014-08-05 13:57:50 +06:00
Campbell Barton
d5b471eec1 CMake: add header 2014-08-02 19:16:00 +10:00
Sergey Sharybin
895f0f3dff Fix crash in cases when first BA step happens with all zero-weighted tracks 2014-07-23 00:46:26 +06:00
Jens Verwiebe
2440b3e158 OSX/scons: Try to get rid of buildproblems with openjpeg enabled in certain build environments and prepend SDK_FLAGS to CFLAGS always 2014-07-06 14:10:41 +02:00
Sergej Reich
81c3fc9726 cloth: Speed up collision detection
Noticed this while looking into something else.
The change is trivial, but gives a rather nice preformance improvement,
so why not.
Theres's actually a lot one can do to improve collision performance if
one wanted to, the triangle-triangle check alone has a lot of room for
improvement.
2014-07-03 21:40:04 +02:00
Campbell Barton
2e840e56cf CMake: correct include dirs 2014-07-01 09:36:28 +10:00
Sergey Sharybin
c73505fb43 Get rid of usage of non-existing module 2014-06-27 17:30:17 +06:00
Sergey Sharybin
cba3498629 Update Carve to latest upstream version
This brings new copyright header which supports GPL2 and 3.

It wasn't really an issue before because we had agreement with
Tobias, but now it's all documented in sources.
2014-06-27 15:56:50 +06:00
Sergey Sharybin
72ac596e19 Update Ceres to latest upstream version
Brings new bounds limiting and also prepares build system
for the changes in the upstream.

Namely shared_ptr header and namespace is now being detected
by a build system rather than by hacks in the code.

This commit includes some changes to auto-detection flags
in SCons, presumably adding more consistency there. This
is main changes which are suppoed to be reviewed here.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D581
2014-06-27 14:08:27 +06:00
Campbell Barton
4baa2fdcfe Correction to GTest commit (WITH_GTEST=OFF works now) 2014-06-19 04:35:15 +10:00
Sergey Sharybin
72b607ab74 Some WITH_TESTS weer not renamed to WITH_GTEST 2014-06-18 22:28:27 +06:00
Sergey Sharybin
306cbb82ec GTest unit testing framework
Currently covers only small set of functionality.
2014-06-19 02:09:16 +10:00
Sergey Sharybin
e53c00a2db Add patchset to recent Carve changes
In the future i'd rather have this reported to an
upstream instead of adding local changes. It's really
easy to override this changes if patchset is not added
and this is to be fixed in upstream. Also the function
was never used so it was rather totally harmless warning
for us.
2014-06-11 13:13:36 +06:00
Jens Verwiebe
a6a38de4d6 Fix a warning in carve by initializing var 2014-06-10 20:15:50 +02:00
Sergey Sharybin
05fa464a25 Fix T40551: Boolean Modifier distorts UVs
Mapping to original face was never working 100% reliably actually,
now use more robust method for this.
2014-06-10 19:27:09 +06:00
Sergey Sharybin
8bf7172384 Fix compilation on OSX after previous commit
EXPECT_EQ wasn't defined in the scope.
2014-04-23 19:19:38 +06:00
Sergey Sharybin
c605711c6b Libmv cleanup: move aligned malloc implementation into own file
It was rather stupid having it in brute region tracker,
now it is in own file in base library.
2014-04-23 16:03:44 +06:00
Sergey Sharybin
0ff06a9ba5 Libmv: optimization of PearsonProductMomentCorrelation
Pass the arrays by reference rather than by value,
should give some percent of speedup.

Also don't pass the dimensions to the function but
get them from the images themselves.

Hopefully this will give some %% of tracker speedup.
2014-04-21 14:26:37 +06:00
Jens Verwiebe
9c93c0bf08 Bullet: making bullet friction workaround more furureproof by using the __apple_build_version__ macro, TODO: check if problem persists with newer clang 2014-04-19 14:10:49 +02:00
Sergey Sharybin
fe3eb82520 Re-bundle Libmv to be sure it's all fine 2014-04-17 23:31:57 +06:00
Sergey Sharybin
5bf7d988ac Fix for 771a9dd: libmv build files are automatically generated
This means if one makes change to either SConscript or CMakeLists.txt
there he MUST update bundle.sh.

Also made it so *.cc files from intern/libmv are matching which would
make it easier to add more .cc files there if needed.

And one more thing is removing 'simple_pipeline/distortion_models.cc'
which doesn't match any of the files.
2014-04-17 22:38:31 +06:00
Jens Verwiebe
771a9dd335 Lbmv: fix scons compile after ed2ddc9 2014-04-17 17:00:29 +02:00
Antony Riakiotakis
87b86eee62 Fix compilation issue. 2014-04-17 15:53:34 +03:00
Sergey Sharybin
c4a9ec88c8 Fix crash when enabling undistorted display in MCE 2014-04-17 18:01:45 +06:00
Sergey Sharybin
ed2ddc9f70 Support multiple distortion models, including a new division model
This commit makes it so CameraIntrinsics is no longer hardcoded
to use the traditional polynomial radial distortion model. Currently
the distortion code has generic logic which is shared between
different distortion models, but had no other models until now.

This moves everything specific to the polynomial radial distortion
to a subclass PolynomialDistortionCameraIntrinsics(), and adds a
new division distortion model suitable for cameras such as the
GoPro which have much stronger distortion due to their fisheye lens.

This also cleans up the internal API of CameraIntrinsics to make
it easier to understand and reduces old C-style code.

New distortion model is available in the Lens panel of MCE.

- Polynomial is the old well-known model
- Division is the new one which s intended to deal better with huge
  distortion.

Coefficients of this model works independent from each other
and for division model one probably want to have positive values
to have a barrel distortion.
2014-04-17 17:28:41 +06:00
Jens Verwiebe
8a4210074c Bullet: better workaround for failing friction with clang 3.4, remove the obsolete compileflag magic 2014-04-17 00:25:25 +02:00
Campbell Barton
b3972aeea0 Math Lib: optimize axis_dominant_v3_to_m3, approx 6x speedup
build the matrix directly rather then calculating with axis/angle

also remove unused function calc_poly_plane
2014-04-16 21:07:28 +10:00
Antony Riakiotakis
7bf62f0c60 ...and linking, sorry for that! 2014-04-10 22:00:54 +03:00
Antony Riakiotakis
c0a9397a06 Fix compilation 2014-04-10 21:59:03 +03:00
Sergey Sharybin
df63e8fd93 Speedup track preview widget for byte images
This gives a huge speedup gain for cases when you've got
rather huge markers on a byte images.

Done by skipping IMB_float_from_rect()/IMB_rect_from_float()
for such cases. We can sample the buffers without color space
conversion.
2014-04-10 21:14:36 +06:00
Sergey Sharybin
ccf9afddba Fix T39608: Blender 2.70 crashes when performing union
This was a nasty bug which was caused by specific of how face-edge
attributes are stored in Carve.

Face pointer is used in the map key which works just fine in all
cases except for the cases when some face is getting freed after
it was stored in the map.

This might give real issues when new face is allocating because
it's possible new face would have the same address as the freed
one.

Such cases used to happen when union of separate manifolds is
needed for the operands AND jemalloc is enabled.

Solved by dropping attributes for the freed faces from the map.
Maybe not the fastest ever approach, but not sure how to make
it faster actually. Should work just fine. It only happens for
complex setups with intersecting manifolds in the operands.
2014-04-09 14:27:34 +06:00
Sergej Reich
6ffabfae85 Fix T39646: Rigid Body Constraints non functional on release builds
-ffast-math is evil, not sure why it was enabled...
I seems to work better on OSX but it's still not a good idea.

The SConscript for bullet is a mess, I don't understand why
we use different flags for different platforms in the first place.
Seems to be a historical artifact but I don't know enough about scons
to try and clean it up.
2014-04-09 01:48:44 +02:00
Campbell Barton
9bbb30bf03 Fix T39245: Crash when dynamic topology is enabled
Redundant decrement was crashing for systems which didnt optimize it out.
2014-04-03 17:13:31 +11:00
Sergey Sharybin
f0106d2985 Unbreak carve build for clang
Based on D420
2014-03-28 14:41:04 +06:00
Sergey Sharybin
af16d462e3 Fix T39419: Crash when solving camera motion
Stupid vector initialization error.

Should be in 'a'.
2014-03-26 17:47:13 +06:00
Sergey Sharybin
cf148edb26 Followup to Ceres changes -- need to update bundling script 2014-03-25 15:08:22 +06:00
Lukas Tönne
ddc959691a Fix for own commit: mixed up ceres build defines when replacing cmake
check with a generalized macro.

rBbbfcb0b1e44636b73b8c46f1cb800fa53dda5277
2014-03-25 09:49:39 +01:00
Lukas Tönne
bbfcb0b1e4 Build file macro for testing unordered_map C++ container support.
Using unordered_map and unordered_set C++ container types currently
requires careful testing or usage of boost, due to the various confusing
C++ version differences in include paths and namespaces.

Libmv defines tests for these cases in cmake and scons, such that ceres
can use any available implementation, or fall back too std::map/std::set
if none can be found.

This patch generalizes this buildfile code by providing a Blender macro.
* cmake: defines both the variables used by libmv at them moment as well
as 2 variables UNORDERED_MAP_INCLUDE_PREFIX and UNORDERED_MAP_NAMESPACE,
which can later be used in other C++ parts for convenience.
* scons: adds a tool script returning the include prefix and namespace.
Libmv checks these to define the appropriate definitions for ceres.

Differential Revision: https://developer.blender.org/D425
2014-03-25 09:25:00 +01:00
Jens Verwiebe
877706b8eb Cleanup: Restrict the debug -gline-tables-only to cxx_debug in cycles and spelling 2014-03-22 11:33:32 +01:00
Sergey Sharybin
356ec42bda Attempt to fix compilation error with msvc2013 2014-03-21 16:06:30 +06:00
Sergey Sharybin
3411146984 Update Eigen to version 3.2.1
Main purpose of this is to have SparseLU solver which
we can use now as a replacement to opennl library.
2014-03-21 16:04:53 +06:00
Sergey Sharybin
dfa5ced30e Follow up to the previous commit
Just update to the changelog
2014-03-20 23:45:29 +06:00
Sergey Sharybin
6ba5c0c268 Update Libmv to latest upstream
This is mainly a maintaince commit which syncs changes
between Blender and Libmv upstream also bringing new
GLog version.

This GLog version is presumably have better support of
MinGW from "the box".

This commit is also aimed to make further 3d part libs
update easier.
2014-03-20 23:26:25 +06:00
Jens Verwiebe
3f89b92823 Ups, forgot to remove something i just placed temporary … 2014-03-19 11:26:41 +01:00
Jens Verwiebe
67f0290382 OSX/bullet/scons: a better workaround for clang 3.4 issues with actual bullet, according cmake ( less speed penalty ) 2014-03-19 11:21:36 +01:00
Jens Verwiebe
5ff0500593 OSX/cmake/bullet: fix ambigoius compiler ID and make deoptimize fix a bit stricter to reduce speed penalty 2014-03-18 12:18:03 +01:00
Sergey Sharybin
94379277dd Fix T39151: Boolean modifier freeze
This re-applied patch from 25cbd13 which was lost at some point
since missing patchset in series.

This revision is to be back-ported to the final release.
2014-03-13 15:40:55 +06:00
Sergey Sharybin
2e128baefd Fix T39111: Boolean assert failure on widows
In fact we had this change a while ago, not sue what happened.
2014-03-12 23:12:34 +06:00
Jens Verwiebe
d0ad48fdc9 OSX/bullet: i have to use -O0 again, else weird bullet behaviour comes back.
I overlooked in cmake my fix same time changed the optimization level to 0,
so not use optimization is the real fix ( postponed for after 2.70 ).
I appears we should investigate scons anyway: compileflags does not apply to c and c++ same time as expected.
2014-03-12 13:04:31 +01:00
Sergey Sharybin
de86b7097f Fix T39104: 2 clothes on a collision object cause crash
This was caused by static variables used in plNearestPoints().

For now solved by making the solvers allocated in the stack,
seems no noticeable affect on the simulation speed so far.
2014-03-12 14:48:47 +06:00
Jens Verwiebe
09b2531bb3 OSX/bullet: add -O2 to bt_cxx_flags, in cmake thats default, in scons CXXFLAGS start empty also in “Release” 2014-03-11 18:32:22 +01:00
Campbell Barton
6e9ee13de0 CMake: add fastmath for gcc release flags (OSX had already) 2014-03-12 03:39:12 +11:00
Jens Verwiebe
4e3f27032e OSX/bullet: do a last fix for scons. Now in both buildsystems the used flags are in sync for OSX 2014-03-11 17:34:31 +01:00
Jens Verwiebe
ce37400c0b OSX/cmake: tentative fix for T38746, conflictting flags somewhere 2014-03-11 15:56:50 +01:00
Jens Verwiebe
558fa43ffd OSX/bullet: Truely fix T38746 now, compile flags where not propagated right,
also remove gcc 4.6 workaround, i don’t think its needed any longer.
!!! pls check if this would be right thing todo for othere OS too !!!
2014-03-11 13:27:06 +01:00
Jens Verwiebe
ac0cdec90f OSX/clang3.4: tentative fix for T38746, strange bullet behaviour 2014-03-10 18:09:53 +01:00
Sergey Sharybin
a659d73b1d Added back code which was commented out for debug reasons
Also added a patchset for Carve's memory leak fix.
2014-03-05 14:52:00 +06:00
Sergey Sharybin
ef40e889ca Fix compilation error windows 2014-03-04 20:37:19 +06:00
Sergey Sharybin
34c7fd1a11 Fix T38918: Boolean modifier crashes when using specific topology
There were loads of issues in the code still which are mow likely fixed:

- Hole resolver hook had memory leak -- it didn't free face with holes
  when triangulating it.

- Original edge mapping didn't work correct. old code related on the fact
  that loop order is not changing when constructing the MeshSet class, but
  in fact it does change.

  Currently used edge map for this because it was easiest way to do it now,
  but after the release we're to change it. Main reason is that face mapping
  is not correct as well (and it was never correct actually). So we'll need
  to construct Mesh structures by our own to be sure we're using correct
  original index mapping.

- Carve might produce faces with ears, which is forbidden in Blender.
  it wasn't an issue in old integration because triangulation will remove
  the ears. So for now simply added ears removing back as a hook.

  But actual reason of the ears is to be investigated really.

  This hook will only work for NGons, quads are assumed not be able to
  have ears. So this additional hook shouldn't slow down things much.

- Carve's hole resolver produces duplicated faces in some cases. Still not
  sure what is the reason of this. Code here is not so much straightforward,
  this is to be investigated later.

  For now solved the issue as own hole resolver which checks for duplicated
  faces after the hole resolving.

  The additional checks here will only run if the mesh actually have hole
  and wouldn't introduce slowdown for faces which doesn't have holes.

- Made it so if edge user triangulation gets a split (for example, in cases
  when this edge intersects with the second operand) it wouldn't be dissolved.

  This prevents cases of crappy topology after dissolving in several cases.

- Edge dissolver didn't check for whether edge is a non-manifold. We couldn't
  really dissolve open manifold edges.

  The bad thing about this is that mesh triangulation might produce non-manifold
  edges and they wouldn't be dissolved. Not worst case in the world, but would
  be nice to have it solved somehow.

- Exporting mesh form Carve to Blender might have produced duplicated edges
  in cases when several non-manifold faces shared the edge. This is also fixed
  now.

- Mesh triangulation might have produced duplicated faces, which is really bad.
  Fixed by keeping a track on which faces we've created and skipping adding new
  triangle if we already have one.

This all might introduce some slowdown, but we're too close to the release now,
so would rather have it slower but robust. After the release we might look into
ways to speed things up.
2014-03-04 20:18:16 +06:00
Sergey Sharybin
6e970e1a33 Update patch for mesh_simplifier 2014-02-28 19:09:22 +06:00
Sergey Sharybin
8badec14f9 Implement separate BA step for tracks which have constant zero weight
This is needed to minimize their reprojection error over the footage.
Without this extra step positions of such tracks were calculated by
algebraic intersection code only, which doesn't give best precision.
2014-02-27 16:14:35 +06:00
Sergey Sharybin
00acb98436 Fix T38844: Crash if weight track = 0
Avoid zero-sized problem when doing euclidean intersection

Zero-sized problem might occur when intersecting track with
constant zero weight. For such tracks we'll just use result
of algebraic intersection.

TODO: We probably need to have a separate BA step to adjust
positions of tracks with constant zero weight.
2014-02-27 14:31:09 +06:00
Sergey Sharybin
8a5221750e Ignore zero weighted markers in keyframe selection
It doesn't make sense to use zero-weighted tracks as a correspondences
in keyframe selection.

Such tracks are not guaranteed to be tracked accurately because their
purpose is to add reference points in 3D space without affecting the
solution.
2014-02-26 17:56:10 +06:00
Sergey Sharybin
dbf653acb7 Disable eager-refinement step of region tracking
This gives much worse results on mango footage (see 04_2e)
so disabling for now for until proper prediction model is landed.

The thing is, currently blender sends input coordinates as the guess to
region tracker and in case of fast motion such an early out ruins the track.
2014-02-25 16:55:24 +06:00
Tamito Kajiyama
036d35dd24 Fix for MSVC 2008 compiler errors. 2014-02-25 01:16:52 +09:00
Sergey Sharybin
cefa733803 Followup for 90a86fe: libmv/ceres cmake/scons files are automatically generated
So don't forget to update generator scripts as well.
2014-02-24 20:13:33 +06:00
Sergey Sharybin
9643b2e5b5 Preserve non-flat faces in boolean modifier
This commit implements dissolving of edges which were used
to triangulate non-flat faces. This slows things down a bit
(around 5% on heave mesh with all faces triangulated).

We could improve speed of dissolve a bit here (so not a bell
to add an option for triangulation yet).

Also fixed wrong edge origindex mapping.
2014-02-24 18:10:33 +06:00
90a86fecee Fix T38684: cmake OS X build problem when changing deployment target.
Don't cache these variables as they are not cleared on such changes.
2014-02-18 19:38:43 +01:00
Sergey Sharybin
97b90d89f4 Fix T38637: Boolean produces faces with holes which isn't supported by BMesh
Simple fix -- use CarveHoleResolver hook for CSG which will split faces
containing holes.
2014-02-18 11:53:04 +06:00
Sergey Sharybin
7fb7ce789f Fix T38631: Blender crashes when selection faces after new boolean modifier
Own mistake in edges carve->blender export, didn't count them correct.
2014-02-14 14:26:26 +06:00
Jens Verwiebe
9185ab5d9c Fix scons compiling after carve changes 2014-02-13 23:21:13 +01:00
Sergey Sharybin
6a65161966 fixed an for loop variable type and delete operator in cave-utils.cc
Patch by wutzi (Benedikt Bergenthal), thanks!

Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D314
2014-02-13 20:09:51 +06:00
Sergey Sharybin
83617d24d5 Rework carve integration into boolean modifier
Goal of this commit is to support NGons for boolean modifier
(currently mesh is being tessellated before performing boolean
operation) and also solve the limitation of loosing edge custom
data layers after boolean operation is performed.

Main idea is to make it so boolean modifier uses Carve library
directly via it's C-API, avoiding BSP intermediate level which
was doubling amount of memory needed for the operation and which
also used quite reasonable amount of overhead time.

Perhaps memory usage and CPU usage are the same after all the
features are implemented but we've got support now:

- ORIGINDEX for all the geometry
- Interpolation of edge custom data (seams, crease)
- NGons support

Triangulation rule is changed now as well, so now non-flat
polygons are not being merged back after Carve work. This is
so because it's not so trivial to support for NGons and
having different behavior for quads and NGons is even more
creepy.

Reviewers: lukastoenne, campbellbarton

Differential Revision: https://developer.blender.org/D274
2014-02-13 17:16:53 +06:00
Sergey Sharybin
5cbddd4ca4 Bye-bye FAST!
FAST detector has been replaced with fancier Harris,
so no need to keep FAST library in the sources now.
2014-02-06 18:13:12 +06:00
Sergey Sharybin
9896508e14 Fix compilation error with msvc2012 and 2013 as well 2014-01-31 15:33:48 +06:00
Sergey Sharybin
df471369e2 Bundle latest Libmv from upstream
Currently no functional changes, but we might want
to have scoped_array in the future.
2014-01-28 18:36:32 +06:00
Sergey Sharybin
be6643b5ec Followup to the previous commit
Need to take weight into account when drawing per-frame track
reprojection curve and when computing per-track average error.
2014-01-28 18:02:22 +06:00
Sergey Sharybin
59d1387c41 Improvements to weighted tracks behavior
First thing changed by this commit is making it so
Euclidean intersection takes track weight into account
when solving minimization problem. This behaves the
same exact way as it is for BA step.

Second thing is related on how average reprojection error
is being calculated. It didn't take track weight into
account which could confuse users. Now average reprojection
error will give the same result as intersection/BA uses
during minimization which gives much more predictable
behavior.

Differential Revision: https://developer.blender.org/D265
2014-01-28 17:25:47 +06:00
Sergey Sharybin
1c0cdc385f Fixes for keyframe selection
Using tracks with constant zero weight used to crash
keyframe selection since it was trying to use missing
parameter blocks for Jacobian evaluation,

Also fixed possible issues with wrong camera block being
marked as variable. This could technically happen when
having zero weighted tracks. Made it so all camera blocks
are marked as variable for now.
2014-01-28 16:54:50 +06:00
Sergey Sharybin
9178dc9d38 Rework detector API and implement Harris detector
Switch the detector API to a single function which accepts
a float image and detector options. This makes usage of
feature detection more unified across different algorithms.

Options structure is pretty much straightforward and contains
detector to be used and all the detector-specific settings.

Also implemented Harris feature detection algorithm which
is not as fast as FAST one but is expected to detect more
robust feature points. It is also likely that less features
are detected, but better quality than quantity.

Blender will now use Harris detector by default, later we'll
remove FAST detector.
2014-01-28 15:37:19 +06:00
Sergey Sharybin
3d408e10a4 Correct typo in the patch file as well 2014-01-28 02:16:44 +06:00
Thomas Dinges
8870556def Fix compilation on Windows, syntax error. 2014-01-27 20:53:42 +01:00
Sergey Sharybin
efaadc3104 Attempt to fix compilation error with MSVC-2008 2014-01-28 01:37:41 +06:00
Sergey Sharybin
31d679b667 Update Carve to latest update
Fixes some issues with NaN vertices in special cases.
Also adds edge interpolation routines which are currently
unused but which are requires to implement edge CD interpolation.
2014-01-27 17:04:06 +06:00
Sergey Sharybin
ef67b9eec4 Ceres: more warnings cleanup 2014-01-14 01:18:09 +06:00
Sergey Sharybin
a6ceb4a498 Re-bundle new Ceres library
- Fixes some harmless issues (in cases blender doesn't use Ceres yet)
- Fixes some compilation warnings
2014-01-13 19:17:28 +06:00
Sergey Sharybin
113ff51476 Compilation error fix for NetBSD
Based on the patch from Joerg Sonnenberger.
2014-01-09 16:15:24 +06:00
Sergey Sharybin
2d8545f87e Fix compilation error on NetBSD
Original patch is by Jeorg Sonnenberger, thanks!
2014-01-09 16:03:02 +06:00
Sergey Sharybin
f9353b8e8d Code cleanup: remove patch series from libmv
Since we're using own libmv branch from git.blender.org
we don't need to have local patches for libmv in blender
source tree.
2014-01-02 15:24:46 +06:00
Sergey Sharybin
f9e0ac4ced Code and style cleanup
Mainly fixed some style warnings reported by cpplint.

Also changed how camera (un)distortion happens internally
by replacing number of channels as a template argument
with number as channels passing as function argument.
Makes code easier to follow by eliminating loads checks
how much channels are used and which argument to pass to
the template.
2014-01-02 15:24:46 +06:00
Sergey Sharybin
5d701c6d25 Re-bundle libmv from new upstream repository
No functional changes, just to make sure all the patches
are ported nicely and that update scripts works fine.
2014-01-01 22:32:48 +06:00
Sergey Sharybin
5933b2455c Update Ceres to the latest upstream
Summary:
This brings up much easier termination type usage,
which for us means we might use:

  ceres::Summary::IsSolutionUsable()

instead of doing manual funky enum values check.

Reviewers: keir

Differential Revision: https://developer.blender.org/D153
2014-01-01 22:32:47 +06:00
Sergej Reich
05eebf49d3 Bullet: Update to svn r2719
Fixes part of T37905, fixed constraint didn't work correctly.
2013-12-26 12:45:57 +01:00
Campbell Barton
a7ac6481ef CMake: report messages as status (else ccmake treats like an error) 2013-12-10 13:18:46 +11:00
Alexandr Kuznetsov
e2429d6492 Woo Hoo. First git commit.
Changes for VC2013

Now, I can build Blender with VC2013 with Cycles, Collada, OpenExr,OpenImageIO disabled. Also, you need VC2008 sp1 installed to make old libs compatible.
2013-11-29 15:13:12 -05:00
Sergey Sharybin
28a2d5e264 Code cleanup: spelling fixes and verbosity prints 2013-11-29 01:46:08 +06:00
Sergey Sharybin
b7bca8663a Made collections port compatible with MSVC2008
The issue was caused by the fact that in this version
of MSVC unordered_map class is defined in <unordered_map>
header file, but this file declares the class int std::tr1
namespace.

This confused existing assumption that if there's an
existing <unordered_map> file then class is declared
in std namespace.

Added an extra check to CMake which detects whether
it's std or std::tr1 which actually contains class
of unordered_map.

This might be changed/cleaned in the future, for
now committing to our repository to solve compilation
error on windows.

Details of the patch in upstream can be found there:

  https://ceres-solver-review.googlesource.com/#/c/4371/
2013-11-28 23:28:11 +06:00
Sergey Sharybin
de6c1c9287 Update Ceres to latest upstream version
- A richer Problem API.
- DynamicNumericDiffCostFunction.
- Faster ITERATIVE_SCHUR solver.
- Faster SCHUR_JACOBI preconditioner.
- Faster Jacobian evaluation.
- Faster visibility based preconditioning using single linkage clustering.

Also re-wrote rules for unordered collections detection,
should work on all platforms and compilers now :)
2013-11-28 19:46:23 +06:00
Sergey Sharybin
dc71cb5f6e Fix Carve compilation on FreeBSD
Based on the patch from Marcus von Appen, thanks!
2013-11-28 14:00:10 +06:00
Sergey Sharybin
a628ca9ebe Update Carve to upstream version be054bc7ed86 2013-11-28 14:00:10 +06:00
Sergey Sharybin
1c14ead46f Carve bundler script cleanup
- random.hpp was only removed from actual include
  directory, but not from patches/files.

- Files list generator didn't ignore config.h file
  which in fact is not needed.
2013-11-28 14:00:10 +06:00
Sergey Sharybin
1de23f6c0d Tweaks and improvements to fundamental/homography estimation
- A bit more reasonable name for the estimation option
  structure and estimation functions.

- Get rid of unclear function and parameter tolerance,
  it wasn't clear at all in which units they are.

  Now we've got expected_average_symmetric_distance as
  an early output check and as soon as average symmetric
  error goes below this threshold refining finishes.

  This distance is measured in the same units as input
  points are.

  It is arguable whether we need callback for this or not,
  but seems Ceres doesn't have some kind of absolute
  threshold for function value and function_tolerance
  behaves different from logic behind expected symmetric
  error.

- Added option to normalize correspondences before
  estimating the homography in order to increase estimation
  stability. See

    R. Hartley and A. Zisserman. Multiple View Geometry in Computer
    Vision. Cambridge University Press, second edition, 2003.

    https://www.cs.ubc.ca/grads/resources/thesis/May09/Dubrofsky_Elan.pdf
2013-11-20 15:30:28 +06:00
Campbell Barton
cf9edb2610 rangetree: support for building on freebsd-10 2013-11-16 18:31:13 +11:00
Jens Verwiebe
a3ec6edc05 OSX/scons: make MACOSX_SDK_CHECK a local var is sconstruct and remove from env, also fix a longstanding misuse of MACOSX_SDK_CHECK in ceres, use MACOSX_SDK instead 2013-11-08 13:44:10 +00:00
Sergej Reich
13caf5cc14 bullet: Remove patch applied upstream 2013-11-04 17:02:01 +00:00
Keir Mierle
427844c28d Eagerly attempt to refine a track before doing a brute search
Before the refinement phase of tracking, a brute force SAD search
is run across the search area. This works well but is slow;
especially if the guess for the track's location is accurate.

This patch runs a refinement phase before running a brute force
search, hoping that the guessed position (in x2, y2) is close to
the best answer. If it is, then no brute search is done. If it is
not, then a normal brute force search followed by refinement is
done.

In some cases this may produce worse tracks than before; the
regressions will need investigation. The predictive motion model
(to be implemented) will reduce the probability of that happening.
2013-10-29 01:06:50 +00:00
Keir Mierle
d10abe6d4d Fix bug where libmv tracking incorrectly succeeds on failure
Before this patch, if Ceres returned USER_SUCCESS indicating that
Ceres was only changing the tracked quad slightly between
iterations (indicating convergence), no final correlation check
was done. This leads to incorrectly returning that the tracking
was successful, when it actually failed.
2013-10-28 18:34:19 +00:00
Sergey Sharybin
9f32e83175 Weighted tracks
Added a weight slider to track which defines
how much particular track affects in a final
reconstruction. This weight is for sure
animateable.

Currently it affects on BA step only which in
most cases will work just fine.

The usecase of this slider is to have it set
to 1.0 most of the time where the track is
good, but blend it's weight down to 0 when
tracker looses the track. This will prevent
camera from jump.

Tutorial is to be done by Sebastian.
2013-10-26 13:22:38 +00:00
Sergej Reich
451b60f1a3 Fix building with scons
Can't actually test here so hope this is enough.
2013-10-25 03:56:17 +00:00
Sergej Reich
472a021aca bullet: Update to version 2.82 (bullet revision 2705)
Remove patch that has been applied upstream.

Fixes several bugs.
2013-10-25 03:43:20 +00:00
Sergey Sharybin
dc46febec8 Code cleanup: move function prototype to header file 2013-10-15 15:21:44 +00:00
Sergey Sharybin
eb69cb7de3 Get rid of Allow Fallback option
It was rather confusing from the user usage point
of view and didn't get so much improvement after
new bundle adjuster was added.

In the future we might want to switch resection
to PPnP algorithm, which could also might be a
nice alternative to fallback option.
2013-10-15 15:21:41 +00:00
Sergey Sharybin
36039be6b5 Libmv: make sure CmakeList.txt is re-created with all needed headers on re-bundle 2013-10-09 20:21:12 +00:00
Sergey Sharybin
b5491291e4 Libmv: move platform-specific defines into own file 2013-10-09 20:02:02 +00:00
Sergey Sharybin
ccd2e4375a Fix compilation error after recent libmv change
- Tweaked typedefs in stdint so they match
  what we've got in BLI_sys_types (needed to
  explicitly tell sign to MSVC).

  Not so much harmful to be more explicit here,
  but we really better to have single stdint
  int blender.

- Tweaked allocations macros so MSVC is happy
  with structures allocation.
2013-10-09 19:49:09 +00:00
Sergey Sharybin
49bc310671 Move guarded objetc allocation to a guardedalloc header
Also made libmv-capi use guarded objetc allocation.
Run into some suspecious cases when it was not so
clear whether memory is being freed or not.

Now we'll know for sure whether there're leaks or not :)

Having this macros in a guardedalloc header helps
using them in other areas (for now it's OCIO and libmv,
but in the future it'll be more places).
2013-10-09 08:46:02 +00:00
Sergey Sharybin
724b015da2 libmv: fix matrix address being printed instead of actual values 2013-10-02 10:18:43 +00:00
Sergey Sharybin
3169e96ae2 Optimization for recent changes in keyframe selection 2013-10-01 14:55:34 +00:00
Sergey Sharybin
404274040b Fix issues according to codereview page
Mainly just a comment cleanups.
2013-10-01 11:15:24 +00:00
Sergey Sharybin
2ddbb5d1e1 Fix for plane track jittering
Jittering was caused by homography not being estimated
accurate enough.

Before this, only algebraic estimation was used, which
is indeed not so much great, Now use algebraic estimation
followed with refinement step using Ceres minimizer.

The code was already there since keyframe selection patch,
made such estimation a generic function in multiview/ and
changed API for estimation in order to pass all additional
options via an options structure (the same way as it's
done fr Ceres).

This includes changes to both homography and fundamental
estimation.

TODO:
- Need to document Ceres functors better.
- Need to support homogeneous coordinates (currently
  only euclidean coords are supported).
2013-09-30 09:35:04 +00:00
Joseph Mansfield
7114ab18a2 Code cleanup: spelling correction 2013-09-14 10:22:56 +00:00
Campbell Barton
29cbf93b07 correct error in libmv stub, also correct typo. 2013-09-13 03:49:11 +00:00
Jens Verwiebe
990e361a2c OSX/clang5: revert 59960, todo: make it global 2013-09-09 16:24:23 +00:00
Jens Verwiebe
0dfc9b1f00 OSX/clang5: fix broken compiling 2013-09-09 15:45:09 +00:00
Joseph Mansfield
9707bdfe75 Code cleanup: Minor function capitalization fix 2013-09-09 00:06:23 +00:00
Sergey Sharybin
4228463caa Update Ceres to 1.7.0 release
For Blender this release is interesting because of:

- Covariance estimation (not used in Blender yet, but now we
  might use it for keyframe selection instead of havingown
  implementation).

- Significant performance improvements to loss function and
  dense linear solvers and automatic differentiation.

  Unfortunately, didn't notice speedup of tracking itself,
  but camera reconstruction now happens around 2 times faster
  on my laptop,

- Better inner iteration step acceptance and stopping.
2013-09-05 10:48:44 +00:00
Sergey Sharybin
08c49d8a12 Use reentrant qsort() in particle codes
Particle system code used global variable to sort hair by orig index,
which is not safe for threading at all.

Replaced this with usage of reentrant version of qsort, which is
now implemented in BLI. It was moved from recast navigation code
to BLI, so more areas could use it (if needed).

--
svn merge -r59086:59087 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:40:47 +00:00
Thomas Dinges
d75e14b31e * Compile fix, so disabling libmw works again. 2013-08-16 12:43:37 +00:00
Sergey Sharybin
24ce60cfe4 Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.

Movie clip editor changes:

- Artist might create a plane track out of multiple point
  tracks which belongs to the same track (minimum amount of
  point tracks is 4, maximum is not actually limited).

  When new plane track is added, it's getting "tracked"
  across all point tracks, which makes it stick to the same
  plane point tracks belong to.

- After plane track was added, it need to be manually adjusted
  in a way it covers feature one might to mask/replace.

  General transform tools (G, R, S) or sliding corners with
  a mouse could be sued for this. Plane corner which
  corresponds to left bottom image corner has got X/Y axis
  on it (red is for X axis, green for Y).

- Re-adjusting plane corners makes plane to be "re-tracked"
  for the frames sequence between current frame and next
  and previous keyframes.

- Kayframes might be removed from the plane, using Shit-X
  (Marker Delete) operator. However, currently manual
  re-adjustment or "re-track" trigger is needed.

Compositor changes:

- Added new node called Plane Track Deform.

- User selects which plane track to use (for this he need
  to select movie clip datablock, object and track names).

- Node gets an image input, which need to be warped into
  the plane.

- Node outputs:
  * Input image warped into the plane.
  * Plane, rasterized to a mask.

Masking changes:

- Mask points might be parented to a plane track, which
  makes this point deforming in a way as if it belongs
  to the tracked plane.

Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578

This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
Sergey Sharybin
cab2aef71a Add Procrustes PNP ("PPnP") resection algorithm to libmv
This adds a new Euclidean resection method, used to create the
initial reconstruction in the motion tracker, to libmv. The method
is based on the Procrustes PNP algorithm (aka "PPnP"). Currently
the algorithm is not connected with the motion tracker, but it
will be eventually since it supports initialization.

Having an initial guess when doing resection is important for
ambiguous cases where potentially the user could offer extra
guidance to the solver, in the form of "this point is in front of
that point".

--
svn merge -r58821:58822 ^/branches/soc-2011-tomato
2013-08-16 08:26:34 +00:00
Sergey Sharybin
43c21e91e1 Fix for uninitialized covariance matrix
This is likely a culptrit caused #36231: Motion tracker bug in 2.68
2013-08-14 05:30:35 +00:00
Sergey Sharybin
7eeaefb97c Potential fix for wrogn k3 value after solve 2013-08-01 16:34:55 +00:00
Joseph Mansfield
c15ae082bb Code cleanup: libmv C API
Clean up inconsistencies in the libmv C API:
- All type identifiers are libmv_TypeName
- All function identifiers libmv_functionName
- Prefer libmv_nounVerb function names (e.g. libmv_featuresDestroy)
- Match Blender code formatting rather than Google
- Spelling corrections

Code review: https://codereview.appspot.com/11494044/
2013-07-31 13:48:12 +00:00
Peter Schlaile
1c2ff55334 == libredcode / licence cleanup ==
Changed libredcode to GNU GPL v2 or later to make it more compatible
with additional libraries added to blender.
2013-07-14 20:38:55 +00:00
Sergey Sharybin
f32615653b Update libmv from own branch
Fixes compilation error on win32 and shall give few
cpu ticks boost by passing vectors by reference rather
than by value.
2013-06-01 10:30:46 +00:00
Sergey Sharybin
719c2f8163 Fixed compilation error after recent keyframes commit. 2013-05-30 12:05:28 +00:00
Sergey Sharybin
c5b4983eca Remove files unused by blender's tracker
They were giving compilation error with msvc2012,
and instead of having workaround in them let's
drop them away form blender (they're not used even).
2013-05-30 12:05:20 +00:00
Sergey Sharybin
cf5e979fb4 Motion tracking: automatic keyframe selection
Implements an automatic keyframe selection algorithm which uses
couple of approaches to find out best keyframes candidates:

- First, slightly modifier Pollefeys's criteria is used, which
  limits correspondence ration from 80% to 100%. This allows to
  reject keyframe candidate early without doing heavy math in
  cases there're not much common features with first keyframe.

- Second step is based on Geometric Robust Information Criteria
  (aka GRIC), which checks whether features motion between
  candidate keyframes is better defined by homography or
  fundamental matrices.

  To be a good keyframe candidate, fundamental matrix need to
  define motion better than homography (in this case F-GRIC will
  be smaller than H-GRIC).

  This two criteria are well described in this paper:
  http://www.cs.ait.ac.th/~mdailey/papers/Tahir-KeyFrame.pdf

- Final step is based on estimating reconstruction error of
  a full-scene solution using candidate keyframes. This part
  is based on the following paper:

  ftp://ftp.tnt.uni-hannover.de/pub/papers/2004/ECCV2004-TTHBAW.pdf

  This step requires reconstruction using candidate keyframes
  and obtaining covariance matrix of 3D points positions.
  Reconstruction was done pretty much straightforward using
  other simple pipeline routines, and for covariance estimation
  pseudo-inverse of Hessian is used, which is in this case
  (J^T * J)+, where + denotes pseudo-inverse.

  Jacobian matrix is estimating using Ceres evaluate API.

  This is also crucial to get rid of possible gauge ambiguity,
  which is in our case made by zero-ing 7 (by gauge freedoms
  number) eigen values in pseudo-inverse.

  There're still room for improving and optimizing the code,
  but we need some point to start with anyway :)

  Thanks to Keir Mierle and Sameer Agarwal who assisted a lot
  to make this feature working.
2013-05-30 09:03:49 +00:00
Campbell Barton
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
Campbell Barton
8982439383 quiet warnings from r56825
- using vars before checking they are defined
- /* within comment
2013-05-16 03:55:47 +00:00
Jürgen Herrmann
8a89d27b87 Libmv internal compiler error workaround for VC2012.
Will be reverted as soon as the x64 compiler is fixed.
For now it shouldn't have an impact on tracking performance. My test have shown no significant speed difference to official VC2008 build of 2.67.
2013-05-15 17:00:53 +00:00
Campbell Barton
ff1a587e1c update libmv stub. 2013-05-14 03:06:58 +00:00
Sergey Sharybin
d4c6ac9a60 Cleanup and small improvements to libmv
- Added const modifiers where it makes sense and
  helps keep code safe.
- Reshuffled argument to match <inputs>,<outputs>
  convention on parameters.
- Pass values to ApplyRadialDistortionCameraIntrinsics
  by a constant reference.
  This will save lots of CPU ticks passing relatively
  heavy jet objects to this function when running
  bundle adjustment.
2013-05-13 14:39:06 +00:00
Sergey Sharybin
4e5541a9a6 Headers cleanup. 2013-05-13 09:51:36 +00:00
Sergey Sharybin
91b659d174 Forgot this in one of previous commits
Idea here is to be able to have all files opened in IDE
and not confuse it by the same function implemented in
multiple files.
2013-05-12 22:40:12 +00:00
Sergey Sharybin
4dba8307f2 Compilation fix for recent commit. 2013-05-12 22:30:34 +00:00
Sergey Sharybin
32faec1a53 Remplace bunch of annoying ifdefs in tracking.c with a libmv-capi_stub.cc
Makes code in tracking.cc much easier to understand and modify,
without worring to breck compulation with Libmv disabled.

It is still possible compilation will break due to libmv-capi
changes, but that's not happening so much often.
2013-05-12 22:17:37 +00:00
Sergey Sharybin
5637b0d39b Update bundled version of libmv
- Ensures fix for msvc2012 is applying correct.
- Some code cleanup to match libmv's code style.
- Do not include points which were intersect
  behind the camera to a reconstruction.
- Includes changes needed for keyframe selection.
2013-05-12 17:06:00 +00:00
Sergey Sharybin
beb73831f6 Documentation for functions inside tracking.c
Additional changes:

- Cleaned up sources to reduce mess in some
  big functions.
- Removed unused function from libmv c-api.
- Made functions naming more consistent.
- Use bool for internal stuff in tracking.c.

Shall be no functional changes :)
2013-05-12 16:04:08 +00:00
Brecht Van Lommel
309db8032c Fix libmv build with visual studio 2012.
Patch #35158 by Jurgen Herrmann.
2013-05-11 13:10:39 +00:00
Sergey Sharybin
2cf1f1f4d6 Left extra logging print by accident. 2013-05-10 07:26:55 +00:00
Sergey Sharybin
4648ec3e82 Remove check for zero focal length in BA cost functor
This check is actually redundant, because empty intrinsics
will have focal length of 1.0, which means original comment
about BundleIntrinsics was not truth.

It is possible that external user will send focal length of
zero to be refined, but blender prevents this from happening.
2013-05-10 06:48:47 +00:00
Sergey Sharybin
3a309a8313 Synchronize changes between bunded libmv and own libmv branch. 2013-05-10 06:26:01 +00:00
Sergey Sharybin
ed131e67c4 Add check for points behind camera in euclidan BA cost functor
In cases keyframes are no so good, algebraic two frames construction
could produce result, for which more aggressive Ceres-based BA code
will fall to a solution for which points goes behind the camera,
which is not so nice.

Seems in newer Ceres returning false from cost functor wouldn't
abort solution, but will restrict solver from moving points behind
the camera.

Works fine in own tests, but requires more tests.
2013-05-09 16:38:58 +00:00
Sergey Sharybin
4f5f97254c Reconstructed scene scale ambiguity improvement
Made it so reconstructed scene always scaled in a way
that variance of camera centers is unity.

This solves "issues" when different keyframes will
give the same reprojection error but will give scenes
with different.scale, which could easily have been
considered as a bad keyframe combination.

This change is essential for automatic keyframe
selection algorithm to work reliable for user.
2013-05-09 16:38:43 +00:00
Sergej Reich
424e8b69f1 bullet: Don't use sse in api for windows.
Remove stray BT_USE_SSE_IN_API definitions.
Was causing problems especially for 32 bit windows.

It's not quite clear why they were added in the first place since
this should be defined in btScalar.h, needs further investigation.

Thanks to Francisco De La Cruz (xercesblue) for looking into this.

Should fix [#35071] Bullet Convex Hull Crashes on Win32 with SSE
2013-05-06 22:53:11 +00:00
Sergej Reich
c80ff61d40 bullet: Fix avoiding collision response between static/kinematic objects
Sent patch upstream.

Fixes [#35115] Character physics type fails collision with static type with an action on 2.67 rc
2013-04-28 21:40:54 +00:00
Sergey Sharybin
d2f61b36f9 Revert 56319, misunderstood API
This was completely skipping BA step when point
goes behind the camera.
2013-04-26 18:25:49 +00:00
Sergey Sharybin
126ca24dbf Fix for BA possible move bundles behind the camera
In some cases (was noticed on not good enough keyframe
pair) bundle adjuster could have moved bundles behind
the camera.

This could indeed lead to lower rewprojection error but
this is just pointless thing to do.

Now added check to residuals functor which will return
false to Ceres in cases point moved behind the camera
to prevent such issues.
2013-04-26 15:43:20 +00:00
Sergey Sharybin
d05f5da111 Update Ceres to current upstream version
This brings a fixes for threading issue in BLAS
making BA step more robust (there were some in-detemrinacy
caused by this threading issue).

Also brings some optimizations, which does not directly
affect on blender.
2013-04-22 09:25:37 +00:00
Sergey Sharybin
79ca1bd004 Make it so FATAL messages from libmv are print to the console
even when --debug-libmv is not passed via command line.
2013-04-15 10:02:33 +00:00
Sergey Sharybin
8cca2fec82 Fix for bundle adjusting with motion restricted
This commit bundles new libmv version from own branch
which brings fix for wrong parameter block used for
modal solver parameterization.

Fixes #34985: Crash with Motion tracker (Tripod Motion)
2013-04-14 23:43:00 +00:00
Sergey Sharybin
d2b55d1171 Bundle adjustment improvements
- Get rid of rotation matrix parameterization,
  use angle-axis instead.

  Also Joined rotation and translation into a
  single parameter block.

  This made minimization go significantly faster,
  like 1.3x times in average.

- Fix first camera when bundling. This is to
  address orientation ambiguity.

  Reconstruction result could still vary in
  size, but that's another issue to be addressed
  later.

Additional change:

Split EuclideanBundleCommonIntrinsics into
smaller functions, so it's now a bit easier
to follow.
2013-04-08 17:05:52 +00:00
Sergey Sharybin
8e8823be12 Update ceres to current upstream version
Brings fixes for BLAS.
2013-04-08 17:05:48 +00:00
Sergey Sharybin
f62d2669de Revert change made to bilinear sampler in libmv
This made preview working but that broke internals
of tracking.

Namely, BlurredImageAndDerivativesChannels is giving
much more blurred image because it was assuming pixel
center is an integer position.

Guess other parts of libmv used to suffer because of
this issue.

Now pixel centering happens in blender side, and
libmv assumes integer position is a pixel center.
2013-04-06 14:47:45 +00:00
Sergey Sharybin
898ba93a12 Update libmv to current upstream version
- Solves some strict compilation warning
- Style/code cleanup
2013-04-05 09:23:20 +00:00
Sergey Sharybin
43b61fb8bd Bundle current master of ceres-solver
Thins brings up some speed improvements:

SPARSE_SCHUR is approx 1.3-1.5x times faster
ITERATIVE_SCHUR is approx 1.2x times faster

For blender this means camera solution go a bit
faster now. Would not have affect on tracking
speed.
2013-04-05 09:22:54 +00:00
Campbell Barton
1777a69818 misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
2013-03-29 06:25:22 +00:00
Sergey Sharybin
729b76eb79 Update ceres to current git version.
Mainly to support msvc2010, bit also includes some minor fixes.
2013-03-21 18:07:03 +00:00
Sergey Sharybin
8a7ce9c924 Fix #34707: Blender crash on enabling of boolean modifier
Stupid mistake by my own with recent Carve update which
undid fix for MSVC STL library.
2013-03-21 08:47:18 +00:00
Campbell Barton
3966722057 code cleanup: misc warnings/style 2013-03-21 02:58:21 +00:00
Sergey Sharybin
6dc4ea34e4 Multi-threaded frame calculation for movie clip proxies
This commit implements multi-threaded calculation of frames
when building proxies. Both scaling and undistortion steps
are now threaded.

Frames and proxy resolution are still handled one-by-one,
saving files after every single step. So if HDD is not so
fast, this commit could have not so much benefit.

Internal changes:

- Added IMB_scaleImBuf_threaded which scales given image
  buffer in multiple threads and uses bilinear filtering.

- libmv's camera intrinsics now have SetThreads() method
  which is used to specify how many OpenMP threads to use
  for buffer distortion/undistortion.

  And yeah, this code is using OpenMP for threading.

- Reshuffled a bit libmv-capi calls and added function
  BKE_tracking_distortion_set_threads to specify number
  of threads used by intrinscis.
2013-03-15 11:59:46 +00:00
Irie Shinsuke
5792e77239 Patch [#34373] Use i18n monospace font in Text editor and Python console
This patch allows Blender to display i18n monospace font in the text
editor and the Python interactive console. Wide characters that occupy
multiple columns such as CJK characters can be displayed correctly.
Furthermore, wrapping, selection, suggestion, cursor drawing, and
syntax highlighting should work.

Also fixes a bug [#34543]: In Text Editor false color in comment on cyrillic

To estimate how many columns each character occupies, this patch uses
wcwidth.c written by Markus Kuhn and distributed under MIT-style license:

  http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

wcwidth.c is stored in extern/wcwidth and used as a static library.

This patch adds new API to blenfont, blenlib and blenkernel:

BLF_get_unifont_mono()
BLF_free_unifont_mono()
BLF_draw_mono()
BLI_wcwidth()
BLI_wcswidth()
BLI_str_utf8_char_width()
BLI_str_utf8_char_width_safe()
txt_utf8_offset_to_column()
txt_utf8_column_to_offset()
2013-03-12 07:25:53 +00:00
Jens Verwiebe
373de9e936 OSX/gcc-4.6: workaround a compilerbug, use apple-gcc instead 2013-03-07 22:12:23 +00:00
Sergej Reich
643b0be4cb bullet: Update to current svn, r2636
Apply patches in patches directory, remove patches that were applied
upstream.
If you made changes without adding a patch, please check.

Fixes [#32233] exporting bullet format results in corrupt files.
2013-03-07 17:53:16 +00:00
Sergey Sharybin
f81b594790 Switch from DENSE_NORMAL_CHOLESKY to DENSE_QR
DENSE_QR is better behaved numerically and after recent
changes from Sameer there's no big difference in speed.
2013-03-05 09:38:50 +00:00
Sergey Sharybin
3a0d62f4f4 Update Ceres to 1.5RC3
It brings optimization of DENSE_QR and DENSE_SCHUR solvers.
2013-03-05 09:38:43 +00:00
Sergey Sharybin
9da36d3ab1 Updates to libmv's bundle.sh to make sure libmv upstream
is copying properly to our sources.
2013-03-01 11:52:38 +00:00
Sergey Sharybin
1a7ab1da09 Hrm, gcc became broken after recent commit.
Hope now gcc and 32bit msvc would both work.
2013-03-01 08:56:04 +00:00
Sergey Sharybin
a2027237ed Pass data to modal reprojection cost functor by reference
Seems it solves alignment error reported by 32bit MSVC.
2013-03-01 08:20:13 +00:00