I’ve created a small python script to generates 1 pixel lines that to be used with anisotropic shaders. I’m attaching the blend file, the textures and pasted here is the python script that generates them*.
blend file:
from PIL import Image, ImageDraw
import random
import math
def drawVerticalLines( size, draw, deviation, skip ):
for p in range( 3 ):
for x in range( 0 , size[0] , skip ):
color = tuple( [ random.randint( 0 , 255 ) ] * 3 )
offset_x1 = random.randint( -deviation , deviation )
offset_x2 = random.randint( -deviation , deviation )
coords = ( x + offset_x1, 0 + offset_x1, x + offset_x2, size[1] - offset_x2 )
draw.line( coords , color )
def drawHorizontalLines( size, draw, deviation, skip ):
for p in range( 3 ):
for y in range( 0 , size[1] , skip ):
color = tuple( [ random.randint( 0 , 255 ) ] * 3 )
offset_y1 = random.randint( -deviation , deviation )
offset_y2 = random.randint( -deviation , deviation )
coords = ( 0 + offset_y1, y + offset_y1, size[0] - offset_y2, y + offset_y2 )
draw.line( coords , color )
def drawCircular( size, draw, deviation, skip ):
center = ( size[0]//2 , size[1] //2 )
for r in range( 1, max( center[0], center[1] ), skip ):
offset_r1 = random.randint( -deviation , deviation ) // 2
offset_r2 = random.randint( -deviation , deviation ) // 2
offset_r3 = random.randint( -deviation , deviation ) // 2
offset_r4 = random.randint( -deviation , deviation ) // 2
color = tuple( [ random.randint( 0 , 255 ) ] * 3 )
draw.ellipse( ( center[0] - r + offset_r1,\
center[1] - r + offset_r2, \
center[0] + r + offset_r3, \
center[1] + r + offset_r4 \
) , outline=color )
def generate_scratch_image( size , deviation , skip, horizontal, vertical, circular ):
im = Image.new( "RGB" , size )
draw = ImageDraw.Draw( im )
if vertical:
drawVerticalLines( size, draw, deviation, skip )
if horizontal:
drawHorizontalLines( size, draw, deviation, skip )
if circular:
drawCircular( size, draw, deviation, skip )
return im
if __name__ == "__main__":
size = ( 2048 , 2048 )
deviation =32 # how parallel are the scratches 0 = paralel, > 0 more inclined
skip =4 # how thick are the scratches 0 = nightmare, > 0 thicker
im = generate_scratch_image( size , deviation , skip , horizontal=True, vertical=False, circular=False )
im.show()
im.save( "c:\scratch_2048.png" , "PNG" )
- requires python standalone and PIL. Also I’m no coder so this may be messy