TutorialsAdding polygons; Introductory
Creating smooth-edged blocks; Intermediate
Group Properties window; Introductory
For this tutorial we are going to create a very simple fish. This is a convenient 3D model to produce from scratch because it is relatively flat and much of the time we will be working in 2D.
We will add polygons one by one using the Add Polygon function. Load 3DMatrix and ensure that the 'XY Orthogonal View' window is open (shortcut 'z'). Use the '3DMatrix' window to control which other windows are opened. Next open the Polygon Properties window (shortcut 'p') and press the 'Add polygon' button to add our first polygon. It is worth remembering the keyboard shortcut 'a' for adding polygons.
While adding polygon, as you move the mouse cursor over any of the Orthogonal View windows you will see the vertex cursor appear as a small red square. You can click in three different places to define the three vertexes and create the first polygon.
Note that because windows are 2-dimensional they can only define two axis positions. The third axis position is determined by the position of the yellow Locator in one of the other two Orthogonal View windows.
Let's say that we want to place the vertex near Z = 3. This can be done by pressing the mouse button over the horizontal yellow Locator line and dragging it upwards within the XZ Orthogonal View window.
Alternatively you can open the Locator window (shortcut 'o') and type '3' into the Z input box.
Now click three positions within the XY Orthogonal View window to produce our first polygon. Notice as you click each new vertex the previous vertexes remain shown. You can cancel the Add Polygon operation by pressing ESC.
After selecting the third vertex the polygon appears filled in light gray. Repeat the process for the second and third polygons, specifying the first two vertexes over the top of vertexes within previously produced polygon. The red vertex cursors will jump to the precise position of other vertexes that are close in all three dimensions.
To delete a polygon, first select it by clicking near its center. You can select multiple polygons in this way by holding 'Shift'. Then press the 'Delete' key to delete all selected polygons. An alternative way to select polygons is to hold the 'CTRL' key (or choose 'Select Polygons' from the 'Selection' window) and press and hold the mouse button over an Orthogonal View window and drag the blue selection box to completely surround the polygons that you want to select.
Polygons are selected for the purpose of deleting or coloring them. If you want to move or transform polygons you need to select their vertexes. Vertexes are selected by first checking that 'Select Vertexes' is chosen from the 'Selection' window. Then press and hold the mouse button over an Orthogonal View window and drag the green selection box around the vertexes that you wish to select. Selected vertexes appear surrounded with small green boxes. You can hold 'Shift' to accumulate multiple selections.
When vertexes are selected they can be dragged to new positions by pressing the mouse button over one of the green boxes and dragging it. All selected vertexes will be dragged at once. Positions can be entered precisely using the Vertex Mover window (shortcut 'm').
Now we may proceed to draw many polygons for one of the fish's sides.
It is necessary to define polygons throughout the fish so that we can give it a depth. Select polygons in the middle and drag their Z value upwards within the XZ Orthogonal View window. Make sure that you don't change the Z value for polygons that lie on the edge of the fish. In our case there are only three vertexes that provide the fish's depth.
You can move the left-most selected vertex that defines the fish's tail thickness downwards so that the tail is thinner than the body.
Now is a good time to save your work. Open the 'File' window (shortcut 'f') and enter a filename into the input box and press 'Save'. 3DMatrix 1.3 does not have an undo feature so it is useful to save your work regularly.
Next we create the fish's opposite side. Open the 'Component' window (short-cut 'c') and select 'Copy'. Then select all the vertexes belonging to the copied component by pressing the lower 'Sel' button within the 'Component' window. We are going to flip the fish's second side against Z plane that cuts the fish in half.
Open the 'Transform window' (shortcut 't') and make sure that Transform about 'Locator' is selected. Next make sure that the Locator's Z value is through the middle of the fish as shown below in the XZ Orthogonal View window. (If you are not sure, select an individual vertex on the outer edge of the fish, open the 'Vertex Mover' window (shortcut 'm') and observe the 'Z' co-ordinate. Enter the same Z value within the 'Locator' window).
Now the component can be flipped by pressing the 'Z' button in the Transform window's 'Flip' section.
Understanding polygon surfaces
We will see how the fish looks from the Perspective View window. Open the 'Camera' control window (shortcut 'r'). If you are familiar with flight simulator games then the camera can be handled easily using the arrow keys along with ',' and '.' to move the camera forwards and backwards.
The easiest way to navigate the camera is to use the Pos (Position), Dir (Direction) and Rot (Rotation) buttons within the 'Camera' window. These 'Pad' buttons allow you to change two parameters at once by holding the mouse button over the button and moving the mouse up and down, left and right to vary the parameters. It is worth practicing with these three Pad buttons for a while until you can move the camera around quite effectively. After only few minutes you will be an expert.
As we move close to the fish we can observe that some of the polygons are dark and other polygons are light. This is because polygons are single-sided; some are facing away from the camera and some are facing towards the camera (their direction was actually determined by whether the vertexes were added in clockwise or anticlockwise order). Light is only reflected from polygons that face towards the camera.
We want all polygons to point outwards from the center of the fish. You may firstly select all polygons by clicking both 'Sel' buttons within the 'Component' window while holding 'Shift'. To point the selected polygons outwards from the center of the fish you can open the Polygon Properties window (shortcut 'p') and click the 'Face polygons against Locator' button. Make sure that the Locator is positioned at the very center of the fish within each Orthogonal View window. To show clearly which direction the polygons are pointing, open the 'Light' window (shortcut 'l') and select 'Highlight reverse side of polygons'. Polygons facing away from the camera will now be shown in bright green.
A polygon at the tail is shown still facing the wrong direction. Selecting just this polygon and clicking 'Reverse direction of polygons' from the 'Polygon Properties' window will correct this. Polygons can also be selected from the Perspective View window by clicking them, which makes identifying and flipping green polygons very convenient.
Now fly the camera right through the fish and out the other side and select 'flip' from the 'Camera' window to face the opposite direction. We are now looking at the other side of the fish, but it appears dark because the light source is on the other side. There is also another polygon that is facing the wrong direction, shown in green, which needs to be selected and reversed using the 'Reverse direction of polygons' button.
In making refinements to the fish we can fly to the front and observe that our fish appears too fat. This can be adjusted by selecting the outer vertexes from the XZ Orthogonal View window as illustrated below and dragging the vertexes inwards. If you have selected too many vertexes then you can deselect vertexes by holding 'ALT' while dragging the selection box (which now appears red) around the vertexes you wish to deselect.
(NB: To ensure you are only working with vertexes from one side of the fish you can hide one of the sides by toggling the component visibility check-boxes within the 'Component' window).
The fish's mouth can be opened and closed by selecting the two polygons at the front of the fish and using the 'Transform' window's '+' and '-' Scale buttons to bring these two vertexes closer together and further apart. Remember to make sure that 'Transform about center' is selected at the bottom of the 'Transform' window.
To finally give the fish some color we can use the Polygon Properties window. You need to select all polygons by shift-clicking the two 'Sel' buttons within the Component window. Enter the red, green and blue color range values of your preference within the Polygon Properties window. Click the 'Apply' button until you find a set of colors that appeals to you, altering the color range values as necessary. That's it! A simple 3D fish model.
Surface relaxing and creating smooth-edged blocks
Surface relaxing can be applied to blocks and other sharp objects to make them appear more real or 'organic'. It can also be applied to mountain range meshes to create smoother contours in addition to making the polygons more evenly spaced.
In this tutorial we combine 3DMatrix's 3D block effect, polygon bisection and surface relaxing to create the abstract object above.
Begin by creating the outline for the face of the block by adding polygons with the X/Y Orthogonal View window. Ensure that all polygons are facing the same direction by moving the locator to one side of the face and pressing 'Face polygons against locator' from the Polygon Properties window.
The basic 3D block form is created by selecting all polygons and applying 'Create block from 2D object' from the Tool-box window.
The smooth edges can be created by applying 5000 iterations of 'Bisect largest polygons' followed by 6 iterations of 'Surface relaxation'.
In the final image above a dim light source was added close to the object. The edges could be smoothed to any level by applying sufficient iterations of 'Bisect largest polygons' prior to ' Surface relaxation'.
If the object aimed for use in a real-time application then the number of polygons making up the flat edges should finally be reduced using 'Surface simplification'. The vertexes making up the flat edges can be selected conveniently by dragging the selection box within the X/Z orthogonal view as illustrated below. When all vertexes on the flat surface are selected 'Suface simplification' can be applied with about 5000 iterations.
The same techniques were applied to create the following asteroid models. Begin by creating a 20-vertex polyhedra using the Geometry window and move some of the vertexes to give the basic structure a much less regular shape. Then apply 'Bisect largest polygons' from the Toolbox window using 4000 iterations. To make the finer details on the surface less regular you can select small groups of vertexes and scale them inwards using the 'Scale' section of the Transform Window. Ensure that 'Transform - about center' is selected. Finally apply 10 iterations of 'Surface relaxation' to smooth the surface.
To create the appropriate environment turn on the 'Starfield' from the Display window and open the Light window to enable only a single light source and no ambient light.
Demonstration of the Group Properties window
The formulae for an apple is a variation on a superellipsoid. You can produce such an apple with one click within the 3D Matrix Mathematics Modeler window because the apple formulae has been saved as a template. In the example below the alpha and beta detail have been set to 400 and this results in 400 * 400 * 2 = 320,000 polygons being produced.
In the first image two green lights and one red light have been combined, while the actual apple surface is white. In the Group Properties window the Reflected / Dispersed light setting has been set to 100 / 0 and this results in the polygons only dispersing light and not reflecting any light.
By contrast in this next image above we see purely reflected light. Reflected light has different properties to dispersed light and as the camera moves around the apple, the highlighted areas will change even without the light positions changing. The highlighted areas of this reflected light are in a slightly different position to the maximum intensity areas of the dispersed light in the first image. This image corresponds to a mirror-like surface and the image could be made increasingly mirror-like by raising the value of 'Reflected light sensitivity'.
In this final image we combine the reflected light and dispersed light in a ratio of 26/74 as seen in the Group Properties window. This gives a more realistic impression of the apple.