Strips OSL Shader: subdivide a uv map into strips and slots

In an ongoing effort to search for methods that can be used to generate bark textures I devised this simple OSL shader: it takes a uv-map (for example one that is wrapped around a cylinder representing a branch ans subdivides this in to strips. These strips are then subdivided into slots and each of these slots is given its own uv map and a random value.

This simple setup makes it possible for example to combine two tileable images in a manner that resembles bark an knots or cracks in that bark. The example below shows the result with two simple black and white images, mapped to a plane a a cylinder:

The underlying slots look like this:

Example node setup and code availability

The example node setup used to create both of the images above looks like this (click to enlarge):


The shader is availble on GitHub along with two sample textures: 1, 2.
The code should contain enough comments to get you going, but just tweaking the input parameters based on the example noodle should get you a long way.


If you would like to know more about programming OSL you might be interested in my book "Open Shading Language for Blender". More on the availability of this book and a sample can be found on this page.

3D printing an H0 scale stone bridge: the result

I sent my bridge design to the printers and I am quite pleased with the result as it came back from Shapeways, especially the detailing. Even though it's done in Strong and Flexible (as opposed to Frosted detail) the stonework shows up nicely. I will be painting it the coming weeks but as that has nothing much to do with Blender I'll probably will document that on my model train blog.


3D printing an H0 scale stone bridge: detailing

Added all the brickwork and some randomness along with an ornament on the cap stone: