Tuesday, May 3, 2011

Current Progress: All Debugged! Let's Start The Report!

After a whole day's effort, not only have we modified the constructor in the situation where segments of silhouettes are exactly horizontal or vertical, but we have extended it to three silhouettes' intersection as well! So now we believe all kinds of shape could be done using our plugin proficiently. Come on man, let's do a beautiful demo and perfect report!

One conclusion of this step is that we have to make a tolerance threshold for line segments intersection in the intersection condition test to allow error(in the function Silhouette::SpecialProjection()).

Cheers!

Current Progress: Adding One More Function

We are now adding one more function for a special situation: when some segments of both silhouettes are exactly horizontal or vertical, the plugin cannot construct some facets because there is no plane that both of the facets can be projected to. So we have to design a separate algorithm for this situation.

One tricky bug is the value of sizeof().
The return type is unsigned, so 0 - 1 will be pow(2, 32) - 1, but not -1.
Instead of using i < ( vector.sizeof() - 1 ), we should use i + 1 < vector.size()

Cheers

Saturday, April 30, 2011

Current Progress: Modified Point Array

We have just modified the Point Array of the output mesh.

So now, all of the vertices of different facets at the same position will be represented by one single point in Maya. Instead of creating separate facets, we have now generated a closed model with all of its facets merged initially.

Oh yes, one bug that we were struggling with was the value of the first argument in meshFS.create(), it should be the number of vertices, but not size of FaceConnects.

Cheers!

Friday, April 29, 2011

Current Progress: Poster done and a few flaws remain

So in the past week, we made several models with our plugin successfully, including the China Pavilion on World Expo Shanghai 2010, a gun and also some random shapes. These examples showed the eligibility of our work to model 3D objects from 2D silhouettes, as well as the ability of real time user interaction. We will show the screen shots by the end of the report.

However, we have also found some new bugs, which are generally related to the combination with Maya operations. We voided the uniqueness of each vertex, but append each vertex to the PointArray even it has existed, i.e. it has the same position with one of the appended vertices in the PointArray. In doing so Maya cannot merge the meshes correctly. It is so implicit that we can not identify the problem merely from unsmoothed polygons. However, if we try to smooth the mesh using Maya MEL, we will get wired output. Normals are also not always right in real time user interaction. Although we can modify the normal using MEL, we think it is best for us to adjust the order of vertices to get it correct.

That is our goal in the following week.

China Pavilion on World Expo Shanghai 2010

Gun Model, all of its components are made using our plugin

Submachine Gun, from the above gun model using our user interaction 
Cheers!

Friday, April 22, 2011

Nearly All!

Haha so we have also modified the 3rd silhouette!

This time, we produced models that matched the silhouettes perfectly!
And also, compared with Maya Boolean, we can see that our mesh is even cleaner and better!

Take a look at our composition!
;)


So the meshed model with green outline is generated by our algorithm from the three silhouettes(blue), and the the white model is generated my Maya Boolean, see which is better.

Carry on! Let's get more!

Cheers!

Bug Done! Though another appeared~

So We have fixed the trivial facet bug by modifying the results of 2D boolean operation!

Here we go:

You see, the annoying triangle is gone!

However, another bug is founded in triple silhouette cylinder intersection, let's sweep it away!

Cheers

Debugging

So there is a bug that two polygons might be connected during boolean computation.

As shown below


The triangle between the feet of the mesh is not expected. Have been working on it for a while, I think we will figure it out soon!

Cheers!

Thursday, April 21, 2011

Construction using 3 Silhouettes!

So we've got further towards our final goal!
We have extended the construction of CSG from 2 silhouettes to 3!
In this step, for each cylinder's facet, we intersect it with the other silhouettes' cross shape polygon, and in doing so create the mesh for the final 3D model.


Construction from 3 silhouettes
Cheers!

Wednesday, April 20, 2011

Right Output!

Good News!

We have just debugged a flaw and created the right mesh!

So the bug lied in the function which converts 2D projections to 3D facets:
It should follow the formula of
Ax + By + Cz + D = 0
But when solving x, y and z, for example, x, it was incorrectly calculated as
x = ( D - By - Cz ) / A, where a (-1) is missing before D.

Alright, just some posters, and let's make it better!

Front Silhouette

Top Silhouette

Output Wire Frame

Output Shaded Mesh

Meshes

More complex model


Cheers!

First Output!

 So now we got our first output after combining the Maya API and C++ algorithm!
The First Output Is TOTALLY Wrong!
But happy about that, at least we can see it can be better.
Carry it on and figure it out!

Cheers!

Bugs Eliminated!

Hey God, we swept out the bug! It is only the difference between float and double, but cost me four days or longer to eliminate it! Don't know whether we should be happy or sad about it.

Anyway, less and less time remained. Carry on man! We will make it! And we will update this blog as soon as we get an output in Maya this evening!

Cheers

Sunday, April 10, 2011

Current Progress: Combining

So now we are combining Maya API and C++ boolean operator, hopefully we will have our output debugged before this Thursday!

Monday, April 4, 2011

Tips of Curve Editor and CGAL for potential transplant

Key functions:

