# Normal to an implicit surface

$$\renewcommand{\vec}[1]{ \mathbf{#1} }$$

# Implicit surface a.k.a (signed) distance field: definition

In computer graphics, when people hear "implicit surface" most of them think about metaballs, blobby objects and the marching cube. I want to define here implicit surface as a much more general concept and basic jargon related to this field.

$$\renewcommand{\vec}[1]{ \mathbf{#1} }$$

# Phong illumination model (cheat sheet)

$$\renewcommand{\vec}[1]{ \mathbf{#1} }$$
$$f( \vec p ) = \underbrace{I_a K_a}_{\color{red} \text{ambiant componant}} + \underbrace{\sum_i^\text{nb_lights} (\vec n( \vec p ) . \vec l_i) K_d I_i}_{\color{green} \text{diffuse componant}} + \underbrace{\sum_i^\text{nb_lights} f_{spec}(\vec l_i( \vec p ), \vec v(\vec p)) K_s I_i}_{\color{blue} \text{specular componant}}$$

I summarize the phong illumination model with the above equation and explain all the terms one by one.

# Anki tip, inserting furigana (pop up on mouse hover)

Here is how you can make furigana appear abover kanjis in your anki flash cards as follows:

はし上手じょうずですね！

# Learning japanese: a life's journey

Learning a langage is quite a challenge, here I will gather some resources and thoughts about learning japanese.

# [Maya C++ API] Set skinning weight attributes

Some C++ Maya API code to set skin weights (multi attributes) of a skin cluster node.

# Dual Quaternion Skinning with scale

DQS with scale applied on the second to last joint. Left, globaly propagates until the last bone, right, scale localized to each joint.

Here I'm merely paraphrasing Kavan's DQS article using my own notations and words.

# [Maya C++ API] Save MPxData attribute on file

In Maya nodes are connected through attributes, Maya provides base types (e.g. matrices, vector of floats) but sometimes you want to use your own type to transfer data from one node to another. In this case you need to inherit from MPxData. There are functions to override in MPxData to specify how to write and load your custom data into the Maya scene file. I found the official documentation to be a bit thin on the topic, so I'm leaving additional tips here related to:

• MPxData::writeBinary() / MPxData::readBinary()
• MPxData::writeASCII() / MPxData::readASCII()

# [Maya C++ API] Unable to unload plugin in Maya

When developing a Maya plugin it can be very frustrating not to be able to unload a plugin because you have to restart Maya every time you want to test a change. Here are a few tips to help you pinpoint why you can't unload a Maya plugin.

# Bulge free Dual Quaternion Skinning (Trick)

C++ code snippet to correct the well known Dual Quaternion Skinning bulge artifact. Fast and easy to implement this trick, however, produces small discontinuities in the final mesh deformation. Left is the standard DQS, right with bulge correction, skinning weight computed with Maya 2015 "smooth bind" (with better weights the inside of the joint fold could be prettier...)

# [Maya C++ API] Per vertex color update in MPxDeformerNode

Code snippet in C++ to be able to update the color of a mesh on a per vertex basis inside a custom Maya node. Useful for debugging by displaying weights / float values associated to each vertex.

# C++ code to smooth a mesh (weighted Laplacian scheme)

Dropping a procedure to compute the Laplacian smoothing of a 3D mesh (with cotangent weights).

# C++ code for cotangent weights over a triangular mesh

Here is some code to compute the cotangent weights described in the article Discrete Differential-Geometry Operators for Triangulated 2-Manifolds. Cotangent weights have many application such as mesh smoothing, computing harmonic weights over the mesh, or diffusing values on its surface. I'm leaving this here for other tutorial to reference.

# Transform normals given a deformation map

Changing the shape of a 3D mesh is a very common operation in computer graphics. For instance, rotations, translations etc. are very basic forms of mesh deformations. Of course more complicated algorithms exists to deform your mesh such as wrap deformers, linear blending skinning and so on... During the design of these algorithms you might face a question: how do I transform the normal of the original shape in rest pose to the deformed shape? This entry will give you some pointers to compute it.

# Blender tutorial to animate a cylinder

The goal of this tutorial is to describe step by step the process of skinning a simple cylinder with two joints in Blender 2.5 and superior. This is a beginner lesson in the sense that I will describe as much as possible shortcuts and actions, however, there will be no high level explanations.

Note for the scholars: blender implements the heat diffusion method to compute skinning weights, linear blending and dual quaternion skinning are used to deform the mesh.

Just leaving some notes to differentiate expressions with the $$\nabla$$ operator to compute gradients of various functions.

Here you will find our Implicit skinning standalone application under the license GNU GPL3.

Disclaimer
The standalone application is written in Qt/C++ and CUDA, therefore it only works on NVIDIA GPUs but should run on Windows or Linux. This code is a research project developed on three Linux machines with similar configurations and "tested" by very few people: expect difficulties to get it to work. The documentation is also very thin. That being said I will be happy to answer questions in case of troubles.

# Elastic Implicit Skinning: a Robust Iso-Surface Tracking for Interactive Character Skinning

Publication: ACM SIGGRAPH ASIA, 2014

#### Rodolphe Vaillant1,2, Gaël Guennebaud3, Loïc Barthe1, Brian Wyvill2, Marie-Paule Cani4

1IRIT - Université de Toulouse, 2University of Victoria, 3Inria Bordeaux,
4LJK - Grenoble Universités - Inria

Comparison of Implicit Skinning with our new Elastic Implicit Skinning. From right to left: Jeff in T-pose, Jeff rigged with implicit skinning, Jeff rigged with elastic implicit skinning, female model with implicit skinning then elastic implicit skinning.

With elastic implicit skinning the skin stretches automatically (without skinning weights) and the vertices distribution is more pleasing (notice the belly button stretch). Our approach is more robust, for instance the angle's range of joints is larger than implicit skinning (notice the triangle inversion of implicit skinning at the knee joint)

# Voro++.0.4.5 with cmake for easy compilation under windows

Dropping my code of the . It helped me to compile the voro++ library under windows with cmake.

# Harmonic function: definitions and properties

This is the second part of my tutorial series on bounded harmonic functions. For a quick introduction and examples of use of harmonic functions read the first part. In this part I define harmonic functions and their properties. This is the hard part with a lot of mathematics. But it's a mandatory step to understand how harmonic functions work. This will allow you to apply them in a broader context and understand many scientific papers relying on these. In addition this will be my entry point to introduce Finite Element Method in future posts. So hang on it's worth it!

# AnkiDroid: How to solve "Syncing error, type: 409, message: Conflict" problem

I ran into the infamous message "Syncing error, type: 409, message: Conflict" while syncing my AnkiDroid with AnkiWeb on my Nexus 4. Here is the solution:

# Contour lines

## Introduction

To represent a 2D function $$z = f(x,y)$$ one can draw a 3D surface. The higher the $$z$$ value the higher the point on the surface (see above).

# How to generate bounded harmonic functions on regular grids

(a)

(b)

(c)

(d)
 Generating an height-map  is a good example to demonstrate how useful harmonic functions can be. In (a) user can stroke lines corresponding to different heights. In (b) we associate a height where the strokes lies. In (c) we compute the rest of the values automatically (black is zero, white is one). (d) is a 3D view of the heightmap in (c). It is a 2D function $$f: \mathbb R^2 \rightarrow \mathbb R$$ which returns the height. The tutorial explains how to compute the unknown heights and ensure $$f$$ is an harmonic function.

## Summary

In this tutorial I give the basics to be able to compute harmonic functions $$f: \mathbb R^n \rightarrow \mathbb R$$ over a regular grid/texture (in 1D, 2D or 3D). All you need is to set a few values on the grid that define a closed region (see figure above), then the remaining values are automatically computed using the so-called laplace operator and solving a linear system of equations. After a quick and "mathless" presentation of an easy way to implement this in C++, I will explain the mathematical jargons. This tutorial is the first of series which will lead to more complicated techniques like Finite Element Methods (FEM).

# Singular value decomposition of a 2x2 matrix (C++ code)

Dropping some [ code here] to do a singular value decomposition (SVD) of a 2 by 2 real matrix.

# Source code for poisson disk sampling of a triangle mesh

Here you can to do a poisson disk sampling of a triangular mesh. The code is a simple wrapper for the vcglib library. It takes in input a std::vector of triangles and vertex position/normals and outputs std::vector of samples positions/normals computed with the poisson disk sampling.

EDIT: Victor Martins pointed out that the above code doesn't compile on MAC and kindly provided an [  update] bundled with a newer version of vcglib.

N.B: if you are looking for a way to do poisson disk sampling fast/in real-time take a look at this siggraph paper and matlab code.

# 3D viewer for Hermite Radial Basis Function

This is a simple demonstrator of the HRBF technique presented and explained here. You can visualize and edit the implicit surface generated with HRBF.

# C++ code for spline curves

Dropping on github C++ code to compute spline curves of arbitrary dimensions 3D curves or 2D splines anything is possible. The class can be instanciated with any point type (1d (float), 2d, 3d etc.) as long as the appropriate operator overload are implemented. This class use the efficient blossom algorithm to compute a position on the curve.

# Implicit Skinning: Real-Time Skin Deformation with Contact Modeling

Publication: ACM SIGGRAPH, 2013

#### Rodolphe Vaillant1,2, Loïc Barthe1, Gaël Guennebaud3, Marie-Paule Cani4, Damien Rhomer5, Brian Wyvill2, Olivier Gourmel1 and Mathias Paulin1

1IRIT - Université de Toulouse, 2University of Victoria, 3Inria Bordeaux,
4LJK - Grenoble Universités - Inria, 5CPE Lyon - Inria

 (e) (a) (b) (c) (d) (a) Self-intersection of the Armadillo's knee with dual quaternions skinning. (b) Implicit Skinning produces the skin fold and contact. (c), (d) two poses of the finger with Implicit Skinning generating the contact surface and organic bugle. (e) Implicit Skinning of an animated character around 95fps.

# Dual Quaternions skinning tutorial and C++ codes

In this entry I provide [  C++ code ] to deform a mesh with the famous Dual Quaternion Skinning (DQS) deformer. This tutorial aims to present and explain the general idea behind Dual Quaternions and give means to integrate it quickly into a pre-existing Linear Blending Skinning (LBS) pipeline. My goal is to give the minimal set of explanations to re-use my code quickly. Therefore I will try not to dwell too much on the maths which are thoroughly explained in the original paper: "Geometric Skinning with Approximate Dual Quaternion Blending".

I will also assume the reader have some basic knowledge about Skeletal Animation and Quaternions (used as a mean to represent 3D rotations).

# Convert implicit surface defined with global support to compact support

In mathematics functions are sometime characterized as compactly or globally supported. I will explain what it means and how to convert a function from global to compact support in the context of implicit surface modeling (i.e. boolean modeling with implicit surfaces as objects).

# Trackball C++ code without quaternions

I'm leaving some code to handle a simple trackball. The code actually wasn't done by me, but I can't remember where I took it! Originally it was C code which I've wrapped up in a C++ class with way more comments and an example of how to use it. [  C++ trackball code ].

# Building a new culture of teaching and learning

Theories around alternative systems for teaching and learning has always interested me, so I decided to open an entry about that.  My first contribution will be the English transcript of an inspiring video about education. I might put more articles/videos on this topic later.

# Recipe for implicit surface reconstruction with HRBF

In this entry I'll explain and give code for the easiest method I know to reconstruct a surface represented by a scalar field $$f: \mathbb R^3 \rightarrow \mathbb R$$ by interpolating a set of point with their normals. The method is called Hermite Radial Basis Function (HRBF) interpolation. The audience aimed is anyone with some basic knowledge about implicit surfaces (which people often know as metaballs and render with the marching cube algorithm)

# C++ code to emulate openGL old direct mode drawing

glBegin(GL_TRIANGLES);
glVertex3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glVertex3f(0.0f, 0.0f, 1.0f);
glEnd();


[  compact version ] | [  modular version ]

Remember the old days when you were able to simply draw a few primitives with GL_POINTS, GL_LINES or GL_QUADS within a pair of good old begin() end(). Well I'm providing a C++ class which will enable you to do this again under openGL 3.1 or higher.

# C code for 4x4 matrix inversion

Just leaving some code here to invert either column or row major 4x4 matrices.

# Upgrade to CUDA 5.0: cudaMemcpyToSymbol invalid device symbol error

You have just upgraded to CUDA 5.0 and the function cudaMemcpyToSymbol() throws you the infamous "invalid device symbol" error. Here is what to do.

# CUDA constant memory, namespace, and weird bugs

Edit: the usage of cudaMemcpyToSymbol describded below is deprecated since CUDA 4.1 (See also my new entry Upgrade to CUDA 5.0: cudaMemcpyToSymbol invalid device symbol error)

Today I want to discuss some issues I had with CUDA constant memory and share some workarounds.

# Drag and drop not working in QTDesigner or QTCreator designer

This has upset me for some time and I finally found a forum entry solving this problem.

The problem: I wasn't able to drag&drop in QTDesigner any widgets from the widgets list to the form I was editing.
Solution found here: qtforum.org

You only need to add this entry to your /etc/X11/xorg.conf:

Section "Module"    Load "extmod"EndSection

# Broken F4 shortcut in Qtcreator for cuda files ".cu"

Well I'm using QtCreator to code my CUDA project and there has been a lot of things bothering me. Among them is this F4 shortcut which doesn't work. The shorcut enables switching between the header and source file but apparently the extenssion .cu is not recognized as a C++ source file. Here is how to fix it.

• 1