A physically based shader for woven cloth

Overview

ThunderLoom

teaser8 A physically based shader for woven cloth

This projects consits of three main parts:

  • Irawan shading model

At its core is an implementation of the 'Irawan' shading model, as presented in the phd thesis by Piti Irawan and in the paper by Irawan and Marschner (2012).

  • Library with API

The shading model is made accessible for rendering engines with added flexibilty and artistic control through a library with a simple API. This allows the model and extra improvements to quickly be integrated into custom rendering pipelines or created as plugins to more established renderers.

The library allows fast and flexible control over many parameters of how the woven cloth is to behave. The actual pattern is determined using standard weaving-drafts defined in WIF files. Many types of patterns are freely available from fine sites such as handweaving.net.

  • Frontends/plugins

Three plugins using this library have been made. V-Ray for 3dsMax, V-Ray for Maya and a limited plugin for Mitsuba, which includes a patch for the mtslbend plugin for Blender. There is also a pattern editor which can be used on its own to create or alter weaving patterns. See the subfolders for these frontends for more information.

Installing the frontends

Precompiled binaries can be found under the releases tab. The zip file includes plugins for V-Ray for 3dsMax, Maya and for the mitsuba renderer.

See the respective README files for specific install instructions.

Library

The source code for the library and core is found in the 'src' folder. The file 'thunderloom.h' describes the API of the shader.

For an example implementaion see frontends/api_demo/.

Licence

The source code is released under the MIT Licence.

But if you happen to make something cool using this, a nice render or an improved tool, please let us know! We would love to see it! :)


3 pillars with different types of cloth rendered using thunderLoom in vray/3dsMax

Issues
  • Compatibility with Vray Next

    Compatibility with Vray Next

    Greetings, I've tested to use Thunderloom with Vray 3.6 for my recent project, and it worked very well and it was so impressive. This tool enable artists to create entirely new and believable fabric texture. But it doesn't seems to work well with Vray 4.x (aKa Vray Next), There were error log like, 'BRDFThunderloom shader cannot be loaded.'

    enhancement 
    opened by mOoOm 11
  • Mult helper sliders for colors.

    Mult helper sliders for colors.

    • Diffuse amount slider (mult) Multiply diffuse color with this factor.

    • ~~texture gamma text field~~ ~~"texture gamma" field where the user could input the gamma to be used for all the colors. Currently they each need to be linearlized individually which takes a lot of work to set up. So having a single place to control this for all the diffuse colors would be very helpful. The pseudo code would be "pow (color, texture_gamma)" so the default value of 1.0 would leave the colors unchanged, and a value of 2.2 would linearize all the diffuse colors from sRGB (2.2) to linear (1.0).~~

    Suggested by Derek Flood.

    enhancement 
    opened by petermcevoy 7
  • ThunderLoom in GI and diffuse render element

    ThunderLoom in GI and diffuse render element

    The shader does not appear in the GI render element (RE) and it is also missing in the diffuse RE. It would be really great if it could appear in the diffuse RE because then one could bake the diffuse WIF pattern into a texture map. This would open up TONS of really great possibilities for look-dev, and so.would be my number 1 wish.

    Suggested by Derek Flood.

    enhancement 
    opened by petermcevoy 3
  • Arbitrary uv texture lookup on V-Ray Standalone/V-Ray for Maya is not implemented.

    Arbitrary uv texture lookup on V-Ray Standalone/V-Ray for Maya is not implemented.

    The function tl_eval_texmap_mono_lookup in vray_thunderloom.cpp is not implemeted. This means that there will be problems when varying yarnsizes non-uniformly, such as with a changing texture. I can't find a way to achieve this sort of lookup using the V-Ray APIs.

    See my question on the ChaosGroup forums for more info: https://forums.chaosgroup.com/forum/v-ray-for-maya-forums/v-ray-for-maya-sdk/76255-texture-lookup-with-uv-on-non-bitmap-textures

    See the implementation of tl_eval_texmap_mono_lookup in vray3dsMax/3dsMax/Eval.cpp for how it works in V-Ray for 3dsMax.

    bug 
    opened by petermcevoy 3
  • Opacity channel for transparency

    Opacity channel for transparency

    Modified pr #36 to use a separate parameter for opacity - instead of alpha channel Only tested in 3ds Max for now.

    Here's a material with yarn size 0.3 (and transparency between the yarns): tl_opacity

    opened by vidarn 2
  • Maya crashes with daisy chain node inputs into Thunderloom

    Maya crashes with daisy chain node inputs into Thunderloom

    Maya will crash if there are too many "daisy chain" connections into Thunderloom shader.

    For example if I connect a file texture to the type1 spec color, this works fine (a into B). Further, if I connect a file texture to a VrayFalloff, then connect that to the type1 spec color (a into b into c) this also works fine. However if I add an additional step to the daisy chain: texture map > gamma > falloff > thunderloom spec (a into b into c into d), this will crash Maya. In other words if the daisy chain gets too long (three links) it crashes.

    Work around is of course to minimize the node chain length.

    bug 
    opened by sharktacos 2
  • Reveal

    Reveal "alpha" slider

    I've been testing the "alpha" slider that Peter revealed for me in a branch of the shader, and can say that it is really helpful for getting "metallic" fabrics like silk to look right (honestly I was not able to get silk to look right without it). So I'd put in my vote for keeping this exposed in the shader. For example, changing the alpha from the default value of 0.05 to 1 makes the spec basically uniform like a metal, rather than a dielectric material. Thus giving the "metallic" look of a silk.

    I would suggest giving it a more descriptive name than "alpha" which indicates its purpose, like the other attribute names in the shader do. Perhaps you could call it "uniform specularity" or maybe even "metalness."

    enhancement 
    opened by sharktacos 2
  • Transparency (Added alpha channel to yarn diffuse colors.)

    Transparency (Added alpha channel to yarn diffuse colors.)

    tlColor struct now has alpha channel. But it is only used in the diffuse evaluation. Plugins use alpha channel to tell vray about transparency.

    Following still needs to be done...

    • [ ] Expose alpha in 3dsmax UI for diffuse colors.
    • [ ] Bump PTN file version. Make conversion pin file conversion function that adds alpha 1.0 to old colors.
    opened by petermcevoy 1
  • how to install ThunderLoom

    how to install ThunderLoom

    hey! im new in 3dmax 2015- vray 3.0, i want to use "ThunderLoom" is it possible? I already read several post here about installation, was like Chinese :D.. i really dont know Cmake, SDK, .... how to do it

    opened by madess 1
  • keep default yarn type settings option when resetting pattern file

    keep default yarn type settings option when resetting pattern file

    Feature request: It would be helpful to have a checkbox option under "reset yarn types from file" to "keep default yarn type settings." That way if one wanted to change the pattern (PTN/WIF) they would not lose the default yarn type settings when they loaded it in.

    enhancement 
    opened by sharktacos 1
  • Zero values for bend breaks shader

    Zero values for bend breaks shader

    Bug: Having zero in the bend will break the shader, meaning the spec goes black. Non-zero values (0.001) work fine. So perhaps the slider should be made so it cannot go to zero, but just a little above that.

    bug 
    opened by sharktacos 1
  • V-Ray Standalone: Incorrect loading of yarn specific float and bool parameters.

    V-Ray Standalone: Incorrect loading of yarn specific float and bool parameters.

    E.g.

    BRDFThunderLoom BRDFThunderLoom { filepath="test2.ptn"; uscale=4; vscale=4; uvrotation=0; yarnsize=List(0.1, 0.2, 0.3); yarnsize_on=List(1,0,1); }

    Won't load yarnsize and yarnsize_enabled values for yarn type 0, 1 and 2. yarnsize_enabled is always 0 and yarnsize will be set to the last value, for all yarn types.

    invalid 
    opened by petermcevoy 0
  • Improve “diffuse” shading

    Improve “diffuse” shading

    The current diffuse shading is quite lacking. To improve this, we should probably look at how it’s done in hair shaders. I believe what we’re after is multiple scattering. The specular reflection is single scattering since the light scatters once before leaving the yarn. I have found this paper: http://www.cemyuksel.com/research/dualscattering/dualscattering.pdf which seems like a good starting point. It is referenced from Pixar’s memo on hair rendering found here: http://graphics.pixar.com/library/DataDrivenHairScattering/paper.pdf I believe @sharktacos has a lot of insight into how this is handled in hair shading

    enhancement 
    opened by vidarn 3
  • Add Thunderloom to Autodesk App store

    Add Thunderloom to Autodesk App store

    The 3ds max and Maya versions of Thunderloom could perhaps be added to the Autodesk App store for easier installation. There are instructions here: https://help.autodesk.com/view/3DSMAX/2019/ENU/?guid=__developer_writing_plug_ins_packaging_plugins_packaging_plugins_html Perhaps this should wait until v 1.0 is done?

    enhancement 
    opened by vidarn 2
  • Feature Enhancement: support for bump/normal maps

    Feature Enhancement: support for bump/normal maps

    It would be nice if the shader worked with bump and normal maps. This is particularly useful in simulating subtle wrinkles in fabric, as seen in this example (currently done with displacement) image

    opened by sharktacos 0
