diff --git a/README.md b/README.md index e69de29..8205d44 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,87 @@ +# Scratch +An OSL shader that generates texture to make swirly micro scratch look by controlling the anisotropy and roughness. + +It works well with both metal: + + + +and dielectric: + + + +The original idea is based on Hang Li(悬挂鲤)'s article. Here I implemented it using OSL and exposured some arts friendly parameters. + + +# Parameters + +### density +Controls the heaviness of the scratches. + +More scratches takes longer to generate. + + + + + +### roughness default/min/max +*default* values set the roughness of areas that isn't scrached. + +*min/max* controls the range of roughness randomness. + +Bigger roughtness makes the swirl longer along it's direction. + + + + + +### anisotropy default/min/max +Similiar to roughness default/min/max, but namely controls the anisotropy. + +Bigger anisotropy enlarge the swirl radius. + + + + + +### offset +Rotation offset. + +> ##### 💡 Tips +> Tweak this parameter to achieve some intersting effect, like radiant or spiral scraches! + + + + + +### width +Width of the scratches, in UV space. + +> ##### 💡 Tips +> 0.001 is a good value to start with. + + + + + +# Output + - R: Should be connected to *roughness*. + - G: Should be connected to *rotation* of anisotropy. With arnold you should add a aiNegate and set the offset to 0.25. + - B: Should be connected to *anisotropy*. + + +# Usage + +Take a look at the examples under "example_scenes/". For now there are only mtoa and Clarisse scenes shipped. But anyone is welcome to contribute any DCC oriented examples. + +For clarisse: + +![](./images/clarisse.png) + +For maya: + +![](./images/maya.png) + +(Of course, again, the compatibility is not limited to the DCCs listed above.) + +Note that the definition of "Anisotropic Rotation" is slightly different between Clarisse and Arnold. That's the reason that in maya we need some conversion when handling the rotation attribute. + diff --git a/images/0092.png b/images/0092.png index bb91f2d..2faecd5 100644 Binary files a/images/0092.png and b/images/0092.png differ diff --git a/images/0099.png b/images/0099.png index 4ba4adf..b8e803f 100644 Binary files a/images/0099.png and b/images/0099.png differ diff --git a/scratch.osl b/scratch.osl index f26cee8..e79046f 100644 --- a/scratch.osl +++ b/scratch.osl @@ -1,6 +1,12 @@ // Micro Scratched Texture -// Author: John Su -// Based on the idea of +// +// Author: John Su +// +// An OSL shader that generates texture to make swirly micro scratch look by +// controlling the anistropy and roughness. +// The original idea is based on Hang Li(悬挂鲤)'s article. I just implemented it +// using OSL and added some arts friendly parameters. + #define DIVISION 40 #define DEBUG(_) Cf=_; return;