1 Tutorials LightWave 3D Expression Physics: Projectile Trajectory Qua Jan 26, 2011 2:25 am
Admin
Admin
by Alexander Karpenko |
The following is a tutorial designed to illustrate the execution of hardbody dynamics using LightWave®s' Motion Designer. Part I 1 - Let's start in the LightWave® Modeler 2 - To begin select the Box tool (shift+x) located under the Create tab, draw out the plane from the Top Viewport, but DO NOT drop the Box tool. Now open up the Numeric panel (n) this should be located under MODELER>WINDOWS>Numeric Options Open/Close.. With the Numeric panel open, enter the following values: After you have entered the values press Enter twice to drop the Box tool and create the plane. 3 - Select the Second layer as your foreground layer and the First (containing the plane) as the background layer. This will give us a reference for the next set of objects we will be creating. Select the Ball tool (shift+o) and open the Numeric panel. Upon opening the numeric panel a ball should have appeared based off of default settings. Change the values for the Radius on all three axis to 350mm, after you change the last axis close the numeric panel and press press Enter twice to drop the tool and crate the Ball . 4 - Before we proceed make sure your Selection Mode is set to Polygons (ctrl+h). Now select the entire ball (right-click and draw a lasso around the sphere). Leaving this selected Copy(c) the sphere and Paste (v) into the same layer. The copied version is now directly on top of the original. With the ball still selected go to the Modify tab and select your Move (t) tool. Now move the ball to a different position over the plane. Copy the currently selected ball one more time then paste and reposition again. The end result should be three balls spread over the plane at different elevations. At this point go ahead and save the object. 5 - While we are here in Layer 2 change the Surface (q) name of the balls from "default" to "spheres". Press OK then go to Layer 1 where we created the plane. 6 - Select the four corner Polygons of the Plane and then change the Surface name for these polygons to "S_Fixed" . (Be sure to turn off Make Default and Set Initial Color) Once these polygons are named go ahead and hide (-) them. Hide Selected polygons is located under the Display tab. Now change the surface name of the remaining Polygons (q) to "plane". Then Unhide () the corner polygons ( also located under the Display tab). 7 - Deselect (/) all polygons and turn on the SubPatch (tab) mode for the plane. This Completes the object set-up for the tutorial. Go ahead and save the Object then launch the Layout and load the Object. Part II 1 - With our objects loaded into the Layout select the Plane Layer ( Layer 1) and open the Item Properties (p) panel. From this panel change the Subdivision Order to Last. WHY: What this does is tell LightWave® that, all deformations will be performed on the low polygon plane not the sub-patched one. So MotionDesigner will deform and detect collision with the low polygon cage and THEN it is subdivided. This speeds up the calculations and assures smooth polygon flow. Ok now for the fun part: MotionDesigner. 2 - Under the Scene tab click on MD_Controller and then click on Property. The Motion Designer property panel should appear. From the Property panel choose the layer with the balls (Layer 2) then click the Activate button. This tells the Motion Designer to apply its properties to this object. 3 - Double click on Target, so that it says "ON". This tells MD that this is a moving object; it is influenced by gravity, wind etc. This is how it should look so far: 4 - Select the Layer1; activate it as well, but this time double-click on >Collision. MD now knows that this object is stationary. It acts as a barrier for a target (a moving object). Therefore the plane is not influenced by gravity. 5 - Now select the Environment tab here in the property panel. In the middle column (which represents the Y-axis), under Gravity(m/s^2), change the value to -5. Now all physicists and perfectionists will go crazy on me . Since when is gravity -5 m/s^2, you ask? Well here is the deal, you see, you can set the gravity to -9.81, but this will mean that the balls will accelerate faster; hence the impact velocity will be higher. This means that the balls have to be even harder. But this will increase the calculation errors and calculation time. So I suggest that you leave the gravity at -5 and speed the whole animation up after the calculations. For cloth, you should set the gravity to -9.8 to get believable results. Hit start for a quick test of the dynamics. You can see that the spheres do collide with the plane, but they do not hold the shape yet. 6 - Under the Surface Tab, click on the Layer with the 3 spheres, and select the Default surface. Leave the Weight at 1 for now. Just as in real life, the weight determines how much momentum and inertia the object has. Think of a tennis ball colliding with a Basket ball. The tennis ball will collide and change the direction of its trajectory, while the basket ball will go on mostly unaffected since it is heavier. - Feel free to change the settings after each step, and RUN MD after every modification, in order to get a feel for the tools. 6a - Leave the Weight+- as is, since the weight distribution along the ball does not vary. 6b - Set Spring to: 1000. Springs connect all points together. The spring determines how much the points are allowed to go apart until they are pulled back by the springs. Hence springs determine how much the surface stretches. A bigger value creates stronger springs; therefore the surface will not stretch as much as say with a value of say 100. In most Soft body systems, this is about it for stretchiness, but MD gives you much more settings that affect how much the surface stretches to confuse us , not very smart on Newtek's side, although it adds to the control. NOTE: THIS IS IMPORTANT! From now on you will have to increase the Calculate resolution (In the MotionDesigner Controller window hit option). When the mesh starts to blow up, or fold back on itself, you will know that increasing the resolution should solve these calculation errors. A value of 100 and up is normal for hard bodies. 6c - Set Viscosity to: 10. As it is written in the manual, viscosity controls how much a collision impacts on the shape of the object. Higher values will result in less of an impact. Thus an object with higher viscosity will tend to keep its shape more. This is what we want for our hard bodies. 6d - Keep Resistance at 1. Resistance determines how air resistant the body is. Say a parachutist opens the parachute, and will slow down and float to safety due to air resistance. We do not really need this as we are not working on a parachute . It can however come in very handy for falling leafs and wings. 6e - Keep Parallel and Back Resistance at 100%. Parallel Resistance determines how much the object is resistant the more it is aligned parallel to the ground. Back resistance determines how much the backside of the polygons (opposite the normals) is affected. The online docs have a good tutorial on how to use this on falling leafs. 6f - Keep Fixed as is: OFF. If fixed is turned on, the surface will remain stationary. We will use this later on in this tutorial. 6g - Set Sub-Structure to: 1000. The manual gives a very good (and technical as usual) description. What sub-structure does is create more points on the mesh by converting each poly into 4 triangles and so on. Based on this, a more physically intact and accurate soft/hard body calculation is performed. Higher values tend to create a more structurally stable object. 6h - Leave Shear as is. I have never used or fully understood this tool. Feel free to play around with it and see what you can come up with. 6i - Hold Structure should be left at: 0. To see what it does set Hold Structure to 100 and Start the calculation. As you can see Hold Structure treats the surface as a whole, the more it is away from its initial position the more it is pulled back. This tool is useful for making wobbly stomachs etc. Return the value back to 0. 6j - Leave Smoothing at: 0. Smoothing does what it says, it smoothes out the wrinkles and creases. Since our Hard Bodies should not wrinkle, we can ignore this feature. 6k - Set Stretch Limit to: 3%. This will have a drastic effect on the 3 balls. Stretch Limit determines the percent of initial distance by which the points can move apart from each other. Our Spheres should have a low percent value since they should not stretch at all. 6l - Set Compress Stress to: 15000%! This is the MOST IMPORTANT setting that creates our hard bodies. Compress stress controls the amount of compression (change in shape) when a stress is applied (i.e. a collision). The higher the value the more stiff the object will be (i.e. less affected by a collision). (This explanation comes nearly straight from the manual). This IS what we want! 6m - Leave Shrink at: 100. Shrink controls by how much the object will decrease in size after Start calculation is hit. This tool is useful to make cloth more tight fitting. 6n - Turn Self-Collision ON. This is only required because we put all spheres into one layer. The spheres will collide with each other later on in this tutorial. You could have put the 3 Balls into different Layers (this is what I would do), and set them all to target. Then Self-Collision can stay OFF. For simplicity we put it all in one layer. Therefore Self-Collision should be ON so that MD will detect collisions between the same (Default) Surfaces. 6o - Leave Single Sided: ON. Since the Balls are all closed objects, the backside of the polygons will never collide. Hence MD should only check the front (outer) sides of the polygons. This will speed up calculations. 6p - Leave Collision-detection: ON. Obviously we want our objects to collide, so we want MD to check for collisions. Collision-detection can be set to OFF if you want a free falling body that should not collide. 6q - Leave Skin thickness at 0.01. This feature extends the area where a collision will be detected a bit farther than the actual polygons. This is often need when you do not want a cloth to drape over an object to closely so that polygons come through. Consult the manual for some good images showing the effect. 6r - Set Friction to: 100. We want our Spheres to roll and not slide. Therefore we need some friction. NOTE: I've found that friction in MD does not work very well; even with high values the objects still tend to slide. 6s - Depending on how bouncy you want the balls to be when they collide with each other, set the Bound force to greater than 1. I left it at 1 for now though. - Leave all other settings as they are. The last two are explained very well in the manual, I don't think I need to explain those. Fell free to play with them though. - Now you should have some Hard Body bouncing spheres. You can hit the Save button, to save a preset. Here is what the settings should look like for the ball surface at this point. 7 - Now we quickly will set-up the cloth. Still under the Surface tab, expand the Layer1 and select the "Plane" Surface of the plane layer. On the drop down where it says "cotton(thin)", click on that and Select: cotton(thin). The preset should be loaded. If you run the calculation now you will notice that the plane does not move! Remember, we set it to Collision not Target. Collision objects do not move! 8 - Switch to the Object Tab. Make sure that the plane layer is selected in the drop down list. Turn Collision Off. Double click on Target to turn it on. Now Motion Desiger will treat the plane as a soft body. 9 - After running the calculation you will notice that the whole plane is falling. Go back to the Surface tab. Under Layer 1 select the Surface called: S_Fixed<. Set Fixed to: ON. This will make the corner polygons fixed in place. Run the calculation. You will notice that the 3 balls are colliding but sliding on the cloth. 10 - Select the >"plane" surface of the cloth and play with the >Friction values. I've set it to 100 you can try setting it even higher if you wish. Here is a frame from the calculation: Download the Source Files Here |