From BlenderWiki

Jump to: navigation, search

Castle

Create a block/stonework "Castle-like" object

Many components are available to create a "Castle" object. A simple "3D plane" defines the "base" (foundation) which affects the walls and many other options. In combination they result in an object that represents a medieval style Castle.

The overall "space" of the castle, offset from the current 3D cursor location, is determined by the width and depth of the base, the height of the wall, levels (vertical repeat for wall), along with the sizing and location of other features such as: Dome, Steps, Shelf and Openings.

Source: Download from the Task. The source scripts are located in a sub-folder named "add_mesh_castle" in the "addons_contrib" directory. See Using Add-ons for standard procedure to access the features documented here.

Questions or comments may be posted in the Task or chat in IRC (#blenderpython).

Documentation is always in progress and seldom if ever matches the code. There are No Guarantees that the user experience for Blender, UI, features, or screen-shots are the same as this documentation.

There is only one object per "Add". Every time a property is changed it replaces the current object; no undo for individual parameters. This includes modifying the color/material value which will regenerate for each "shift" in value.

Options when disabled will collapse to simplify the user interface and exclude related selections. You will need to "select" some options in order to modify the properties. Turning off an option will preserve any changes made, displaying last setting if enabled again.

check-boxes CheckBox.png for Front, Left, Back and Right create an optional "wall" for each side of the castle that track with the "base" dimensions. Similarly stairs, shelves, and openings can be enabled for each "wall".

The "color picker tool" ColorPicker.png is used to set the material (RGB/color) for many elements. Warning: each "change" to the color will regenerate the "Castle"; slow performance and affects "randomization" results.

UI (toolbox) parameters are primarily presented in a table:

Name Value Description

The "Value" setting is typically the maximum limit for a specific parameter that may be constricted by other user selections. It may also may be a check-box or "drop-down" selection. Value minimums are usually 0, sometimes forced to be "not 0" (0.01) or may allow a negative.

Default values/settings are subject to change and are intended for "simple use" and "ease of viewing", not a final product; they are a starting point, not a formal way on how to use what is available or limit what can be done other than within the intended design.

Blender3D FreeTip.gif
Default values
Use the "Right Mouse Button" RMB Template-RMB.png to restore the default value for a specific parameter.
Exclamation mark.png
There are abstract/experimental options provided that are not intended as part of the primary usage. So far they have not proven to be problematic. Regardless, any issues that are encountered should be reported as they may apply to the general operation.

CastleSample.png
Sample render thanks to TynkaTopi (using VRay)

Construct

The "Construct" flag is provided to prevent replacing the object for each modification, when off the object will not be generated. This is for performance reasons and prevents the "disappointment" of intermediate results that won't be preserved when changing any other options.

Base

Width and Depth define the base limits. These settings affect the sizing of the walls and Dome.

Material
ColorPicker.png
Set material RGB/color.
Width 100 x dimension of castle base.
Depth 100 y dimension of castle base.
Thickness 100 The base/floor thickness is limited to block size.
BloX
CheckBox.png
Create the floor using block settings, otherwise a simple "plane" with single faces is used.
Round
CheckBox.png
When "BloX" is selected the base may be made circular (a disc).
Levels 10 Repeat wall(s) vertically.

Blocks

Create a "surface" with "blocks". Define the the block distribution in the area; columns (width), rows (height), and thickness (depth).

Vertical or Horizontal orientation will determine how some measures are used (i.e. floor (horizontal plane) depth = height).

Merge
CheckBox.png
Create "larger" blocks, a single block in place of two (combine/converge), when the distance/gap between blocks are "very close". Does not apply if Variance is zero (0).
Edging 100 Stagger blocks [alternate rows] on ends of wall. Set to 0 for "flat"/square ends, set greater than "Block Depth" for extruded corners.
Gap 100 The "space" between blocks.
Width 100 Horizontal block size division (column) over wall area.
Height 100 Vertical block size division (row) over wall area.
Depth 100 Block depth, thickness of blocks.

Each "size" (width, height, depth) setting has a Variance (randomization) and a Minimum (size limit) - the minimum is determined programmatically. The variance value applies a "random (+-)" difference to create an uneven appearance to the blocks; hopefully creating a more realistic result. Minimum is a lower limit that the variation can result in.

Variance 100 If Variance is 0 blocks will be consistent (same size) over area; something more like bricks. Except: top and bottom rows are usually taller by design; openings may "force" some rows to be a different size.

Advanced Blocks:

Change the block size - even if you plan to scale it later - yes, you should make them smaller to add "detail" to the general appearance; big blocks randomized make a great result too.

Set Variance to more than related property value for interesting effects, especially with Depth - "Big Blocks" effect for all directions.

Extrusions may be obscured by wall blocks if the depth is greater than step or shelf sizing.

Walls

A check-box is provided for each side to create a wall, per level; works in conjunction with "Modifiers".

Level 10 Display parameters for selected level, also applies to modifiers.
Material
ColorPicker.png
Set material RGB/color, does not change per level.
Height 100 Vertical wall size, not zero, does not change per level.
Roof
CheckBox.png
A horizontal "plane" offset from the top of the "first floor" wall height by crenelations and block height, indented from the wall by steps.

Wall Modifiers

Modifications to a wall include "Openings" and "Extrusions".

Openings create "holes" in the wall that may be used as doors, windows, crenelations, and other features. The "openings" are similar but individual in order to provide multiple options for the user.

Extrusions extend blocks from wall to create steps or shelf (balcony) using block sizing to fill the area.

A check-box is provided for each wall to enable an option, per level.

Openings

The width (X+), height (Z+), indent (X), and Bottom (Z) define the area and location for the "hole".

Arches "extend" the hole based on curve; if curve is less than half of width it will be smooth, else pointed.

to do
 Fix script errors when overlapped with Slots (repeat most common failure).

Door

Create a "door" opening in the wall.

Dupe
CheckBox.png
Distribute openings across the Wall Area, centered to wall area, based on Opening Width and Indent. Set Indent greater than Width to separate openings when using repeat.
Width 100 Horizontal size of opening, centered from Indent.
Height 100 Vertical size of opening, center offset from Bottom.
Indent +-100 Horizontal center of opening, works with repeat to space openings over wall area.
Bottom +-100 Vertical center of opening. Set to Wall Area Bottom plus half of Opening Height for a door (no blocks across lower part of opening).
Bevel +-10 Taper blocks surrounding opening, use negative values to taper "back side" of blocks. Bevel will create a "tapered" stone effect by reducing the interior edge according to setting. If Bevel exceeds block size (height, width, or arch thickness) odd results may occur.
Arches
CheckBox.png
Leave arches off for square openings, or set Curve to 0. Use Top or Bottom arch to set the curvature of the opening.
Curve 100 Set the curvature for the opening, 0 will be square. A Curve under half the opening Width will be smooth/flattened, otherwise it is "pointed".
Thickness 100 Set the "girth" of the arch stones, works with Bevel.

Window

The "Window" opening is very similar to the "Door" and other options and is provided to allow multiple "styled" apertures in the wall.

Dupe
CheckBox.png
Distribute openings across the Wall Area, centered to wall area, based on Opening Width and Indent. Set Indent greater than Width to separate openings when using repeat.
Width 100 Horizontal size of opening, centered from Indent.
Height 100 Vertical size of opening, center offset from Bottom.
Indent +-100 Horizontal center of opening, works with repeat to space openings over wall area.
Bottom +-100 Vertical center of opening. Set to Wall Area Bottom plus half of Opening Height for a door (no blocks across lower part of opening).
Bevel +-10 Taper blocks surrounding opening, use negative values to taper "back side" of blocks. Bevel will create a "tapered" stone effect by reducing the interior edge according to setting. If Bevel exceeds block size (height, width, or arch thickness) odd results may occur.
Arches
CheckBox.png
Leave arches off for square openings. Use Top or Bottom arch to set the curvature of the opening.


to do
 Add "Thickness" for window block sizing.

Advanced Window:

Create a circular "window" when arches are selected by setting the height to minimum.

Create a "solid wall" by setting the window "Base" above the wall height.

Slots

Narrow slits (default settings); meant for view/arrow ports. However, properties can be modified to replicate similar results to standard "Openings".

Arches are (extended) outside of opening area.

Dupe
CheckBox.png
Repeat openings across the Wall Area, centered to wall area, based on Opening Width and Indent. Set Indent greater than Width to separate openings when using repeat.
Width 100 Horizontal size of opening, centered from Indent.
Height 100 Vertical size of opening, center offset from Bottom.
Indent +-100 Horizontal center of opening, works with repeat to space openings over wall area.
Bottom +-100 Vertical base of opening. Set to Wall Area Bottom plus half of Opening Height for a door (no blocks across lower part of opening).

Advanced Slots:

Bug/feature: overlapping openings create "blocks" in common (overlapped) area. For slots this appears to be a problem, when using both Vertical and Horizontal, but, when you match (overlap) slots to "standard openings" you get an inverse block creation that you may like.

Crenels

Crenelation are gaps along the top of the wall. Sizing is a "ratio" of the wall area, 1 = 100%.

Width  % Create repeated openings across top of wall area. Minimal block size area will be created so Crenelation width cannot actually be 100% and thereby clip top of wall.
Height  % Vertical size of opening offset from top of wall. 100% will result in block shaped "columns" by exclusion.

Extrusions

If [half] block "Depth" is more than step/shelf "Depth" it will obscure the element [not visible].

Steps

Add extruded incremental levels in defined area to create steps; left or right oriented. Uses block sizing values for block widths; does not vary gap/grout. Steps fix block height to "riser".

The "Riser" and "Tread" determine the step sizing. If the "combined" values do not fit within the "area" the steps may not reach the top (Height).

Slant
CheckBox.png
Reverse "start" to be on right of area; Lower Left to Upper Right is default construction.
Fill
CheckBox.png
Cantilevered steps are default that do not have supporting blocks, select this option to generate blocks in step "area". Blocks used to "fill" each row are based on wall block width settings.
Out
CheckBox.png
Reverse Y so steps are "behind" wall.
XOff +-100 Horizontal origin.
Base +-100 Vertical origin.
Width 100 Horizontal area of steps offset from Horizontal origin.
Height 100 Vertical area of steps offset from "Bottom".
Depth 100 Thickness of steps.
Riser 100 The height for each step.
Tread 100 The "footing" (width) for each step.


to do
 fix Bug: Single step max not clipped to step "area".

Shelf

Add blocks to wall to make a platform, protrusion, in defined area. Uses block sizing values for rows and block widths.

Left +-100 Horizontal origin.
Bottom +-100 Vertical origin.
Height 100 Vertical size of shelf.
Width 100 Horizontal size of shelf.
Depth 100 Thickness of shelf.
Out
CheckBox.png
Reverse Y so shelf is "behind" wall.

Dome

A dome shape is created related to the castle base and block settings with minimal modifications - color, height, and the vertical location of the dome.

Material
ColorPicker.png
Set material RGB/color.
Height 100 Dome height.
Base 100 Vertical offset from floor.

Experimental

Curve: Curve wall along y-axis, with top as origin; bottom will be offset from cursor.

Tunnel: Curve wall along y-axis, with top as origin; bottom will be offset from cursor.

Tower: Create a (separate) curved wall, no options, rotate and place. Meant to be a tower/turret but need to work on openings and circumference; eventually roofing.

Blender Tools

Modifications you may want to apply to an object using built-in Blender capabilities.

Bevel

Square blocks minimize the number of vertex points and faces but look artificial; put a bevel on the blocks to improve the general appearance.

Warning: Adding bevel will [at least] double the time it takes to render object - use this modifier sparingly; and it's best to wait until you're "almost done" before using it.

Properties>>Tools

Add Modifier - Select Bevel Scale: 0.10 works just fine... :)

Texture

Put a "finish" on your stone-work: This example describes using an image texture for simplicity. A "good" image, in this use case, will be large and have a lot of detail. The texture is applied to the object, not individual block elements.

The following is basic, and standard procedure for applying a texture to an object.

Select the object Properties>>Material

Add a new material. Name it Wall-Material.

Properties>>Texture Add a new texture. Name it Wall-Texture.

Set "Type" to Image.

Under Mapping tab, select Cube for projection.

Under Image tab, "Open" and select texture image.

Sampler

This shows the result of the options, as presented in Blender, that may be used to generate a Castle. It is not a reasonable design.

CastleAll.png

Credits

This script is NOT original and would not be possible without the help of many others. The code was developed using examples from many scripts, along with guidance/support/suggestions from many in the Blender community.

Particular thanks to the originators and support for this project: Dudecon, Meta-Androcto, TynkaTopi, antonioya, campbellbarton, mont29. And to think it all just started with "fixing" the Column.py script for 2.7x releases.