Releases(v0.95.0)
The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation

DirectX Shader Compiler The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) pr

Microsoft 2.2k Jun 27, 2022
physically based renderer written in DX12 with image-based lighting, classic deffered and tiled lighting approaches

Features Classical Deferred Renderer Physically Based shading Image Based Lighting BRDF Disney model (Burley + GGX) Tangent space normal mapping Reinh

Alena 35 Jun 2, 2022
Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics

Yocto/GL: Tiny C++ Libraries for Data-Oriented Physically-based Graphics Yocto/GL is a collection of small C++17 libraries for building physically-bas

Fabio Pellacini 2.3k Jun 18, 2022
Vulkan physically based raytracer including denoising

VulkanPBRT Vulkan physically based raytracer including denoising. The GPU raytracer is based on Vulkan only, as well as for the denoising only the Vul

null 15 May 26, 2022
SoL (for Speed of Light, or sun in Spanish) is a Physically-based rendering library written in modern C++

SoL (for Speed of Light, or sun in Spanish) is a small rendering library written in C++20. Its goal is to strike a good balance between performance and usability, and allow easy experimentation for rendering researchers.

Arsène Pérard-Gayot 10 May 19, 2022
🌞 A physically based monte carlo path tracer written in C++

Physically Based Path Tracer The below 3D model for the Head of Michelangelo's David bust was taken from this link. Other .obj files taken from The St

Aman Shenoy 34 Jun 8, 2022
A modern C++ physically based renderer

The Dakku Renderer Warning: This project is currently under developing and does not guarantee any consistency. About Dakku is a physically based rende

xehoth 6 Apr 15, 2022
Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.

pbrt, Version 3 This repository holds the source code to the version of pbrt that is described in the third edition of Physically Based Rendering: Fro

Matt Pharr 4.2k Jun 22, 2022
appleseed is an open source, physically-based global illumination rendering engine primarily designed for animation and visual effects.

appleseed is an open source, physically-based global illumination rendering engine primarily designed for animation and visual effects.

appleseedhq 1.9k Jun 21, 2022
My computer graphics playground. Currently has a raytracer implemented with D3D11 compute shader.

Graphics Playground I use this project as my "toy" engine. I'll be implementing various graphics projects in this repository. The code here is not sui

Berk Emre Sarıbaş 4 Aug 26, 2021
Blend text in a HLSL shader and have it look like native DirectWrite

dwrite-hlsl This project demonstrates how to blend text in a HLSL shader and have it look like native DirectWrite. License This project is an extract

Leonard Hecker 11 May 24, 2022
Basic framework for D3D11 init, model/texture loading, shader compilation and camera movement.

reed-framework Basic framework for D3D11 init, model/texture loading, camera movement, etc. Instructions: #include <framework.h> Link with framework.l

Nathan Reed 34 May 18, 2022
DirectX shader bytecode cross compiler

HLSLcc DirectX shader bytecode cross compiler. Originally based on https://github.com/James-Jones/HLSLCrossCompiler. This library takes DirectX byteco

Unity Technologies 697 Jun 20, 2022
SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.

SPIRV-Reflect SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications. SPIRV-Ref

The Khronos Group 407 Jun 18, 2022
An OCR Library based on PaddleOCR & OnnxRuntime

An OCR Library based on PaddleOCR & OnnxRuntime

Daniel 0 Mar 27, 2021
Vision-based quadrotor fault-tolerant flight controller.

This repository contains the flight controller, and the vision-based state estimator for a quadrotor subjected to complete failure of a single

Robotics and Perception Group 119 Jun 15, 2022
A path tracer based on hardware ray tracing

GoldenSun GoldenSun is a GPU path tracer. It uses hardware ray tracing APIs to do the tracing. As an experimental project, there is no release plan, n

Minmin Gong 20 Feb 27, 2022
[WIP] A media playback library for Dart & Flutter apps on Windows & Linux. Based on libVLC & libVLC++.

dart_vlc Bringing power of VLC to Flutter & Dart apps on Windows & Linux Installation dependencies: ... dart_vlc: ^0.0.1 Documentation Create a ne

Hitesh Kumar Saini 332 Jun 19, 2022
A terminal-based graphics library for both 2D and 3D graphics.

TermGL A terminal-based graphics library for both 2D and 3D graphics. Written in C, created for terminals supporting ANSI escape codes. Table of Conte

null 200 Jun 19, 2022