Posts Tagged ‘igl’

Command line program to view 3d meshes from files and piped input

Thursday, December 15th, 2016

Here’s a little C++ program to directly render meshes in 3D viewer from the command line.

This let’s you write little test programs without worrying about linking to a 3D viewer. You just need to output a mesh in a standard format. For example, here’s a tiny program that outputs a cube in an .off format:

#include <igl/read_triangle_mesh.h>
#include <Eigen/Core>
#include <iostream>

int main(int argc, char * argv[])
{
  using namespace Eigen;
  MatrixXd V(8,3);
  MatrixXi Q(6,4);
  V<<
    0,0,1,
    0,1,1,
    1,1,1,
    1,0,1,
    0,0,0,
    0,1,0,
    1,1,0,
    1,0,0;
  Q<<
    3,2,1,0,
    0,1,5,4,
    6,5,1,2,
    3,7,6,2,
    4,7,3,0,
    4,5,6,7;
  std::cout<<
    "OFF\n"<<V.rows()<<" "<<Q.rows()<<" 0\n"<<
    V.format(IOFormat(FullPrecision,DontAlignCols," ","\n","","","","\n"))<<
    (Q.array()).format(IOFormat(FullPrecision,DontAlignCols," ","\n","4 ","","","\n"));
  return EXIT_SUCCESS;
}

Compile this into cube_off then issue:

./cube_off | view mesh

**Update: ** And here’s a funny, little one-liner you can call from matlab to display a mesh via the .obj format:

system(sprintf('echo \"%s%s\" | /usr/local/bin/viewmesh',sprintf('v %0.17f %0.17f %0.17f\n',V'),sprintf('f %d %d %d\n',F')))

Writing a mesh to an .obj file in a single line with Eigen

Wednesday, April 29th, 2015

I was recently revisiting our igl::writeOBJ code and realized that for simple meshes, the code for writing an .obj file can be really simple:

ofstream("test.obj")<<
  V.format(IOFormat(FullPrecision,0," ","\n","v ","","","\n"))<<
  (F.array()+1).format(IOFormat(FullPrecision,0," ","\n","f ","","","\n"));

Update: And because why not, here’s a .off writer:

ofstream("test.off")<<
  "OFF\n"<<V.rows()<<" "<<F.rows()<<" 0\n"<<
  V.format(IOFormat(FullPrecision,0," ","\n","","","","\n"))<<
  (F.array()).format(IOFormat(FullPrecision,0," ","\n","3 ","","","\n"));

2014 SciVis paper “Fast and Memory-Efficient Topological Denoising of 2D and 3D Scalar Fields”

Monday, September 22nd, 2014

David Günther, Jan Reininghaus, Hans-Peter Seidel, Olga Sorkine-Hornung, Tino Weinkauf and I will publish our paper
“Fast and Memory-Efficient Topological Denoising of 2D and 3D Scalar Fields” in TVCG and David will present the work at SciVis this year. This paper is a much-needed extension of our earlier SGP paper on optimizing over monotonic functions. This new paper provides two new heuristics: 1) a plaided domain decomposition enables efficient optimization on much larger datasets (notably 3D images, e.g. voxel grids), and 2) iterating on our convexification of the monotonicity constraint. This iteration idea greatly improves the quality of solutions when the gradient direction of the harmonic initial guess is far from matching the optimal solution, particularly important in the case of data smoothing. In some sense, one could view this as a sort of trust-region-ish algorithm, but our problem specific knowledge allows us to make much better progress.

Download the paper.

Consistent Volumetric Discretizations Inside Self-Intersecting Surfaces project page

Friday, July 5th, 2013

selfintersecting volumes hand teaser

Leo Sacht, Daniele Panozzo, Christian Schüller, Olga Sorkine-Hornung and I have posted a project page for our recently presented SGP paper “Consistent Volumetric Discretizations Inside Self-Intersecting Surfaces”. The abstract follows.

Decades of research have culminated in a robust geometry processing pipeline for surfaces. Most steps in this pipeline, like deformation, smoothing, subdivision and decimation, may create self-intersections. Volumetric processing of solid shapes then becomes difficult, because obtaining a correct volumetric discretization is impossible: existing tet-meshing methods require watertight input. We propose an algorithm that produces a tetrahedral mesh that overlaps itself consistently with the self-intersections in the input surface. This enables volumetric processing on self-intersecting models. We leverage conformalized mean-curvature flow, which removes self-intersections, and define an intrinsically similar reverse flow, which prevents them. We tetrahedralize the resulting surface and map the mesh inside the original surface. We demonstrate the effectiveness of our method with applications to automatic skinning weight computation, physically based simulation and geodesic distance computation.

Here’s the youtube video showing a few of the forward and reverse flows.

public alpha release of libigl – a c++ geometry processing library

Monday, April 22nd, 2013


libigl a c++ geometry processing library

We’ve finally released our in-house C++ library for geometry processing called libigl.

libigl is a simple c++ geometry processing library. We have a wide functionality including construction of sparse discrete differential geometry operators and finite-elements matrices such as the contangent Laplacian and diagonalized mass matrix, simple facet and edge-based topology data structures, mesh-viewing utilities for opengl and glsl, and many core functions for matrix manipulation which make Eigen feel a lot more like MATLAB.

It is first and foremost a header library. Each header file contains a single function. Most are tailored to operate on a generic triangle mesh stored in an n-by-3 matrix of vertex positions V and an m-by-3 matrix of triangle indices F.

The library may also be compiled into a statically linked library, for faster compile times with your projects.

We use the Eigen library heavily in our code. Our group prototypes a lot in MATLAB, and we have a useful conversion table from MATLAB to libigl/Eigen.

