Skip to content

A simple parametric model of plain-knit yarn curves, with C code and other resources.

License

Notifications You must be signed in to change notification settings

keenancrane/plain-knit-yarn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plain-knit-yarn

A simple parametric model of plain-knit yarn curves, with C code and other resources.

Front and back of plain knit yarn pattern, and yarns mapped onto a developable surface

Overview

This repository provides code implementing closed-form expressions for smooth curves resembling a plain-knit stitch, suitable for appearance modeling and previsualization. A unique feature of this model is that it also describes the twisted yarn fibers running along this stitch, making it suitable for modeling marled yarn. Adjustable parameters control the knit spacing, loop roundness, yarn thickness, and rate of fiber twisting. Tileable displacement maps and code for generating curves are also provided.

Media

  • Note. The note YarnCurve.pdf provides a more thorough description of the plain-knit curves, including a step-by-step derivation. The LaTeX source files for this note can be found in the note subdirectory.

  • Implementation. The code subdirectory contains a plain-C (ANSI C90) implementation of the curve functions, as well as routines for writing curves to the Wavefront OBJ mesh file format. This code should be easily portable to most other languages. Several implementations have been developed, in a variety of packages:

  • Displacement Maps. For rendering knit materials, it can be more efficient (or simply more convenient) to use a displacement map rather than explicit curve geometry. The images below provide tileable patterns for front and back displacements, as well as the associated alpha matte. Higher bit-depth images can be found in the displacement-maps directory, in OpenEXR and Radiance HDR/RGBE formats, which can help avoid shading artifacts. These maps were generated by generating tube geometry around the curves, and rendering depth images via an orthographic projection (in modo).
front back alpha
front displacement map back displacement map alpha matte

License

Creative Commons License
A Simple Parametric Model of Plain-Knit Yarns by Keenan Crane is licensed under a Creative Commons Attribution 4.0 International License. Code is released under an MIT License.

BibTeX citation

@misc{Crane:2023:SPM,
title = {{A Simple Parametric Model of Plain-Knit Yarns}},
author = {Crane, Keenan},
month = {3},
year = {2023},
howpublished = {online},
url = {https://github.com/keenancrane/plain-knit-yarn},
}

About

A simple parametric model of plain-knit yarn curves, with C code and other resources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published