Tips and Tricks: How to apply a displacement for GridMesh by scripting.

RealFlow 2012 has the possibility to apply the displacement map for a GridMesh previously calculated from the Displacement tab in the GridFluidDomain parameters, by using the “use displacement” parameter in the GridMesh before creating the mesh. The created mesh will be tessellated with regards to the displacement map. There is another option to control how much we want to tessellate the mesh depending on we need by using scripting.

img = Image.new()
MinF= 1#scene.getMinFrame()
MaxF= 201#scene.getMaxFrames()
for n in range (MinF, MaxF+1):
  img.open( "C:/Scenes_test/Realflow5_testing/Hybrido/tiburon/GridFluidDomain01_displacement%s.tif" % (str(n).zfill(5)))
  scene.setCurrentFrame( n )
  GridMesh01.tessellate( .08 )# tessellation for the gridmesh.
  GridMesh01.displaceVerticesWithTexture( img, 1.0, 1.0, Vector.new( 1.0, 1.0, 12.0 ) )# Vector new controls the displacement size and the axis to apply.
  GridMesh01.setExportResourceName("GridMesh01_displaced")
  GridMesh01.export()
  GridMesh01.setExportResourceName("GridMesh01")

A new “GridMesh01_displaced” will be created in the same meshes folder. If you try to render this mesh will see the mesh with the applied displacement.

displacement

luisM.

5 comments

  1. Good Morning Luis M. I’m trying to apply the shift through the script but I can not apply it gives me error Run tighten, it gives me error on line 4 where the path of displacement of the images and have proven a thousand times even changing the route and no .
    Could you outline the steps you do to start the script and see if I get out of once.

    Greetings and thanks for everything

    1. Hi Ivan,

      try to change the “\” to “/”. In addition, if you are reading the particles from a network, put \\\\My computer/myfolder/files . It is a python issue.

      luisM🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s