Skip to content

A procedural corrugator of mesh for cloth materials based on wave function collapse, part of the software for a PBD cloth simulator.

License

Notifications You must be signed in to change notification settings

Wei-Parker-Guo/WFC-Cloth-Mesh-Corrugator

Repository files navigation

WFC Cloth Mesh Corrugator

A procedural mesh corrugator in C++ to generate corrugated vertices given a mesh for cloth simulation. This software is used as a module in a PBD cloth simulator for realistic knitted clothes simulation. It is part of the paper titled A Procedural Approach For Cloth Simulation*, authored by Wei Guo, Yihao Wang and Kai Zhang.

Author: Wei Guo wei.parker.guo.sg@gmail.com

Date of Initiation: 11/29/2020

*The paper discussed here is under publication. A link will be provided for full text when it's officially published.

Usage

This is a platform independent cmake project. The executables are built using Visual Studio on the author's machine for Windows in 64 bits.

Input Image Formats

An input image is required for the corrugator to procedurally generate patterns that are similar to it. It should represent the knitting pattern of desired cloth material, with white pixels indicating space and black indicating cloth fiber. The image could be either png or jpeg. You will be prompted in the console to supply this image's path.

Note: The image supplied will be read as a bitmap with color channels ignored. Color with brightness below 128/255 is considered black, white if above this value. It should be relatively small since the algorithms process cells on a pixel basis, with a recommended size of below 128 x 128.

Output Image Formats

You will be prompted by the console to input the desired image diemension. Regardless of the original size, the generator will try to tile the entire bitmap with resonable patterns based on WFC. The format will be jpg with a compression rate of 90 in full color.

References

Most of the codes in this implementation are referenced with inline comments. Some individual modules are referenced here.

  • tooljpeg jpeg encoder from https://create.stephan-brumme.com/toojpeg/
  • stb_image.h jpeg image loader from https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
  • About

    A procedural corrugator of mesh for cloth materials based on wave function collapse, part of the software for a PBD cloth simulator.

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published