This include file was originally created to produce hull plating for the spherical and cylindrical parts of a space vessel. However, it can also be used to easily produce brick patterns which will wrap around a cylinder or sphere.
The picture below shows two applications of the macros in the include file. Each object shows a cylinder topped by a sphere, with the appropriate pattern applied to each component.
The macros in the include file were designed to meet specific criteria:
The include file plates.inc contains two macros, MakeSphericalPlates and MakeCylindricalPlates. The syntax for both macros is identical:
MainRad is the radius of the sphere or cylinder to which the texture will be applied.
PWidth describes the desired width of the bricks. The macro may slightly adjust the actual width of the bricks on a row-by-row basis to avoid the inclusion of partial bricks (the full-sized bricks are expanded slightly to fill up the row). In spherical patterns, the widest edge of the brick is given the full width (the bottom edge if the brick is above the equator, or the top edge if the brick is below it).
PHeight describes the desired height of the bricks. As with PWidth, the macro may adjust this value (if creating a spherical brick pattern) to ensure that all rows are the same height. (Height is measured from the "top" edge of the brick to the "bottom", not just its Y-axis value.)
JWidth is the width and height of the joins (or mortar) between the plates or bricks. Half of this value is removed from the left and right sides of each brick, and also from the top and bottom.
PlateTex is the texture to be applied to the plates or bricks. If this is to be a definite pattern, such as a grid, hexagons, horizontal or vertical stripes, make sure the texture is aligned so that it lies in the XY plane, facing towards -Z; it will be rotated so that it lies on the face of each brick in the pattern, and translated by a certain amount so that each brick shows variations from its neighbours.
JoinTex is the texture to be applied to the joins (mortar) between the plates. It is not rotated like PlateTex is.
NOTE: The texture will be created at the origin. If the object to which it is to be applied is not also centred at the origin, you will have to translate and/or rotate the texture into the proper position.
Because the macros do a lot of math, and there's a fair amount of scaling, translating and rotating, these textures can take some time to parse and render. The more complex the texture to be applied to the brick faces, the slower it will render.
Although the cylindrical brick pattern staggers the bricks evenly from row to row, this is not possible with the spherical pattern. There will be spots where the bricks appear to line up vertically with the bricks above or below them, and will gradually shift to staggered patterns. This is an inevitable result of keeping the bricks at the same basic size at the same time the rows change in diameter; it is not a programming error.
Version 1.2:Alternate code added for cases where everything fits within a single blend_map. This greatly speeds up rendering in those cases. Textures which exceed the limit are still rather slow.
Version 1.1: The blend_map limitations in version 1.0 have been removed, thanks to Ron Parker's excellent suggestions.
Because the version 1.0 did not allow turbulence, warps or other modifiers to be used with the textures, the macros no longer wrap their output in a texture{} statement.
Fixed a bug in the code which rotated the brick face texture to proper placement on the spherical texture.
Because the spherical textures can take some time to generate, the user may now #declare the identifier platedebug to a nonzero value in order to see a basic status report.
The zip archive below contains the plates.inc include file, a sample scene (plates.pov) and basic documentation.
You may use these files as is, or modify them for your own use. If you fix a bug or add functionality which you feel would improve the macros for all users, please notify the author so that your changes can be put into the "official" version (and you will be given full credit for your contribution).