Recovering a Displacement Mesh

Posted Apr 30, 2012
Last Updated May 31, 2013

Please Note that this article is for legacy purposes! Newer versions of WW do not work as is explained below! Do not follow these instructions unless you have an older scene with a sculpt mesh created before May, 2013.

If you use the Edit Mode for sculpting your displacements, it is possible to lose the "map" between your Sculpt Mesh and the original displacements. This scenario can happen under the following circumstances:

  • You save and close your file while in Anvil's Edit Mode for displacements.
  • Max crashes while you are in Anvil's Edit Mode.

In Anvil 3.1, a new method is introduced to recover that mesh. If you open a Max scene with displacements that were created with Anvil 3.1+, a script will check to see if there is a Sculpt Mesh that has not yet been commited. If one is found, you will be prompted to restore the displacements.

  • You should always save the file before applying this fix in case there is an unintended error. I have tested it quite a bit without any problems... but better to be safe than sorry as the action cannot be undone!

If you restore the displacements, Wall Worm will process the command as if you had exited Anvil's Edit Mode before the file was last saved, and the changes to your mesh will be applied.

This method will only work for displacements made in Anvil 3.1+.

Alternative Restoration for older versions of Anvil displacements

If you have a file that suffers from this problem that was created with an older version of Anvil (or the WW Displacement Tool) you can still restore your mesh. These methods should only be used if the automatic method fails.

Method 1: Recent Versions of Anvil

This method is the easiest but is only available in some versions of Anvil. To see if this version is applicable, right click the existing sculpt mesh and click on Object Properties. Click on the User Defined Tab. If you see a line starting with wwdt_displacement_array then you can use this method.

  • Copy the entire contents of wwdt_displacement_array into a text file.
  • Edit the text such that you remove all items in the array except for the names of the displacement objects. In the end, it should look something like this: wwdt_displacement_array = #("WW_Displacement_001", "WW_Displacement_002", "WW_Displacement_003", "WW_Displacement_004")
  • Paste the renamed data into the User Defined Properties field (replacing what was previously there).
  • Click OK.
  • In the Max main menu, click MAXScript > Run Script and browse to your Scripts folder inside the Max installation folder. Find WallWorm.com\WallWormSimpleDisplacement\startup.ms and run that script.
  • Click the Recover Displacement Button.

Method 2 when Method 1 is unavailable

This method is a little fraught with danger so make sure to read this information carefully.

  1. Save a copy of the scene in case this fails!
  2. Take note of the previous edit mesh's name (the one that is currently in the scene).
  3. Unhide any hidden displacements that are hidden.
  4. Select only those displacements that were used in the original displacement. Unofortunately, the order you select them must match the order they were originally selected with the original mesh. If you cannot remember... you may want to select no displacements before proceeding so it uses ALL displacements in the scene. CHECK THAT YOU TOOK STEP 1!
  5. Click edit Mode. It will create a sculpt mesh that matches the current displacements.
  6. Make sure to differentiate the name of this mesh from the original.
  7. Select the original (desired) sculpt mesh in the viewport.
  8. Open the MAXScript listener (F11).
  9. Type this line: ww_wwdt_control_mesh=$
  10. Hit enter
  11. Click Edit Mode... and hopefully all the displacements have taken the attributes of the desired mesh.
  12. Delete the sculpt mesh that was created in step 2.