DFRM Guide - MetaSynth
Transcription
DFRM Guide - MetaSynth
DFRM GUIDE ! An Introductory Guide DFRM Guide! 1 D FR M GU ID E Distance Field Ray Marching ArtMatic Voyager uses a unique approach to 3D objects called Distance Field Ray Marching, DFRM for short. This document covers the details you need to know to create or modify 3D DFRM objects. This guide covers both practical guidelines for working with DFRM objects that everyone should know and technical details that may only be of interest to technical-oriented people. For the most part, you do not need to understand the technical details as long as you follow the guidelines laid out in this chapter. The technical information may help you to understand the reasoning behind the guidelines or to develop your own techniques. If you find a sentence that seems too technical, don't worry. You do not need to understand all of the technical details. However, editing and manipulating these objects requires some understanding of ArtMatic and its structure trees. ArtMatic & DFRM. 3D objects are created in ArtMatic and interpreted by ArtMatic Voyager. Creating and modifying them requires a fairly good understanding of ArtMatic structure trees. If you are unsure of the ArtMatic basics, you will need to perform the tutorials provided with ArtMatic and have an understanding of ArtMatic's basic concepts (which are covered in the ArtMatic reference manual). Examples. Before reading the rest of this document, you may want to familiarize yourself with some of the many examples that we provide. The 2.0 Examples folder contains a large liibrary DFRM examples. In particular, see the examples found in 2.0 Examples/DFRM Objects and 2.0 Examples/DFRM Life & Plants. Hardware Requirements. While you can create and modify DFRM objects on any computer that has OS X.5 or later installed, you will sometimes need to exercise patience on anything less than a quad core computer. That being said, all of the examples in the documentation were rendered on a 2.4 MHz dual core MacBook Pro. We provide some helpful hints later in this document for working on slow machines. DFRM Guide! 2 DFRM Concept and Basics DFRM uses something called a distance field to define an object. A 3D distance field function takes X, Y and Z space coordinates and calculates the distance from that point to the object surface. The object’s surface is those places where the distance is 0. A value greater than 0 indicates a point inside the object (with the magnitude indicating the distance from the surface). A value less than zero indicates a point outside of the object. ArtMatic's Geographic Clut color shader is useful for visualizing distance fields as its colors indicate distances. The example below shows a simple tree to create a sphere (using the 3D Density Shapes component), the image as it appears in ArtMatic with the geographic clut color shader, and the sphere as it appears in ArtMatic Voyager. The color at the center indicates that the radius is approximately 300 meters. ! ! Below is a key to the colors in the range of about plus/minus 300 meters from the surface: Interior; 300 Meters ArtMatic Value = +15 Surface ArtMatic Value = 0 Geographic Clut The colors indicate the distance from the surface. An absolute ArtMatic value of 15 is 300 meters. Exterior; 300 Meters ArtMatic Value -15 Why Does Voyager Use Distance Fields? ArtMatic Voyager (like many 3D applications) uses a technique called ray marching (http://en.wikipedia.org/wiki/Volume_ray_casting) to render images. Ray marching essentially calculates the intersection of the possible light rays between the observer and the landscape or object. By using these distance fields Voyager can rather quickly find the convergence of light rays and the surface. (Quickly is a relative term -- even the fastest high-quality 3D rendering can be quite slow.) If a light ray intersects an object and the value is close to 0, Voyager knows that it is near the surface. If DFRM Guide! 3 the value is far from 0, Voyager knows that it is far from the object's surface. This approach is much faster than a simple ray marching approach which would have to send out a lot more rays in order to be certain that it found all object boundaries. For this reason, it is important to follow the guidelines laid out later when creating and modifying 3D objects. The success of this method requires that the ArtMatic system's output is a reasonably good approximation of a distance field; otherwise, ArtMatic Voyager will sometimes miss the object boundaries. Math Note - The simplest DFRM field is a sphere. What is remarkable (and unique) is that the sphere equation is its own distance field equation. The field is described by this equation: −( x 2 + y 2 + z 2 − Radius) which comes from the sphere equation: x 2 + y 2 + z 2 = Radius 2 . The minus sign is needed to adjust the field values so that the field is negative outside the sphere and positive inside. DFRM Artmatic structure requirements. ArtMatic trees need certain properties to work as DFRM objects: • The tree needs to be a true 3D tree which means that it needs to make use of the X, Y and Z global inputs. • The tree's main output component must be either scalar (1-output) or RGBA (fouroutput). • The tree needs to generate a reasonable distance field (usually derived from a distance field/shape component). DFRM and Color For a tree with scalar output, the output is the distance field value. Voyager will treat it as a white object. The color can be modified in the Voyager object properties dialog. !! For a tree with RGBA output, the alpha channel must be the field value. Voyager will use the RGB output to color the object. DFRM Guide! 4 ! [Top] A scalar tree and its output [Bottom] A simple RGBA tree and its output. As you will discover later in this chapter, DFRM is useful not just because of its computational efficiency, but because very simple operations can be used to create complex and interesting shapes. Animating these transformations can create fascinating object morphs that would be very difficult to create with more traditional 3D tools. For the most part, you will use built-in ArtMatic components that generate distance fields and combine and distort them (using the guidelines provided later) to create complex objects. Although advanced users can create their own distance fields, it is unlikely that you will ever need to create a distance field from scratch. The 3->1 3D DF Shapes A, 3D DF Shapes B and 3->4 3D Leave # components are the most frequently encountered distance field generators. Many other components are provided for providing useful 3D space manipulations that convert primitive shapes into more complex shapes. You can also create distance fields by combining 2D shapes with other components as discussed elsewhere in the documentation. Things You Should Know About Working With Objects ArtMatic Camera Position. ArtMatic Voyager ignores the ArtMatic "camera" position. If you zoom in or out using the ArtMatic user interface's zoom tools or drag the canvas to reposition it, the position changes will not be reflected in ArtMatic Voyager. For good reason, ArtMatic Voyager uses ArtMatic's absolute co-ordinate system. The correct way to change position is by using a 3D Offset component in the structure tree. Changing object size is generally best done by adding an offset to the distance field values as discussed later in this chapter. Scaling Space vs Displacement. For non-DFRM ArtMatic systems, it often does not matter how you distort or displace space. DFRM systems are a bit different since they need to more-or-less accurately report the distance between any point and the object surface. For this reason, some common operations (such as distorting an image by distorting space) need to be approached differently than they normally would -- in order to maintain the accuracy of the distance estimates. Generally, object size is best changed by adding or DFRM Guide! 5 subtracting an offset rather than by scaling space. If you must scale the space, it is advised that you compensate by inverse scaling the field value (which is covered later in this chapter). DFRM object deformations are often performed by adding noise to a field rather than by distorting the space with noise. Space distortions are allowed but (as discussed later) must be approached more judiciously than in your typical ArtMatic system in order to avoid artifacts without increasing rendering times excessively. Object colors. ArtMatic Voyager may ignore the color shader used in ArtMatic. The colors displayed in ArtMatic Voyager depend on what type of output the ArtMatic structure provides. A scalar structure (one whose output component has a single output) is treated as a white object regardless of how the image appears in ArtMatic. If the ArtMatic structure has RGBA output, the RGB colors are used. ArtMatic Voyager ignores ArtMatic's shader settings. For example, if you set the color shader of an RGBA structure to Geographic Clut, ArtMatic will still use the RGB colors. All object colors can be further modified in ArtMatic Voyager via the Specular Color and Reflection Color properties in the object dialog. DFRM Guide! 6 SOME DFRM EXPLORATIONS (Tutorials) Pre-requisites. This lesson assumes that you understand the basics of creating and modifying ArtMatic structure trees and does not provide step-by-step instructions for constructing the trees. If you are not sure how to modify the trees as indicated, you may need to perform the basic ArtMatic tutorials. A step-by-step version of this tutorial will be created if there is enough interest expressed by users. Axes. In ArtMatic Voyager 3D systems, the X, Y and Z axes are horizontal, vertical and depth (i.e. longitude, elevation, and latitude) respectively. C R E AT I N G AN ENTIRE DFRM PLANET SURFACE This lesson is set up so that you can either read it or follow along. If you want to follow along, set up ArtMatic Voyager and ArtMatic as described in the Set-Up section and modify the ArtMatic structure trees to match those shown. Note that your resulting images may differ somewhat from those shown since small differences in parameter settings can result in notable differences in output. Set-up • To get started, set the ArtMatic Voyager Surface mode to No Planet. Set the Sky mode to Cloudy Sky. Choose File->Save As to save the Voyager setup. • If ArtMatic is not yet launched, launch it. Choose New and create the tree shown in the image below. Choose Save As to save the new file. • In ArtMatic Voyager, click on the Open ArtMatic Object icon and choose the ArtMatic system that you just created. • Click on the ArtMatic Object and Position button. Set the Elevation to 0 and the Object Scale to 100. Click on the OK button. • Choose File->Save. An infinite DFRM plane’s equation is simply -y. To implement it, create the structure below and set the parameters of Ax + B to A=-1 and B =0. This tree has a computationally unneeded 3->3 3D Scale component at the top. In this tree, it is only there because ArtMatic Voyager will only allow a structure to be used if it is a true 3D structure (i.e. makes use of the global inputs x, y and z). The 3D Scale component's parameters are all set to 1 so that it has no impact other than indicating that this is a 3D system. DFRM Guide! 7 The structure tree ! [Above] ArtMatic set up for this exercise. [Below] The image as it appears in ArtMatic Voyager with the Surface Mode set to No Planet and the Sky Mode set to Cloudy: To add surface details to the flat plane, add the output of a 3D 3->1 texture/noise component to -y as demonstrated by the structure below. Adjust the parameters until you see something that you like. 3->1 3D Ridged Fractal is a good choice but you may want to try others. Notice that the 3->1 noise component is connected so that its Y and Z inputs are connected to the Z and Y outputs of the component above them. This is not necessary; I happened to like the results that I got with this orientation. You can try it both ways. When you choose Save in ArtMatic, the view in ArtMatic Voyager will be updated. DFRM Guide! 8 You will notice that we added the noise to the plane's field value rather than using a noise component to warp the space. While it is possible to modify a DFRM shape by modulating the space with noise, it is often safer to add/subtract noise rather than to modulate the space too much. Modulating the space by large amounts can sometimes lead to artifacts or may require higher rendering qualities for reasons discussed later. Most of the time, you don't need to use DFRM to create a planet surface. However, standard ArtMatic surfaces and Voyager's built-in planets can't have overhangs, arches, recesses and the like. DFRM allows you to create such features. Sometimes, you might create an entire DFRM planet (as in this example). Most of the time, you will create localized objects (such as an arch or cliff or cavern) and blend it with a "standard" planet surface. By tweaking the ArtMatic system created above,hoodoo-like features, which can't be created by normal elevation maps, can be made to appear. DFRM Guide! 9 As you experiment with parameters, you may find that some settings will result in "floating" rocks. Some noise components are more likely to create these floaters than others. If you don't want floaters, you may need to be careful in your parameter settings and/or camera placement. This scene has some floaters slightly off-screen. Adding Color. So far, the structure that we have created produces no color. To provide a color texture, we add: • a new branch to the ArtMatic structure to generate a color texture • a 4->4 component at the bottom of the tree to combine the color texture with the field value While working on the color texture, you will want to switch the color shader to either RGB Alpha or RGB Density in order to see the actual colors. RGB Density is useful because it will show the color texture only within the boundaries of the object without the sort of feathering that is sometimes apparent with RGB Alpha. (For more about this topic, see the ArtMatic documentation). DFRM Guide! 10 [Top] The ArtMatic system modified to provide a color texture. [Bottom] The image as it appears in ArtMatic Voyager DFRM Guide! 11 U S I N G B O O L E A N T R A N S F O R M AT I O N S COMPOSITE OBJECTS TO C R E AT E One of the great things about DFRM is that it allows simple operations to have complex results. Simple boolean operations (such as Min and Max ) can be used to combine and morph objects in complex ways and 3D noise functions can be applied to create interesting deformations. In this lesson, we look at the huge variety of images that can be created by doing nothing more than using different boolean operations to combine two objects. ! The cube and the cylinder on their own. A few objects created by using Min<->Max to combine a cube and a cylinder Set-Up. Make sure that both ArtMatic Voyager and ArtMatic are launched. Make a copy of the the ArtMatic Voyager example file Cube & Cylinder.vy. (Found in Voyager's 2.0 Examples/DFRM Objects/Boolean Objects folder). Open the copy that you just made. Click on the Edit ArtMatic Object button (that appears to the right of the surface map). Delete all the keyframes from the ArtMatic file, and edit the ArtMatic tree to look like this: This tree combines a Cube and Tube by using the Min<->Max component. Min<->Max’s parameter B, Min to Max, determines on a point-by-point basis whether the output is the minimum (min, for short) or maximum (max) of the two inputs. You can create a blending of the two operations by setting Min To Max to an intermediate value. When you use the max setting, you get the union of the two objects. When you use the min setting, you get the intersection of the two shapes. Try it for yourself. Set Min <-> Max's parameter B (Min to Max) to values from 0 (minimum) to 1 (maximum) and see what happens. Try it with different shapes selected, too. To DFRM Guide! 12 change the shape, click on a 3D Density Shapes tile and select a shape from the Algo pop-up. Maximum. Result: union of the objects. Minimum. Result: intersection of the objects. DFRM Guide! Interpolation. With Min to Max set to an intermediate value, you get a blend of the two objects. Minimum with an Inverted field. Invert the cylinder's field by setting its amplitude (parameter C) to -1. Set Min<->Max's parameter B to minimum (0). The result is that the cylinder (object 2) cuts a hole in the cube. 13 ! Deforming the Object . Modify the tree so that the output of the Min<->Max component is combined with a 3->1 Noise tile as shown above. Explore the possibilities by adjusting the parameters and trying different noise components. The example uses 3->1 MuliFractal noise. Notice that to deform the object, we are adding the output of a 3->1 noise component rather than using a 3->3 noise component to deform the space. You can turn-off the deformation by setting Ax + By + C's parameter B to 0. Try this! The example tree has the distortion being added to the combined shape. See what happens if you add the distortion to the output of one of the density shapes but not the other. Interpolation. Replace the Min<->Max tile with 2->1 Interpolate and explore the possibilities. ! Above is the result when the cube is interpolated with a negated cylinder (the cylinder with its amplitude set to -1). It is worth spending some time trying these simple transformations using various shapes and parameter settings. Keep the structure the same, and explore the different shape algorithms available from the 3D Density Shapes components. As you explore, try both Min<->Max (with different settings) and Interpolate. You may be surprised about the cool objects that you discover. FAST RENDERING TIP! If you only need Minimum (for the intersection of the objects) or Maximum (for the union), you will get the fastest rendering using the 2->1 Math Tools component with either the Min or the Max algorithm. You lose the ability to interpolate between Min and Max but benefit from faster computation. DFRM Guide! 14 Two methods for creating a tunnel To create a tunnel such as the one in our Tunnel with volumetric fireball.vy example, you can use minimum with an inverted tube (just like we did in the example labeled Minimum with an Inverted field above). Here are two different approaches Tunnel with volumetric fireball.vy Method 1. A 'negative' cylinder cuts a tunnel through a distance field (which happens to be just the Y output of 3D Fractal Displace). In this case, the noise component is deforming the space rather than being added to the field value. Method 2. Here is another variation that creates a tunnel. This tunnel is inside a cube that has been elongated into a non-cubic rectangular solid through adjustments to the 3D Scale parameters. This tree includes a branch that provides a color texture. DFRM Guide! 15 3D FROM 2D DFRM makes it possible to create 3D objects from 2D elements. You can create 3D DFRM objects using the intersection of 2D shapes in different axes,or the intersection of a 2D object and 3D object. To use this technique, create a tree like one shown at left: • Attach two 2->1 surface components to different axes of a 3D parent (a 3-> 3 component). • Combine the output values of the two surface textures. Build the tree above and explore the possibilities by changing the component choices. When you find a combination that you like, explore the impact of using different components to combine the surfaces (i.e. try these components to control the mix: Ax + By + C, Interpolate, Min<->Max. Some possibilities are shown on the following pages. DFRM Guide! 16 Star Min Cone. From the example file i-object.vy. It uses the 2D Shapes # component set to the Star and Cone algorithms. Lozenge minus Gaussian Dot. Set Ax + By + C's parameter B to -1 so that the Gaussian Dot cuts a hole in the Lozenge Lozenge Minus Grid. The grid is subtracted by setting parameter B to a negative number. Lozenge Interpolated With Grid This image was created by using the same tree as the previous image but using Interpolate in place of the Ax+By + C tile Lozenge Interpolated With Gaussian Dot DFRM Guide! 17 Lozenge Min Dot Lozenge Max Dot Zig Zag Max Line Pict Max Line. This 3D version of our logo was created from our standard 2D logo. Blurred Pict Min Density Shape. This example uses Blurred Pict which is often a good choice as it limits discontinuities that can cause artifacts. This example uses the Density Shape component (algorithm: Panel) rather than a 2D component. Cast Shadows is turned on. DFRM Guide! 18 When combining shapes, you sometimes end up with the object being infinite in one of its dimensions. If you want to limit the shape you can use a technique like the one shown below which uses Min (Math Tools set to the Min algorithm) and a 3D Density Shape to limit size of the shape. [Left] ArtMatic tree that constrains an infinite system with a 3D Density Shape. [Right] ArtMatic system that combines 2D and 3D shapes to create a 3D shape. In some cases, it is useful to use a 2D shape and a 3D Density Shape instead of 2 2D shapes in order to constrain it since the 2D textures may be infinite in one direction. See the example labeled Blurred Pict Min Density Shape above for one example. DFRM Guide! 19 Practical Considerations For ArtMatic Object Design O B J E C T S I Z E S A N D S PA C E S C A L I N G Manipulating size needs to be done somewhat differently for DFRM-based objects than for other ArtMatic systems. It is common in non-DFRM ArtMatic programming to use the 2->2 Scale Ax, By or the 3->3 3D Scale to manipulate sizes (i.e. to make things seem bigger or smaller) or to use the camera position (via the zoom in/zoom out tools or the camera zoom level in the Animation and Camera Setup dialog) to change the apparent size. Changing the camera position in ArtMatic has no effect on the object size as seen in ArtMatic Voyager since Voyager uses the absolute object position and moving the camera only changes the apparent position (by moving the camera). Scaling the space does not work well for a different reason. Scaling the space throws off the accuracy of the distance field output values in relation to actual distance, and DFRM relies on objects being represented by a distance field where the distance from any point to the object surface is accurately reported. Tech talk. The reason that care must be taken when scaling distance is a quirk of ArtMatic's internal co-ordinate mapping. When you change size via space scaling, you scale distance in the opposite direction of the change in size. To make something half its normal size, you double the scale (which basically makes it twice as far away). Normally, apparent distance is all that matters. But when using DFRM, the actual distance is needed and doubling the scale makes the distance field values larger than they should be. When the distance estimate is larger than the actual distance, Voyager may not find the convergence with the object's surface because it may overshoot the object. You can compensate by increasing the Quality setting (which works because ArtMatic Voyager uses much smaller steps for calculating convergence) which will dramatically increase rendering time and may leave some artifacts. When scaling space in the other direction (using values between 0 and 1 to make objects larger), the distance estimates become smaller than they should be. This does not increase artifacts but it can increase rendering time since ArtMatic Voyager will keep undershooting the surface until it is actually found. Manipulating the size is simple, but it is best done by following the guidelines laid out in this section. Changing object size is generally done best by adding an offset (usually with the 1->1 x+A component) to the field value or by changing the object size via its parameters. For example, you can make a 3D Density Shape larger by either changing its radius or by adding an offset to its output value. DFRM Guide! 20 Limit scale values to values between 0 and 1. When it is necessary to use scaling (such as to change the proportions of an object), scaling parameters should be set so that the scaling stays in the range from 0 to 1. There may be times when a value between -1 and 0 is also ok. Changing proportions. Sometimes, you must scale the space to achieve a particular effect. When you do so, keep the scaling amounts between 0 and 1 and adjust the size by adding an offset to the field value. For example, if you want to flatten a sphere so that it is twice as wide as it is tall, set 3D Scale's parameters (with the individual axis option selected) to A=.5, B=1 and C=.5 rather than by using A=1, B=2, C=1. Compensating when scaling is unavoidable. There are times when changing size via space scaling is unavoidable. If scaling needs to be increased by a value greater than 1, it is best to compensate the field value with inverse scaling as this will maintain the correct distance estimates. For example, in the tree below, if you change the scale by setting A to 8 in the 3D Scale component, set parameter A of the Ax + B component to 1/8 (0.125). The structure tree used for the following example. While this is a trivial example, it demonstrates the results of space scaling on a density/distance field. The images below demonstrate how density shape distance values are distorted by space scaling. These distortions occur when space scaling any DFRM distance field, but we have chosen a trivial case to make the distortions easy to see. DFRM Guide! 21 Radius = 1; No Offset; No Scaling An unscaled, non-offset sphere of radius 1. Radius =1 Offset A=-.875 (.125-1) The sphere is made one-eight its original size by setting the Offset to -0.875. When changing size with an offset, the distance field is shifted uniformly. The progression of values remain true to the original. Radius =1; Scaling A,B,C=8 The sphere’s size is made 1/8th the original size by setting 3D Scale's parameters to 8. The surface size is changed correctly, but the distances become exaggerated. When you are only halfway between the surface and the canvas' edge, the field is reporting a much greater distance (dark blue) than the proper field (which appears as a lighter color blue). Radius = 1; Scaling = 8; Inverse Scaling 1/8 (0.125) To counteract the distortion of the distance field, inverse scaling (1 divided by the space scaling amount) can be applied to the field's output value. Since the space was scaled by a factor of 8, the inverse is 1/8. So, we set the Ax + B component's parameter A to 0.125 to compensate. Notice that the field now appears identical to a field whose size was changed with an offset. DFRM Guide! 22 DFRM AND SHADOWS Precise shadow-casting is an inherently processor-intensive task made even more intensive by the presence of DFRM objects. When Cast Shadows is turned off, ArtMatic Voyager uses the object's distance field to perform Ambient Occlusion (see: http://en.wikipedia.org/wiki/Ambient_occlusion ) which creates a shadow-like darkening on the ground around the object. The ambient occlusion is not as accurate or detailed as a true shadow calculation. Turn Cast Shadows on for full accurate shadow casting. Because this may increase render times substantially (by 4 times or more), we recommend -- when rendering video -- that you first render a few stills with shadows on and shadows off to determine whether you need the additional detail and to get a sense for how the shadow computation will impact render times. ! [Left] Scene with Cast Shadows Off [Right] Scene with Cast Shadows On. If the distance field (the object definition) has values that are close to but still larger than 0, you may have a situation where there is some ambient occlusion but no visible object. If this should happen, you may want to use the 1->1 Ax+B component's parameter B to add a small negative offset to ensure that the values are below zero. DFRM Guide! 23 G U I D E L I N E S F O R A R T M AT I C O B J E C T D E S I G N There are some counter-intuitive consequences that result from DFRM’s reliance on values around the surface and not just at the surface. There are a few operations that are performed differently when working with DFRM objects than when creating "normal" ArtMatic systems. In this section, the term "field value" is the output value (the alpha channel when the system is RGBA or the single output of scalar (single output) systems). The field value is what defines the object's shape. Here are some quick guidelines that will help you get the best quality. With experience, you may find these are not hard and fast rules. But, it is a good idea to follow these when you are getting started. If you run into problems (such as strange artifacts), take a look through this list. - The field value represents the distance to the surface. It is best to avoid scaling the space by values greater than 1 since they may cause field values to exceed the actual distance to the surface. - In an unscaled, undistorted ArtMatic structure, an ArtMatic distance unit is 20 meters. For example, a Density Shape sphere with a radius of 1 will have a radius of 20 meters. If you use a 3D Offset component, an offset of 1 will be an offset of 20 meters. - To increase the size of an object, use simple addition to the field value (which moves the zero level and hence the apparent size) rather than by scaling. - Displacement and texture modulation can be performed by simple addition. For example, you can add the output of 3->1 noise functions to a field value to distort the object instead of distorting the space with a 3->3 space distortion function. - If there are artifacts in Voyager even at better or best quality, scale down the field value in the ArtMatic system so that the distance estimation will be smaller which reduces the likelihood that a point of convergence will be missed (which results in wrong guess as to where the surface is). - ArtMatic systems must generate both negative and positive values since they determine the inside and outside of the object. Thus, an ArtMatic system can't be limited to only positive or only negative values. They can't be clamped to zero. - ArtMatic's Infinity value must be avoided. - When using arbitrary noise functions for displacement, make sure not to use amplitudes that are too large. If the amplitude is too large, the displacement may be so large that the DFRM will not converge or will miss certain areas (resulting in artifacts). The solution is to reduce the amplitude parameter or to add a filter to the output to reduce the values. DFRM Guide! 24 - 2D scalar (2->1) displacement functions can be used but require care. 2D scalar functions lack meaningful 3D distance estimation since the functions lack a third dimension). As a result, convergence will be poor if the displacement is too large. - If you must scale the space before the field function, you should inverse-scale the output value at the end in order to keep the distance meaningful. For example, if you scale the x dimension by 4 prior to the field function, the output value should be scaled by 1/4 to compensate. Take the case of a sphere. If x,y and z are scaled by 4, the distance estimate will become -4 * sphere-radius which is four times larger than it should be. Scaling down by 1/4 (i.e. 1/4 * (-4 * sphere- radius)) corrects the error. This is the same as just lowering the radius and ultimately the same as adding an offset to the field itself. - The zoom level of the ArtMatic canvas has no influence on the object size since size is based on the absolute values. The object scale can be changed in the ArtMatic Voyager Object dialog. A sphere of radius 1 (as defined in ArtMatic) is approximately 80 meters in diameter in Voyager when the object scale is set to 1. DFRM Guide! 25 QUICK TIPS Setting Up An Object. When a DFRM object is part of a scene, ArtMatic Voyager only renders that part of the object whose elevation is above the planet surface. For this reason, you will probably need to adjust the elevation setting in the ArtMatic Object and Positions dialog to make sure that the object is at the appropropriate elevation. Launch Order. When using ArtMatic Voyager and ArtMatic concurrently, make sure that you have both ArtMatic Voyager and ArtMatic launched before you click on an Edit in ArtMatic button. Getting Trapped in an Object. ArtMatic Voyager's Keep On Top option can only keep you on top of a normal terrain. But, the camera doesn't keep you outside of objects. If you are working with large objects, you may find that you end up inside an object. If that happens, move the camera or adjust the object's elevation. The appropriate action will depend on the context. PERFORMANCE TIPS When working on a slow computer or working with a particularly CPU-intensive DFRMbased scene on any computer, you may find times when making adjustments become very difficult because the CPU is bogged down calculating the preview while you adjust sliders and other user interface controls. When this happens, there are a few tricks that you can use to improve the user interface's responsiveness. Reduce render quality. The first thing to try is setting the Render Quality setting to draft or good. In some cases, this provides a dramatic improvement. Work at the reduced quality setting until you actually need the higher quality. In some cases using Best or Sublime quality is very slow and unnecessary. There are many cases where a Good or Better quality render is almost indistinguishable from a Best or Sublime quality render -- and the lower quality render may take 1/10th the time. Make objects temporarily inactive. With very CPU-intensive systems -- especially with object's that are set up with a reflection color -- it is often useful to temporarily make the object inactive in the ArtMatic Object and Positions dialog. Make the object inactive and then make whatever adjustments you need (sun position, camera position, etc.) and then make the object active again. Temporarily turn off reflections. When the Reflection Color amount is set to anything other than 0, a lot of processing goes into calculating the reflections. If this bogs things down, set the Reflection Color amount to 0 while you are making your other adjustments. DFRM Guide! 26 Temporarily change the sky mode. If your scene uses objects and volumetric skies or the volumetric light sky mode, you may want to temporarily set the Sky Mode to Clear Sky or Cloudy Sky. Volumetric clouds and volumetric lights can be very cpu-intensive. Turn off Cast Shadows. The Cast Shadows option can dramatically increase the calculation time. In some cases, this option can increase rendering time by as much as a factor of 10. Turn it off until you need it. If you are rendering animation, you should render some test frames to see if the option is worth the added rendering time. DFRM Guide! 27 USING DIFFERENT SHADERS TO VISUALIZE OBJECTS When creating DFRM objects in ArtMatic, it is often useful to switch between shaders. It is generally useful to use the Geographic Clut to visualize the distance field to make sure that it is correct. The Geographic Clut makes it easy to see if there are anomalies caused by too much scaling or distortion. For all objects, there should be an orderly and reasonable transition as one moves away from the surface or into the object's interior. ! The image on the left has a distance field that has been poorly scaled. It is a sphere made smaller by scaling space (by a factor of 8) without compensating for the distance scaling (as discussed in the section above Object Sizes and Space Scaling). With the Geographic Clut it is obvious that scaling has distorted the density values. In the image on the left, the distances beyond the surface (the beige/gray area) are clearly much larger than they should be (as indicated by the rapid transition to dark blue) which is obvious when you compare it to the appearance of a sphere whose size was changed by adjusting its radius (3D Density Shapes parameter B). In the examples below, we see how Geographic Clut helps us adjust scaling compensation when using noise to distort a sphere. DFRM Guide! 28 Here is the undistorted sphere. It is useful as a point of reference for getting an idea of what the density values should be. The ArtMatic tree is the one used to generate the examples below. We use 3D Turbulence with a very large amplitude setting to distort the sphere’s distance field. When you compare the view with the geographic clut to the undistorted sphere, it is clear that the distance field is returning distances much larger than they should be -- which leads to a lot of artifacts even at sublime quality. The solution is to either reduce the amplitude so that the field looks more orderly, or (when that is not possible) to perform inverse scaling of the field value. In this case, parameter A of the Ax + B was used to scale the field values down. Uncompensated - Maximum distortion and no scaling compensation The field in ArtMatic Good Quality Better Quality Sublime Quality Compensated - Inverse scaling applied to bring the field values under control The field in ArtMatic Good Quality DFRM Guide! Better Quality Sublime Quality 29 We see the result of inverse scaling the field values to compensate for the distorted distance field. The amount of scaling was found by comparing the view with Geographic Clut to the undistorted field to get a good match. Notice how much better the quality is at each quality level. Keep in mind that this is a very extreme case chosen to maximize artifacts. When the field is properly set up, the quality at at any render quality setting is improved. This is especially useful when working with complex objects. Improved quality at lower quality settings, means that you can do your work with the user interface set to Good or Better quality (but probably not draft) rather than Best or Sublime. This will make Voyager much more responsive since those higher-quality settings can take much longer to redraw than the lower quality settings. The user interface is much more responsive when the CPU is not tied up calculating the preview. If you spot areas where there is not an orderly transition between the colors of the Geographic Clut (which indicate distances), you should adjust your parameters. It may take a little experience to get a sense of what a normal DFRM field should look like. Once you do, you will probably find yourself working in Geographic Clut for most of your basic object design. DFRM Guide! 30 SWITCHING SHADERS For color DFRM objects, it is often useful to switch back and forth between the Geographic Clut and RGB Density. Which shader you use, at any given moment, depends on what details you want to see. In RGB Density mode, the color texture is clipped to the region defined by the object surface. It will give you a sense of what your color texture looks like but doesn't provide much surface detail or any sense of what the field looks like. You may notice Geographic Clut also gives you a sense of surface texture in a way that the RGB Density cannot. The color shader choice has no impact on what you see in ArtMatic Voyager since Voyager always uses the RGB colors for RGBA trees. [Top] Voyager render of a spaceship [Bottom Left] the object as it appears in ArtMatic with Geographic Clut [Bottom Right] The image as it appears with the RGB Density shader. DFRM Guide! 31 SETTING UP KEYFRAMES TO SEE OBJECTS FROM PARTICULAR POINTS OF VIEW In ArtMatic, the canvas view is one slice of the object. Unless we take special steps, we see a vertical slice (a front-facing view) of the object at the origin (z=0). DFRM Guide! 32 In order to view the object from from various angles, add a 3D Rotate tile. Create keyframes so that you can switch between different angles easily. The keyframe thumbnails provide a few of several points-of-view at once. You should lock all other parameters while working this way so that any parameter changes other than rotation will be shared by all your keyframes. To make it simple to set the rotation, set the 3D Rotate option to angle in degrees and turn on the Integer Grid setting for the parameter grid while adjusting the rotation. It is often useful to have keyframes with these rotation settings: Point-of-view A (angle xy) B (angle xz) C (angle yz) front view 0 0 0 top view 0 0 90 side view 0 90 0 bottom view 0 0 -90 There may be other points-of-view that may be more useful for your particular object. Once you have set up these keyframes, you can use them to view the object from different angles in ArtMatic Voyager without having to move the camera by moving the Time slider in ArtMatic Voyager. Depending on the object, it may also be useful to view different slices of the object. To do this, make sure that you have a 3D Offset tile at the top of the tree (above the 3D Rotate tile). By changing the offset values, you change which slice of the object you are seeing. Tip! You can change the zoom level and ArtMatic camera position in all the keyframes by holding down the shift key and adjusting the position (by dragging in the canvas area) and zoom level. This adjustment can be useful for making sure that the needed detail is visible in the keyframes. Zoom and camera position have no impact on the scene in ArtMatic Voyager since Voyager uses the absolute position. DFRM Guide! 33 TROUBLESHOOTING TIPS FOR DFRM This section covers some situations that you may encounter while experimenting with DFRM and how to deal with them. RENDER IS VERY SLOW Sometimes, you might create something and find that it takes much longer than other objects to render. In some cases, a long render time is normal. In some cases, overlong render times are an indication that something is wrong in the object design or parameters. 3D rendering is, by its nature, processor intensive. A well-constructed object might take a long time to render when any combination of the following is true: • It is recursive (looped) and has many iterations (repetitions) • Cast Shadows is Turned On. This feature is sometimes required to get the look that you want, but it can multiply render times by a factor of 10. • Best or Sublime quality mode is turned on • The CPU is busy with other apps. BEFORE YOU DEBUG YOUR A RT M AT I C S Y S T E M Before exploring the ArtMatic system, make sure that the slowness is not due to the settings of the Voyager system. Turn off Cast Shadows to see if that is responsible. Set the render quality to better or good while debugging. Best and Sublime modes can be quite CPU-intensive even with wellhaved systems. Recursive systems. If the system is recursive (if it has loop component in it or has a compiled tree with repetitions), set the repetition value to 0 or 1. Recursive trees are inherently cpu-intensive. If there are any issues (such as incorrect space scaling), recursion will exacerbate them. Be careful when modifying recursive systems. Fractals are recursive systems. If you create your own fractals, be sure to study the fractal examples that we supply. When modifying those examples, make sure not to remove or change those components whose purpose is to maintain appropriate space scaling. If you have problems, carefully compare the components (tiles) and parameters of the original example and your your modification. One of the most common problems is changing a tile that has a critical function (such as adjusting the scaling) or changing a critical parameter value. DFRM Guide! 34 EXAMINING YOUR A RT M AT I C O B J E C T S DFRM objects are made by combining and manipulating special components that generate something called a distance field. If you stick to components designed for creating distance fields and follow the guidelines discussed in the section Object Sizes and Space Scaling, you should have well-behaved systems. Examine your system to make sure that space scaling has not resulted in a poorlybehaved distance field. Take a look at your object using the Geographical CLUT and make sure that the distance field progresses reasonably as you get farther from the surface. Carefully read the sections Object Sizes and Space Scaling and also Using Different Shaders to Visualize Objects to see what a reasonable distance field looks like when viewed with the Geographical CLUT. Problems can occur if you either use space distortion functions and scale the space too much, or if you use an amplitude far from 1.0 for a distance field object’s amplitude. Scaling problems also occur where you apply a multiplier to the a DFRM field's output. If you are not an expert, use components intended for working with DFRM and use amplitude's near one. If a system is behaving poorly, take a look in the component reference guides for information about the components being used to make sure that the components make sense for DFRM. BLACK SCREEN Occasionally when editing a DFRM system, you may get a black preview in ArtMatic Voyager. There can be a few reasons for this: 1. You may have changed the object so that the camera is inside the object, in which case there is a black preview because there is literally nothing to see. To fix this situation, move the camera outside the object’s bounds. 2. You may have changed the object in such a way that its field does not make sense so that there is not a correctly defined surface. There are a few things that can cause a DFRM field to not make sense: 1. Space distortion causing the space to be scaled excessively. 2. Scaling of the field's output. This can happen when using an amplitude other than 1.0 for a DFRM component or by multiplying the DFRM field value which might happen if you were to add Ax+B after the DFRM object. 3. Use of a component that does not have negative and positive values. A DFRM field treats the output values as distances from the surface. So, the field needs to have a full DFRM Guide! 35 range of positive and negative values. Components like 2->1 Profile Shapes have an option to choose a zero floor or to allow negative values. The latter option needs to be used for DFRM objects. DFRM Guide! 36 ArtMatic 6 Change Appendix This document was updated slightly for ArtMatic 6. Previously, DFRM fields were referred to as both density fields and distance fields. Technically, the fields that ArtMatic and ArtMatic Voyager uses are meaningful as either density fields or distance fields, but we have standardized to Distance Field. There may be occasional references to density fields left in the documentation. A Troubleshooting section was added. Additional information and tutorials are available through the ArtMatic resources center. DFRM Guide! 37