Visit the project page and download our code!

Robust Inside-Outside Segmentation using Generalized Winding Numbers project page

Wednesday, April 10th, 2013


100 Armadillos animated in real time.

My colleagues, Ladislav Kavan, Olga Sorkine, and I have just submitted the camera ready version of paper “Robust Inside-Outside Segmentation using Generalized Winding Numbers” to be presented at ACM SIGGRAPH 2013. I’ve put up a Robust Inside-Outside Segmentation using Generalized Winding Numbers page where you can find the preprint version of the article, videos and more to come.

Abstract

Solid shapes in computer graphics are often represented with boundary descriptions, e.g. triangle meshes, but animation, physically-based simulation, and geometry processing are more realistic and accurate when explicit volume representations are available. Tetrahedral meshes which exactly contain (interpolate) the input boundary description are desirable but difficult to construct for a large class of input meshes. Character meshes and CAD models are often composed of many connected components with numerous self-intersections, non-manifold pieces, and open boundaries, precluding existing meshing algorithms. We propose an automatic algorithm handling all of these issues, resulting in a compact discretization of the input’s inner volume. We only require reasonably consistent orientation of the input triangle mesh. By generalizing the winding number for arbitrary triangle meshes, we define a function that is a perfect segmentation for watertight input and is well-behaved otherwise. This function guides a graphcut segmentation of a constrained Delaunay tessellation (CDT), providing a minimal description that meets the boundary exactly and may be fed as input to existing tools to achieve element quality. We highlight our robustness on a number of examples and show applications of solving PDEs, volumetric texturing and elastic simulation.

Update: The accompanying video (with narration)

New ETHZ masters thesis project available: Make Me Dance!

Tuesday, January 29th, 2013

Make me dance! eth masters project

Jean-Charles Bazin, Tiberiu Popa, Markus Gross and I will be hosting a master’s thesis project. The project, entitled Make Me Dance, is now available, and we are eagerly awaiting applications.

The topic of the thesis is simple to explain: you would like to dance like Lady Gaga or Michael Jackson but your dancing skills are not great. The goal is to virtually improve your dancing skills: given a video of you (or anyone else) dancing, the project aims to process and manipulate the video, in an automatic manner, so that your “upgraded” dance looks like the one of the dancer of your choice (e.g. Lady Gaga or Michael Jackson).

Task Description: To reach this goal, several approaches from computer vision and computer graphics will be investigated and combined. For example you will use Microsoft’s Kinect to get a depth map and a human skeleton. Given your estimated skeleton and the target pose of the professional dancer, you will apply some character animation techniques. Finally you will map the texture onto the 3D human model to create a realistic video in which your dance moves now matches the ones of the professional dancer.

Please don’t hesitate to contact me for more details.

Also, check out the full list of IGL projects.

Note: You will need to be at an ETH IP address to visit these links.

Fast Automatic Skinning Transformations project page

Wednesday, May 9th, 2012


100 Armadillos animated in real time.

My colleagues, Ilya Baran, Ladislav Kavan, Jovan Popović, Olga Sorkine, and I have just submitted the camera ready version of paper “Fast Automatic Skinning Transformations” to be presented at ACM SIGGRAPH 2012. I’ve put up a fast automatic skinning transformations page where you can find the preprint version of the article, videos and more to come.

Abstract

Skinning transformations are a popular way to articulate shapes and characters. However, traditional animation interfaces require all of the skinning transformations to be specified explicitly, typically using a control structure (a rig). We propose a system where the user specifies only a subset of the degrees of freedom and the rest are automatically inferred using nonlinear, rigidity energies. By utilizing a low-order model and reformulating our energy functions accordingly, our algorithm runs orders of magnitude faster than previous methods without compromising quality. In addition to the immediate boosts in performance for existing modeling and real time animation tools, our approach also opens the door to new modes of control: disconnected skeletons combined with shape-aware inverse kinematics. With automatically generated skinning weights, our method can also be used for fast variational shape modeling.

Update: The full resolution version of the above teaser.

Update: The accompanying video (with narration)

BBW alligator demo

Wednesday, October 19th, 2011

alligator demo

I posted a small “bonus” demo that I’ve been distributing as a supplement for the Bounded Biharmonic Weights for Real-Time Deformation MATLAB demo. This shows a full pipeline for the alligator example in Figure 5 of our paper and in our videos. The example uses point, bone, and cages on the sample 2D character. The demo is now included in the bbw.zip folder of matlab code and can be called by issuing:


>> alligator_demo

Stretchable, Twistable Bones Skinning project page

Monday, September 12th, 2011

Stretchable, twistable bones teaser

Olga Sorkine and I have recently received final acceptance for our paper, “Stretchable and Twistable Bones for Skeletal Subspace Deformation”, to be presented at SIGGRAPH Asia 2011 and published in the proceedings as a special issue of ACM Transactions on Graphics. I’ve put a project page on the igl site. There you can find links to the paper, the accompanying video and coming soon more things like prototype code, bonus results, etc.

The abstract:
Skeleton-based linear blend skinning (LBS) remains the most popular method for real-time character deformation and animation. The key to its success is its simple implementation and fast execution. However, in addition to the well-studied elbow-collapse and candy-wrapper artifacts, the space of deformations possible with LBS is inherently limited. In particular, blending with only a scalar weight function per bone prohibits properly handling stretching, where bones change length, and twisting, where the shape rotates along the length of the bone. We present a simple modification of the LBS formulation that enables stretching and twisting without changing the existing skeleton rig or bone weights. Our method needs only an extra scalar weight function per bone, which can be painted manually or computed automatically. The resulting formulation significantly enriches the space of possible deformations while only increasing storage and computation costs by constant factors.