Created
December 4, 2023 07:38
-
-
Save thomashollier/474b521e3afbaf86cb7e06631d4222c1 to your computer and use it in GitHub Desktop.
seExpr script to make a jerusalem stone texture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$noiseBigU = fbm([$u*8, $v*8,1],6,2,.75); | |
$u = $u + $noiseBigU*.005; | |
$noiseBigV = fbm([111+$u*8, 111+$v*8,0],6,2,.75); | |
$v = $v + $noiseBigV*.0025; | |
# number of horizontal bands | |
$vNum = 20; | |
# variation in width of horizontal bands | |
$vVar = 0.35; | |
# horizontal noise | |
$vNoise = noise($v*$vNum)*2-1; | |
$vNoise = $vNoise * $vVar; | |
# v2 is the noisy horizontal grad | |
$v2 = $v*$vNum+$vNoise; | |
# give each row an index | |
$rowIndex = floor($v2); | |
#give each row a random value | |
$rowRandom = hash($rowIndex); | |
#### End of rows | |
# min and max number of bricks per row | |
$uNumMin = 9; | |
$uNumMax = 12; | |
$uNum = compress($rowRandom, $uNumMin, $uNumMax); | |
# | |
$uVar = 0.35; | |
$uNoise = noise($u* $uNum * .5)*2-1; | |
$uNoise = $uNoise * $uVar; | |
$u2 = ($u * $uNum + $uNoise) + ($rowIndex) * .5 + ($rowRandom-.5) *.5; | |
$colIndex = floor($u2); | |
#### End of cols | |
$v2Ramp = fit(abs(fmod($v2,1)*2-1),.4,1,0,1); | |
$u2Ramp = fit(abs(fmod($u2,1)*2-1),.4,1,0,1); | |
# normalize grout aspect ratio thickness | |
$v2Ramp = fit($v2Ramp,0,1,1-($uNum/$vNum),1); | |
$grout1 = gaussstep(1-((1-$u2Ramp)*(1-$v2Ramp)),.99,1)*1; | |
$grout2 = gaussstep(max($u2Ramp, $v2Ramp),.95,1)*1; | |
$grout = 1-((1-$grout1)*(1-$grout2)); | |
#### End of grout | |
$brickIndex = ($rowIndex * $uNum) + $colIndex; | |
$brickRandom = hash($brickIndex); | |
$out = $brickRandom * (1-$grout); | |
$color = [$out,$out,$out]; | |
$color |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment