Go back

Scripting

Skip to:
Generate Maze
Extrude

User Interface

Generate Abstract Maze

    code  |  changelog  |  back to top

The initial idea for this was to create a maze, but I was constantly trying new ideas out, to improve my scripting skill and also try get a nice looking result.
It basically runs by choosing a direction, checking the list of points to see if any exist in that space, then placing the point if not. I worked hard on the automatic calculations, as the user does not want to be setting each variable for each generation, but with half a dozen other factors going into some of these calculations, getting it fully working with most values was ridiculously hard.

For example, this part of the code is to figure out how fast the generation should be:
    if forks == 0:
        forksTemp = 1
    else:
        forksTemp = forks
    cubeSkipTemp = 0.7 * loops ** 0.1 * forksTemp*forkLength * pow(1.05, pow(forkLength/forksTemp,0.1))
    cubeSkipTemp = cubeSkipTemp * autoSetMultiplier / (600 + (forksTemp + forkLength) * (1.0/degrees) * 20)
   
    if cubeSkipTemp < 1:
        frameSpacingTemp = forksTemp/4.0*((1/cubeSkipTemp)/(degrees * 3))
        if frameSpacingTemp < 1:
            frameSpacingTemp = 1/frameSpacingTemp
        cubeSkipTemp = 0
        frameSpacingTemp = pow( frameSpacingTemp, 0.5 )
       
    else:
        frameSpacingTemp = 1
       
    if autoSet == True:
        cubeSkip = cubeSkipTemp
        frameSpacing = frameSpacingTemp

A full list of features in the code is as follows
    Generates 2D or 3D line in random directions, places cubes as visual representation
    Cubes can decrease in size if set by user
    Can draw outwards spiral and attach tracking camera to show the generation in real time (size of spiral is based on the calculated final size)
    Calculates frame for each cube to appear in based on either automatic or user set values
    Get the location or size of an existing object (to begin generation at this point)
    Turn off the grid and enable viewport 2.0 with SSAO, motion blur and anti-aliasing (for use with the generation preview camera)
    Run multiple loops of the code, using either automatic or user set distance limits
    Choose a direction of generation (depending on a value, the code will follow this rule more strictly, currently set by me but I'll add it to the UI soon)
    Creates blended materials between any number of colours
    The colour values are stored in a basic way, and the right click menu will format it into a user friendly list
    Colours the cubes on generation, checks in place to stop too harsh changes in colour if possible
    Re-run the colour calculation on any generation
    Custom outliner code to list only the generations
    Progress bar as some generations can take hours

User Interface



Extrude City Like Object

    back to top

Plane Generation

Cube Generation