MHDB Article ID: ACAO20210810
MHDB Article date: 10 August 2021
MHDB Article Author(s): Staff
Cobblestone Street Procedural Generation
One of the oldest features of the Medieval History Database is a system for reconstructing medieval castles, cities and other locations. One of the
newer additions is a GPU program (fragment shader) which can procedurally generate cobblestone streets in a variety of forms. Procedural generation - i.e. using
mathemtical algorithms to create the illusion of randomness - adds to the sense of realism by breaking up patterns that would otherwise appear artificial. E.g.,
random puddles of water can be generated based on settings, or patches of moss growing over some areas of cobblestones or in the cracks between stones. Of course,
the term "random" is slightly misleading since mathematical algorithms are not literally random, but they can produce the illusion of random occurrence by avoiding
Among the options currently programmed into the shader:
• The surface patterns used for the cobblestones can be modified to change the appearance (e.g. square, brick-like, irregular, etc).
• The water level for filling the cracks in between cobblestones can be adjusted.
• Random puddles can be generated, with settings to determine the average frequency, size, etc of puddles.
• Patches of moss, grass, dirt, etc can be overlaid procedurally on the cobblestones in addition to water.
• The reflectivity and tinting / muddiness of the water can be adjusted, varying the color tint, opacity, strength of reflection, etc.
• The specularity (how brightly light glints off edges, surface details etc) and "metallic" appearance (how much the stone resembles a metal surface) can be modified for the cobblestones.
Below is a screenshot showing procedural puddles pooling in certain places and lines of water filling the gaps between cobblestones, reflecting the buildings in the background.
Below : another screenshot showing the randomized puddles and effect of water filling in the cracks between cobblestones.
Below : mossy patches on the cobblestones in addition to water puddles.
Below : moss or grass in the cracks between the cobblestones without any puddles (only slightly wet cobblestones which create a very faint reflection, slightly
visible on the opposite side of the street).
Below : variation with cobblestones protruding more noticeably from the pavement but in an uneven pattern, with puddles that are tinted slightly greenish.
Below : dim lighting showing detailed surface of the cobblestones.