diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-01-10 17:08:59 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-01-10 17:08:59 +0300 |
commit | 622a65a297b82f6f63baff124f42e02a8f6ef29c (patch) | |
tree | f0a0fe4f5c7e53100e9b7979fdaa8dfd7c671803 /source/blender/freestyle/intern/blender_interface | |
parent | 05603fa110e4e40a12db8d97789f8a56e62aa3f7 (diff) |
Fixed a bug in SilhouetteGeomEngine::ImageToWorldParameter() that caused
instability issues regarding the view map creation. A new iterative
solver of the 2D-to-3D inverse projection transformation problem was
implemented. Instead of directly solving the problem in the direction
from the 2D to 3D space, the new solver starts with an initial guess of
an approximated solution and asymptotically approaches to the true
solution by iteratively performing the forward 3D-to-2D projection
transformation and improving the approximation. Preliminary tests with
one simple and another complex scenes showed that the solver converges
quickly (more and less 20 iterations in many cases, with a stopping
criterion of a residual distance between the true and approximated
solutions less than 1e-6 Blender Unit).
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface')
3 files changed, 28 insertions, 7 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 114dd1bc7e2..6efa80431fc 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -21,8 +21,20 @@ NodeGroup* BlenderFileLoader::Load() cout << "\n=== Importing triangular meshes into Blender ===" << endl; - // creation of the scene root node - _Scene = new NodeGroup; + // creation of the scene root node + _Scene = new NodeGroup; + + _viewplane_left= _re->viewplane.xmin; + _viewplane_right= _re->viewplane.xmax; + _viewplane_bottom= _re->viewplane.ymin; + _viewplane_top= _re->viewplane.ymax; + _z_near= _re->clipsta; + _z_far= _re->clipend; +#if 0 + cout << "frustrum: l " << _viewplane_left << " r " << _viewplane_right + << " b " << _viewplane_bottom << " t " << _viewplane_top + << " n " << _z_near << " f " << _z_far << endl; +#endif int id = 0; for(obi= (ObjectInstanceRen *) _re->instancetable.first; obi; obi=obi->next) { @@ -37,8 +49,8 @@ NodeGroup* BlenderFileLoader::Load() cout << " Sorry, only vlak-based shapes are supported." << endl; } - //Returns the built scene. - return _Scene; + //Returns the built scene. + return _Scene; } void BlenderFileLoader::insertShapeNode(ObjectRen *obr, int id) diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index 8068eaf1bcf..29acbfc203f 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -55,9 +55,14 @@ protected: protected: Render* _re; SceneRenderLayer* _srl; - NodeGroup* _Scene; - unsigned _numFacesRead; - real _minEdgeSize; + NodeGroup* _Scene; + unsigned _numFacesRead; + real _minEdgeSize; + float _viewplane_left; + float _viewplane_right; + float _viewplane_bottom; + float _viewplane_top; + float _z_near, _z_far; }; #endif // BLENDER_FILE_LOADER_H diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 393cd1b2dd9..4ef3abe54d8 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -19,6 +19,7 @@ extern "C" { #include "BKE_main.h" #include "BLI_blenlib.h" +#include "BLI_math.h" #include "BPY_extern.h" #include "renderpipeline.h" @@ -106,6 +107,9 @@ extern "C" { for( int i = 0; i < 4; i++ ) for( int j = 0; j < 4; j++ ) freestyle_proj[i][j] = re->winmat[i][j]; + + //print_m4("mv", freestyle_mv); + //print_m4("proj", freestyle_proj); } |