Skip to content

Instantly share code, notes, and snippets.

@ChrisHinde
ChrisHinde / imggen_randompatches.py
Last active August 21, 2023 14:43
Image texture generators for Array Modifier "instance ID"
# imggen_randompatches.py
#
# Python script to generate an image with greyscale "patches"
# from black (0.0 / 0) to white (1.0 / 255) in random order
#
# CC-BY Chris Hindefjord - chris.hindefjord.se - 2023-08
#
# Tested with Python 3.9.2
# NB: Requires the PIL/Pillow library!
#
@ChrisHinde
ChrisHinde / instance_grid_random.osl
Last active August 21, 2023 15:26
OSL-script that generates a random (greyscale) value per “instance”
shader InstanceGrid_Random(
point proj = point(u, v, 0) [[string label = "Projection"]],
int cols = 10 [[string label = "Columns", int min=0, int max=1000]],
int rows = 10 [[string label = "Rows", int min=0, int max=1000]],
int utime=1 [[string label = "Time", int min=0, float max=1000, float sliderexponent=2]],
int fulluv = 0 [[string label = "Use full UV", string widget = "boolean"]],
int invert_u = 0 [[string label = "Invert U", string widget = "boolean"]],
int invert_v = 0 [[string label = "Invert V", string widget = "boolean"]],
output color c = 0 [[string label = "Instance ID"]]
)