Fitting Procedural Yarn Models for Realistic Cloth Rendering

SIGGRAPH 2016


Reviews

Information

  • Paper topic: Rendering
  • Software type: Code
  • Able to run a replicability test: True
  • Replicability score: 3
  • Software language: C/C++, Matlab / Mathematica / ..
  • License: custom
  • Build mechanism: IDE Project (VS,..), Not applicable (python, Matlab..)
  • Dependencies: matlab / opencv
  • Documentation score {0,1,2}: 0
  • Reviewer: Nicolas Bonneel <nicolas.bonneel@liris.cnrs.fr>
  • Time spent for the test (build->first run, timeout at 100min): 100min

Source code information

Comments

The program comes with microCT scans and a window executable, which also launches matlab code. To be able to recompile the code with Visual Studio 2017, you need a number of steps :

- MicroCT.cpp, line 1270, replace :
 std:vector<float> ellipse_s_vec(loopNum), ellipse_l_vec(loopNum), yarn_radius_vec(loopNum);
by
std::vector<float> ellipse_s_vec(loopNum), ellipse_l_vec(loopNum), yarn_radius_vec(loopNum);
(note the :: instead of : )

- Util.h, line 99, remove the round function.

- add the preprocessor directive _CRT_SECURE_NO_WARNINGS

* The provided precompiled OpenCV was causing issues ; perhaps it had been compiled in 32 bits (?). I used a fresh OpenCV install instead, which led to a couple of additional edits :

- in MicroCT.h, replace the opencv includes 
#include "opencv/include/opencv/cv.h"
#include "opencv/include/opencv/highgui.h"
#include "opencv/include/opencv2/opencv.hpp"
by
#include <opencv2/highgui.hpp>
#include "opencv2/opencv.hpp"
#include <opencv2/core/types_c.h>
#include <opencv2/highgui/highgui_c.h>

-replace opencv_core249.lib;opencv_highgui249.lib;opencv_features2d249.lib;opencv_imgproc249.lib; by opencv_world420.lib in the project linked libraries.

- in MicroCT.cpp, line 784, replace 
	ellipse(Mat(displayImg), Point(C1.x, C1.y), Size(l, s), (double)rot_angle, 0, 360, Scalar(1.f, 0.f, 0.f));
	ellipse(Mat(displayImg), Point(C2.x, C2.y), Size(l, s), (double)rot_angle, 0, 360, Scalar(0.f, 1.f, 0.f));
by
	ellipse(cv::cvarrToMat(displayImg), Point(C1.x, C1.y), Size(l, s), (double)rot_angle, 0, 360, Scalar(1.f, 0.f, 0.f));
	ellipse(cv::cvarrToMat(displayImg), Point(C2.x, C2.y), Size(l, s), (double)rot_angle, 0, 360, Scalar(0.f, 1.f, 0.f));

- in MicroCT.cpp, line 818, replace cv::Mat mat = cv::Mat(img, true); by cv::Mat mat = cv::cvarrToMat(img, true);

- in MicroCT.cpp, line 1422, replace:
	ellipse(Mat(displayImg), Point(C1.x, C1.y), Size(cvEL, cvES), (double)rot_angle, 0, 360, Scalar(1.f, 1.f, 1.f));
	ellipse(Mat(displayImg), Point(C2.x, C2.y), Size(cvEL, cvES), (double)rot_angle, 0, 360, Scalar(1.f, 1.f, 1.f));
by
	ellipse(cv::cvarrToMat(displayImg), Point(C1.x, C1.y), Size(cvEL, cvES), (double)rot_angle, 0, 360, Scalar(1.f, 1.f, 1.f));
	ellipse(cv::cvarrToMat(displayImg), Point(C2.x, C2.y), Size(cvEL, cvES), (double)rot_angle, 0, 360, Scalar(1.f, 1.f, 1.f));

- in MicroCT.cpp, line 1610, replace
	ellipse(Mat(displayImg), Point(C1.x, C1.y), Size(e_l, e_s), (double)rot1, 0, 360, Scalar(1.f, 1.f, 1.f));
	ellipse(Mat(displayImg), Point(C2.x, C2.y), Size(e_l, e_s), (double)rot2, 0, 360, Scalar(1.f, 1.f, 1.f));
	ellipse(Mat(displayImg), Point(C3.x, C3.y), Size(e_l, e_s), (double)rot3, 0, 360, Scalar(1.f, 1.f, 1.f));
to
	ellipse(cv::cvarrToMat(displayImg), Point(C1.x, C1.y), Size(e_l, e_s), (double)rot1, 0, 360, Scalar(1.f, 1.f, 1.f));
	ellipse(cv::cvarrToMat(displayImg), Point(C2.x, C2.y), Size(e_l, e_s), (double)rot2, 0, 360, Scalar(1.f, 1.f, 1.f));
	ellipse(cv::cvarrToMat(displayImg), Point(C3.x, C3.y), Size(e_l, e_s), (double)rot3, 0, 360, Scalar(1.f, 1.f, 1.f));

* Ultimately, the code runs. I didn't have to change my matlab settings as proposed (in fact, I do not have the option 'Location based on Matlab startup rules' but only 'Last working folder from previous Matlab session').
However, the code only produces text files that contain strands. I do not know how to render this .txt in Mitsuba, but it was easy to grasp the file structure and code a loader in my own path tracer (though with circular cross section for simplicity instead of elliptical as suggested in Algorithm 1). The file merely contains the number of fibers, and then, for each fiber, the number of segments, for each segment the X, Y, Z coordinates.

Nevertheless, the paper mentions a modified Mitsuba to be able to make the renderings, and the paper shows (impressive) renderings of fabrics, not just strands... Also, which reflectance model was used to render the fibers ?

Misc. comments

Most of the time was spent in trying to visualize the results ; here, coding my own loader and renderer.

If you want to contribute with another review, please follow these instructions.

Please consider to cut/paste/edit the raw JSON data attached to this paper.