Spline::PolygonBoolean()
Spline::COnvertToCGAL()
Spline::ConvertFromCGAL();

Headerfile information:



#include "CGAL/Boolean_set_operations_2.h"
#include "CGAL/Cartesian.h"
#include "CGAL/Polygon_2.h"
#include "CGAL/Polygon_set_2.h"
#include "CGAL/Polygon_with_holes_2.h"
#include <list>


struct Kernel : public CGAL::Cartesian<float>{};
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;//this is for union
typedef std::list<Polygon_with_holes_2> Pwh_list_2;//this is for intersection and subtraction
typedef CGAL::Polygon_set_2<Kernel> Polygon_set_2;




void PolygonBoolean();
void ConvertToCGAL(std::vector<vec3> PointList, Polygon_2 & P);
void ConvertFromCGAL(std::vector<vec3> & PointList, Polygon_2 P);


vector<vec3> curve1;
vector<vec3> results;

Thursday, March 31, 2011

Current Progress: CGAL lib and Curve Editor

Just successfully got the output of union operation for two polygons using CGAL.

experimental results:
                                                     original polygons

                                                   union operator

                                                      intersection operator


                                                     subtraction operator
Some tips:

The variable <Number_type> in the examples should be specified, and float is working well.

The points composing the polygons should be arranged counter clockwise in the x-y plane, or the program will crash down.

CGAL Polygon_2 class could close a polygon automatically, which means we do not have to reload the starting point as the ending point.

The input type of union operation should be Polygon_2, while the output should be Polygon_with_holes_2.

The type of Polygon_2 is actually a list, so [] operator is very convenient. However, Polygon_with_holes_2 is much more complex, and the member function outer_boundary() could get the result as Polygon_2 for further conversion to vec3 and curve editor drawer.

Something annoying is that, IntelliSence does not work for this project. oops...

Cheers, let's carry on to more excitement!

Wednesday, March 30, 2011

Current Progress: CGAL lib for boolean computation

Successfully modified curve editor system to display 2D polygons.

Found a library for 2D operations including polygon boolean computation: CGAL, seems be powerful for it.

Finally embedded it in the project. Some tips for memory in case of transplanting it to other computers:

file link: http://www.cgal.org/
edition: 3.8 beta
first download CGAL and install it.
download boost and install it, take care: must click THREAD for CMake generation!
download and run CMake to generate the project of CGAL, compile it (seems should in release mode)
embed the include folder and set up the linker to the lib folder in CGAL project and boost folder
transplant the "compiler_config.h" from the project of CGAL to the include folder
COMPILE & DONEPublish Post

Tuesday, March 29, 2011

Current Progress

Doing boolean computation using the OpenGL system in Curve Editor framework to get an output of the results.


After comparison between different methods, determined to use the winding number method to test the relative positions of the vertices and resort them in vectors.

reference: http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm

Monday, March 21, 2011

Weekly Report

Sad that we did not report for the last couple of weeks.

So right now we have made several progresses:

1. We made a rough user interface on Maya platform, using MEL. The user will have to draw some 2D enclosed shapes with Maya's curve tool to represent the two or three view images. Then these 2D shapes will be automatically duplicated and departed to form the "visual hull" in the Maya 3D window. Using the 3D tools, we can get the 3D cylinder with the input cross shape accurately. The boolean operators, including union, intersection and subtraction, are implemented by Maya 3D boolean tool directly. In this way we can get a result for most simple shapes and boolean computation.

2.However, what we want to make use of in Maya is only its 3 view plane and the 3D window. We want to compute the boolean operations ourselves in order to get a faster and more convenient approach. For this aspect, we are now trying to implement boolean operations for 2D polygons in one plane, which is the fundamental part of the whole algorithm. As Dr. Lane put it, we will also introduce OpenGL at this step to get a vividly graphic feedback for the algorithm.

Alright, that is where we are. We will make more progress and thank you for keeping an eye on us!

Sunday, March 13, 2011

About the Maya API

Hey you know what, although Maya's user interface is basically for 3D editing, we may make use of curves in the three view planes and record the positions of the control points as input to the CSG algorithm. Let's discuss it sweetly.

Thursday, February 24, 2011

First Week Report

Last week we studied the paper Designing Freeform Surfaces with 3D Curves and got more understanding about this project.

According to this we added more details to our design document:
Added basic functions and classes as well as their descriptions;
Added Maya interface, integration and work flow

We are now designing user interface using MEL or C++ API which includes:
3 view plane editor in which the user could draw 2D silhouette;
a platform to transfer data from the interface to Maya

At the same time, we are also trying to implement an alpha version of the classes.


Monday, February 21, 2011

3D Modeling with Silouette: Start!!!

3D Modeling with Silouette: Start!!!: "Hey everyone Today, I am born! Keep an eye on us, just like what we are doing to the exciting Computer Graphics and Animation! Soon after no..."

Saturday, February 19, 2011

Start!!!

Hey everyone
Today, I am born!
Keep an eye on us, just like what we are doing to the exciting Computer Graphics and Animation!
Soon after now, we will create something really magic, fantastic and gorgeous!
Best