There’s a slight difference depending on what map you’re using. A texture map is essentially an image file connected to an object, and as such you need to tell ICE what to do with this information before you can make use of it. First you need to convert the RGB color of the image to a scalar value and store this information as a custom attribute. Weightmaps on the other hand are already stored as scalar values, and as such you can skip the first step and use its Weights attribute directly in step 2. Start by opening the scene Goal_using_TextureMap.scn.
The project files used in this tutorial can be found at:http://dl.dropbox.com/u/3834689/CaffeineAbuse/GoalLocation_using_AnimatedMaps.zip
Create a custom goal attributeSelect the Goal_Object and press [Alt] + [9] to open an ICE Tree. From the Create menu choose ICE Tree. Get a Get Data node, open its PPG and enter Self.NodeLocation as the reference. Get another Get Data node and enter Texture_Map as the reference. Connect the Value output of the Get Self.NodeLocation to the Source input. Get a Color to Brightness node and connect the value of the Get Texture_Map node to its Color input. Get a Set Data node and enter Self.GoalTextureMap as the reference and connect the Brightness output of the Color to Brightness node to the input. Connect the Set Data node to Port1 of the ICE Tree.
Set the GoalLocation
Select the pointcloud and update the ICE Tree view. Get a Get Data node and enter Goal_Object as the reference. Get a Get Geometry Sample node and connect the Value output of the Get Goal_Object node to the Geometry Input and then open its PPG. This node enables you to filter which part of the surface to use as the goal by extracting the weights from either the weightmap or the custom attribute created for the texture map. Click the Explore button in the filter section of the PPG, expand the Input> Polygon Mesh tree and select the GoalTextureMap attribute.
Move towards goal
Get a Set Data node and enter Self.GoalLocation as the reference. Connect the Samples output of the Get Geometry Sample node to Self.GoalLocation input of the Set Data node. Connect the Set Data node to the Execute on Emit1 input of the Emit from Geometry. This will define the goal for each particle as it’s born. Once defined, you’ll use another node to actually move them there. Get a Move Towards Goal node and connect it to the Execute1 input of the Simulation Root node. Playback the animation and you’re done.
1 comments:
Very cool tutorial, I am going to try with weight maps
Post a Comment