Jump to content
  • Sign Up

    Welcome to CANOPY.

    Browse the Forums, read articles in the Library, share your work in the Gallery, get the latest in Downloads

    Want more? Subscribe and get all our assets for a fraction of their asset store purchase price!

  • Using the "Extrusion Pro" plugin for GeNa Pro


    Peter

    The "Extrusion Pro" plugin is an advanced spline extension that allows you to create meshes along your spline in custom shapes. This means you can create things like:

    • Tunnels
    • Bridges
    • Walls
    • Guard rails
    • Sidewalks
    • Dams
    • Trenches
    • Caves
    • Custom road meshes
    • And much more

    So everything where you would need a mesh shape to be created along with your spline, you could use this tool to get a mesh generated that follows your spline shape.

    Trailer:

     


    This feature is an asset of its own available on the Unity Asset Store and in the Canopy Download area.
     

    Installation

    You can install the Extrusion Pro Extension package as any other product via the package manager in the unity editor, or by importing the .unitypackage file

    Usage

    To start using the Extrusion Pro Extension, add the extension to a GeNa Spline, and then set up the options for it.

    It is recommended to follow along with the Quick Start guide in the next chapter to gain a basic understanding of the Extrusion Pro system.
     

    Quick Start

    Begin by creating a Terrain and then creating a GeNa Pro Spline and adding some nodes to it (See the GeNa Pro documentation on using GeNa Pro Splines).

    To create a spline on a terrain: In the Scene Hierarchy panel, Right-Click and select GeNa->Add Spline:

    image.png

    Then Ctrl+Click on the terrain while the Spline is active to add nodes.

    image.png

    To create an intersection, select an existing node and Ctrl+Click somewhere to add another node from the intersection.

    image.png

    Add an Extension to the GeNa Spline by clicking the ‘+’ button in the Connected Extensions section of the Spline Inspector.

    image.png

    Then, select the ExtrusionPro spline extension:

    image.png

    In this exercise, use the example assets that are provided with the Extrusion Pro Extension package.
    Choose one of the example cross sections by clicking on the select object button:

    image.png

    In this case, the ‘Hallway Open Top 01’ cross section was chosen.  This cross section is a good one to start with.

    Choose a material for the extrusion.  For this example, Choose the provided ‘Pipes_01’ material.  Some of the example cross sections are set up to use the ‘Pipes_01’ material already.

    image.png

    You should now have something like the following:

    image.png

    Adjust the Mesh Scale to 3, 3, 3 for this example.

    Summary

    This Quick Start guide gave you an idea of how to use pre-created cross sections. The following sections will provide more details on creating your own cross sections, and how materials are used by the system.
     

    The Cross Section Editor

    Introduction to the Cross Section Editor

    The cross-section editor can be accessed in two different ways.

    ·         Via a window menu

    image.png

    ·         Or from the Extrusion Pro Extension settings:

    image.png

    ·         For example, clicking on the Editor button when ‘Hallway Open Top 01’ is the selected cross section will result in a similar view as:

    image.png

    And this is how the cross section fits onto the extrusion:

    image.png

    Clicking on the ? in the upper right corner of the Editor Window will open the ‘Cross Section Editor Help’ window:

    image.png

    Nodes/Points

    A node/point has a location/position, a normal, and a UV coordinate. 

    The location/position is a 2D coordinate relative to the origin (Model Space). 

    The normal is a normalized direction vector that points to the outside or can be thought to divide space into 2 halves: inside and outside.

    The UV Coordinate is used to define what part of a texture a node/point refers to for rendering.  The V value is set by the user in the UV Editor.  The U value is set during extrusion of the cross section.

    UV Sets

    A UV Set is a set of points, with their location, normals and UVs, that are related such that there is no duplication of a location to change a normal or UV.  A UV Set can be considered a smooth and/or continuous set of points. To put it another way, a UV Set is a section of the extrusion for which you can control the texture mapping and normal behaviour separately from the rest of the other UV sets on the extrusion.

    UV Sets can be created to change the normal direction of one edge in relation to another, creating a sharper looking edge when extruded.

    UV Sets can be used to break up textures using a different set of UVs from one part of an extrusion to another.

    Here we have a smooth shaded (Left: single UV Set for the entire cross section) and a hard shaded (Right: one UV Set per line segment in the cross section) mesh:

    image.pngimage.png
    For example, the ‘Hallway Open Top 01’ cross section has 16 UV sets:

    image.png

    Notice that there are 2 points per location, creating 1 line segment per UV Set, each line segment having a different normal vector than its neighbour’s points.

    Whereas the following cross section has a single UV Set and is smooth shaded:
     
    image.png

     

    Shells

    While there is no direct control over shells, the program will sort UV Sets into Shells based on shared features of the points that are added, and the normal direction in relation to the apparent shell.

    UV Sets are sorted into Shells, where the normal direction and shared points determines what UV Sets are combined into a single Shell.

    A Shell is an Outer Shell if it is wound clockwise, and an Inner Shell if it is wound Counter-Clockwise.  The line segments have an arrow on them to show the direction of each UV Set.

    You can change the direction of a UV Set by flipping the normals and then Sorting the UV Sets.

    image.png

    Sorting UV Sets creates Shells by assuming that the normals should point left of the line segments, and the points are sorted within UV Sets to ensure that case, as well as the order of the UV Sets to ensure continuity of the UV Sets.  The sign of the area of the polygon created by the Shell is then used to determine whether a Shell is an Inner Shell or an Outer Shell.

    The ‘Hallway Open Top 01’ cross section has a Single Outer Shell, but 16 UV Sets. Clicking the Sort UV Sets button will report the statistics of the result in the Console Window.

    image.png

    Cross section ‘Hallway 01’, on the other hand, has 20 UV Sets and 2 shells: one Outer Shell and one Inner Shell.

    image.png

    UV Sets are sorted when the Cross Section is saved, or when the Cross Section Editor is closed, in which case the Cross Section is saved if that results in a change to the order of the UV Sets.
     

    Points Editor User Interface

    Tool bar

    image.png

    New creates an empty cross section that is untitled.

    Save As displays a Save Dialog to allow for saving the current cross section data with a new name.

    Load presents a Open File Dialog to allow for loading existing cross section data.

    Frame sets the position and scale of the Points Editor such that the entire cross section fits.

    Calc Normals (available when the Points editor is active) recomputes the normals for the selected UV Set, attempting to smooth the normals when a UV Set has more than two points. It also obeys the face left rule for normals.
    Shift+Click this button Recalculates ALL unlocked UV Sets.

    Calc UV’s (available when the UV Editor is active) recalculates the V coordinates for a UV Set.

    Flip Normals reverses the direction of the normals in the current UV Set.

    New UV Set creates a new empty UV Set and sets it as the current UV Set.

    Snap Spacing has a toggle and value. When the toggle is on, the Points Editor Grid displays the current snap lines based on the snap spacing value. When adding new points, or dragging points, the points location will be “snapped” to the closest snap lines.

    Snap X and Snap Y enable separate control over the snapping to grid lines.  The snap lines are displayed only in the enabled/toggled on state.

    “?” displays the Cross Section Editor Help window. 

    Status Bar

    image.png

    Selected displays the number of points currently selected. Note: more than one point can occupy a location/position.

    UV Set displays the Current UV Set.  New points are created in the Current UV Set. On either side of the UV Set label are buttons for decrementing (left <) or incrementing (right >) through the UV Sets that exist.

    X and Y display the current world location of the mouse cursor in the Points Editor.

    Points Editor Panel

    image.png

    The Points Editor Panel can be viewed by clicking on the Points Editor tab just below the Tool Bar.  It contains a Grid that is centered at 0,0 and has minor grid lines at 0.1 units and major grid lines at 0.5 units.  It will also draw very minor grid lines at “snap spacing” units when enabled.  All grid lines are relative to the origin (0,0).

    TIP

    When deciding on a size metric for a cross section, one should consider normalizing the size, and then later use the Extrusion Pro Mesh Scale factor of each axis for the actual size to be extruded.  This will allow for fine adjustments to be made at the Extrusion Pro Inspector panel instead of having to modify the cross section. Using a size of 1 in the cross section would then allow for setting the actual size exactly with the inspector mesh scale values. Note that the cross section in the image above was created with the maximum width of the interior to be 1 (X = -0.5 to 0.5) centered across the origin, and all other points were created relative to it.  Also notice the choice to set the bottom most points to be at y = 0, instead of centering the entire cross section about the origin.  That decision was made so that changing the Y scale in the Extrusion Pro Inspector would not affect the extrusions distance from the ground.

    Adding, Selecting and Editing Points

    Left Click on a point to Select it.

    Select a point to adjust it’s normal.

    Ctrl+Click on more points to multi-select points.

    Click and drag a rectangle to select points within that rectangle.

    Click on a point and drag to move the selected points.

    Click on a line connecting 2 points to select those 2 points.

    Use the mouse wheel to zoom the Editor Panel in or out. Use Shift for speed.

    Right Click to bring up a context menu.

    Context Menu

    image.png

    Add Node is available when the current UV Set is empty.  It adds a node/point at the cursor location, with the current snapping state in effect.

    Insert Before is available when a single node/point is selected. It inserts a node/point into the UV Set that contains the selected point before the selected point.

    Insert After is available when a single node/point is selected. It inserts a node/point into the UV Set that contains the selected point after the selected point.

    Merge Nodes is available when more than one node is selected. It sets the location of the selected nodes/points to be equal.

    Edit Point is available when Right-Clicking on a singly selected node.  It will bring up a small dialog box to allow editing of the X and Y text values directly.

    Copy Values is available when Right-Clicking on a singly selected node. It copies the location values that can be pasted to another node/point.

    Copy to New UV Set (various versions) is available when node/points are selected. These create new UV Set(s) for each UV Set being copied.  It only copies the selected points within a UV Set. The destination points can be mirrored about the origin on either the X, Y or both.

    Separate UV Set is available when ALL points in one or more UV Sets are selected. It creates a new UV Set for each pair of points in the selected UV Set(s).
    NOTE: This operation
    will delete
    the UV Sets that are separated.

    Preview Panel

    image.png

    Right Click and Drag to rotate the camera around the extrusion mesh.

    Mouse Wheel to zoom in/out the camera on the extrusion mesh.

    Preview Properties

    image.png

    Click on the Preview tab on the right middle side of the Editor Window to view the Preview Properties.

    A Texture can be selected to use in the material for displaying the preview of the extrusion and to show in the UV Editor.

    Include Hidden is used to toggle whether to show, or not show, any UV Sets that are set to hidden/invisible within the Preview Panel.

    Background is used to set the colour of the Preview Panel background.

    Preview Scale is used to enlarge or shrink the mesh created from the cross section and displayed in the Preview Panel.

    U Scale is used to change the scale of the texturing along the Z axis of the Preview Mesh.

    Extrude Length is used to lengthen or shorten the extruded Preview Mesh.

    Spotlight X, Y, and Z are used to move the spotlight about the Extruded Mesh in the Preview Panel.

    UV Sets Properties

    image.png

    Click on the UV Sets tab on the right middle side of the Editor Window to view the UV Sets Properties.

    image.png

    The lock icon sets the lock state of multiple UV Sets.

    ·         Click to Lock all UV Sets except the current UV Set.

    ·         Shift+Click to toggle All Lock States.

    ·         Right-Click to Unlock All UV Sets.

    Below the lock icon are toggles for each UV Set to individually control their lock state.

    image.png

    The eye icon sets the visibility/hidden state of multiple UV Sets.

    ·         Click to make all but the current UV Set invisible/hidden.

    ·         Shift+Click to toggle All Lock States.

    ·         Right-Click to make All UV Sets visible.

    Below the eye icon are toggles for each UV Set to individually control their visible/hidden state.

    image.png

    The ‘+’ (plus) icon adds a new empty UV Set.

    image.png

    Sort UV Sets sorts all the UV Sets and their points according to the algorithm described here: Sorting UV Sets

    WARNING: using Sort UV Sets will delete all UV Sets with less than 2 nodes/points.

    Sorting the UV Sets will update the direction arrows of the line segments created by pairs of points.

    image.png

    Individual lines will display the properties of each UV Set as well as the toggles for Locked or Visible/Hidden.

    ·         Clicking on the Name of the UV Set will select it as the Current UV Set.

    ·         Right-Clicking on the Name will select, unlock, and set all other UV Sets to locked.

    ·         Clicking its color bar will bring up a Color Dialog to change the display color. 

    ·         The number to the right of the color bar is the number of nodes/points in this UV Set.

    ·         ‘X’ is DELETE. If the number of nodes/points is zero (0), then clicking this will delete the UV Set.  If the number of nodes/points is greater than zero (>0) then it cannot be deleted. 

    ·         Shift+Click ‘X’ to delete all nodes/points in a UV Set. (This will make the UV Set available to Delete).

    UV Editor Panel

    image.png

    The UV Editor Panel can be viewed by clicking on the UV Editor tab just below the Tool Bar.  It displays the current texture being used, which is set in the Preview Properties panel. There are square points displayed that represent the UV coordinate for each node/point in the cross section.  The UV Coordinate is represented as a line (U = 0 and 1) and V.

    The V value can be set by dragging the line that represents it vertically.

    To make it easier to determine which line represents values for a UV Set, click on the UV Set name in the UV Sets properties panel, which will highlight the square points at each edge in the UV display.  Lock all the other UV Sets by Right Clicking the UV Set name that you are interested in, in the UV Sets properties panel to make it easier to edit only the V values of the current UV Set.

    The line that represents a UV Coordinate will be highlighted when the cursor is over it and it can be moved vertically by clicking and dragging.

    As the V value of the UV Coordinate is changed, how it affects the 3D Extrusion is displayed in the Preview Panel.

    When the cursor is over the texture in the UV Editor, the UV Coordinate is displayed in the Status Bar.

    The Calc UV’s button in the Tool Bar will evenly space the V coordinates within the UV Set between 0.0 and 1.0 based on the distance between each points location/position with the UV Set.

    Extrusion Pro Extension Settings

    image.png

    The Extrusion Pro Extension Settings can be found in the GeNa Spline inspector by selecting the Extension in the Connected Extensions section.

    Tag and Layer will be assigned to the generated meshes.

    Cast Shadows and Receive Shadows options will be assigned to the Mesh Renderer of the generated meshes.

    Cross Section is the current cross section to be used for the extrusion. An extrusion can be selected using the object selected icon, or using the Editor button to the right.

    Extrusion Material will be applied to the Mesh Renderer for each mesh generated by the extrude process.

    Mesh Scale is applied to the current cross section as the mesh is generated. The X and Y values are applied to the cross section directly as it transferred to the mesh. The Z value is applied to scale the V value of the UV Coordinate along the length of the extruded mesh.

    Mesh Height Offset is added to the mesh coordinate Y values as the mesh is extruded.

    End Cap selects whether to add an end cap on cross sections.  If an Inner Shell is encapsulated by an Outer Shell, then the end cap will fill in the area between them.

    Auto-Adjust Spline selects whether the Extrusion Pro code should modify the spline to match the extrusion at intersections.  This only has affect if Flat Intersection Type is selected.

    Intersection Settings

    ·         Intersection Type options: None or Flat.  Flat intersections are created where 3 or more curves meet at a Spline Node.  A regular polygon is the basis of the intersection joins of the extruded cross section.  The mesh that is Extruded away from the intersection(s) will be adjusted to smoothly connect with the intersection. Use Auto-Adjust Spline option to control whether the GeNa Spline should be altered to match the extruded mesh near intersections.

    ·         Swap UV’s changes the algorithm for computing intersection UV’s by swapping the UV orientation. This produces a different texture mapping that may be of benefit in certain cases.  Don’t be afraid to enable and disable to see the difference.

    ·         Top Material is an optional material to be used for the Top of the generated intersection mesh. Note that the top of an intersection is the upper center most part of an Outer Shell, therefore experimentation may be needed to determine whether a Top Material or a Floor Material is needed for the proper effect.

    ·         Ceiling Material is used on the upper center most part of an Inner Shell.

    ·         Floor Material is used on the bottom center most part of an Inner Shell.

    ·         Bottom Material is used on the lowest center most part of an Outer Shell.

    ·         Intersection Offset is an extra distance to add to an extrusion intersection away from the center of the intersection. This will create a larger intersection.

    Note that intersection materials may be none/null, in which case the extrusion material is used by default.

    Split Meshes At Terrains is optional for splitting meshes when they are Baked at terrain boundaries and assigning the terrain that the mesh(es) sit on as the parent.

    Noise Enabled. When enabled the mesh vertices will be nudged from the center of the extrusion by an amount influenced by the Noise Factor for each axis.

    Noise Factor affects the amount of influence that noise will have on the extruded mesh.  Each axis can be controlled and is relative to the cross section.

    Bake Extrusion button will copy the generated meshes, optionally splitting them at terrain boundaries, to the scene hierarchy out of the Spline parent, The GeNa Spline will be disabled in the scene hierarchy.  The parent of the new mesh objects will depend on the selected options. If Split Meshes At Terrains is selected, then the split meshes will be parented to the terrain that they lie on, otherwise the meshes will be assigned to a top-level parent named “Baked Extrusions”.

    Making Your First Cross Section

    Start by creating a GeNa Spline and adding an Extrusion Pro Extension and then add a few spline nodes. See Quick Start for a reference to do this.

    Select the Extrusion Pro Extension and click the Cross Section Editor button.

    image.pngimage.png

    Select the ‘pipes_01_D’ texture for display purposes.

    image.png

    Open the UV Sets properties panel where you will see UV Set 0 selected.

    image.png

    TIP

    Creating the left half of a cross section first, then mirroring it across the X origin will make lining up all of the cross section parts easier.  That includes the nodes/points and their values of the relative locations/positions, normals and UV coordinates.

    Start with creating a single UV Set, then splitting it into multiple UV Sets after most of the work is done.

    image.png

    Right Click where the first node/point is to be placed to create an outer shell and select Add Node.  Here the location is -0.5, 0.0 (snap spacing is turned on for snap X and Y.

    image.png

    Add a few more points using Insert After:

    image.png

    Keep all of the new nodes/points to the left of the center of the origin (0,Y).

    Once done with adding nodes, click Calc Normals on the Tool Bar.

    image.png

    Now, go to the UV Editor:

    image.png

    Click Calc UV’s and click on the UV Set name:

    image.png

    Notice that one of the nodes/points on the left and right at the bottom has a diamond drawn in the rectangle. This signifies the first node/point in the UV Set.

    Adjust the V coordinates by clicking and dragging a highlighted line. Notice the change to the texturing on the mesh in the Preview Panel as you move the UV Coordinate lines.

    image.png

    Now, click on the Points Editor tab.

    image.png

    Ensure that all nodes/points are selected, and the Right Click and choose Separate UV Set.

    Shift+Click Calc Normals.

    Now, select all of the nodes using the rectangle selection method (Click and drag):

    image.png

    Right Click and select ‘Copy to New UV Set X mirrored’.

    image.png

    Click on the Frame button.

    image.png

    This will ensure that all of the nodes/points are within the frame of the Points Editor.

    image.png

    Connect the 2 halves of the cross section with 2 new UV Sets.

    Select the + button in the ‘UV Sets’ properties panel or the ‘New UV Set’ button in the tool bar.  Important: Right Click on the new UV Set name, which will lock all other UV Sets and prevent them from being selected or edited. Then Add Node from the top left node/point and then Insert After a node at the top right node/point.

    image.png

    image.png

    Repeat the process of creating a new UV Set, Right Click select it (locking all other UV Sets), and Add node and Insert After, to create the floor UV Set:

    image.png

    Right Click the Lock icon in the UV Sets properties panel to unlock all UV Sets.

    Click on the “roof” line, which will select the points and the UV Set for that line.

    image.png

    Shift+Click Calc Normals, which will Recalculate ALL Normals.

    image.png

    Then Right Click on the selected UV Set name, locking all other UV Sets.

    image.png

    Select the UV Editor tab and adjust the roof UV’s to show the part of the texture that is the roof texture.

    image.png

    Unlock all of the UV Sets (Right Click the lock icon) then repeat the process to edit the UV coordinates for the Floor UV Set.

    image.png

    Click the Save As button on the Tool Bar and name and save your Cross Section asset.

    image.png

    Next, Add the Extrusion Material to the Extrusion:

    image.png

    The size of the mesh can be changed using the Mesh Scale property of the Extrusion Pro Extension Settings:

    image.png

    An inner shell can be created using the same technique, only creating the points in a counter-clockwise order.  That would create an interior for a hallway.

    See the provided cross sections for other examples.

    Thanks for reading and following along!

    • Like 5

    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...