Skip to content

BrettRToomey/forge

 
 

Repository files navigation

forge

Procedural Modeling plugin for Unity3D.

Creating procedural assets

Procedural Assets are created by subclassing Forge.ProceduralAsset and overriding the Build() method which should return a Geometry instance. Forge.ProceduralAsset itself subclasses MonoBehaviour, meaning that you can add the script to an empty Game Object.

Exposing public parameters works perfectly as a way to parameterize your procedural asset via the built-in Unity editor.

The classes are designed to work well with a node-based visual editor, where the connections are instances of Geometry being passed from one class instance to the next.

When appropriate, they can receive one ore more geometries as input by implementing Input(), have public fields to parameterise their actions and must implement Output() to pass on the resulting geometry.

Primitives

  • Point
  • Line
  • Triangle
  • Square
  • Cuboid
  • Circle
  • Cylinder
  • Hemisphere
  • Sphere

Filters

  • Bridge: Connects adjacent polygons in the input geometry with triangle faces. Ex. two or more circles positioned vertically creates a cylinder.
  • Converge: Adds a vertex at the specified point and creates triangle faces from every two original vertices to that new point. Creates shapes like pyramids and cones.
  • ExtractFaces: Outputs only the faces (and their vertices) specified by an array of face indices.
  • ExtractVertices: Outputs only the vertices specified by an array of face indices.
  • Fuse: Fuses vertices together based on a threshold distance, creating contiguous surfaces and averaging their normals. Results in a "smooth" shaded surface. For now this is a naive, expensive O(n^2) operation.
  • Manipulate: Manipulate the geometry basic transforms: Position, Rotation and Scale.
  • Merge: Merges one or more geometries into one.
  • Mirror: Outputs the mirrored image of a geometry along a specified axis.
  • Polygonize: Outputs a polygon with line segments connecting all the vertices of the input geometry in their index order.
  • Reverse: Reverses the order of vertices in each triangle face, inverting the face normal.
  • Triangulate: Triangulates a 2D polygon.

About

Procedural Generation toolkit for Unity3D

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%