UV Scatter Script 1.4

Download UV Scatter Script 1.4

Last Updated 24 March 2013
This plugin requires the pyQT python libraries to be added to your maya installation. They can be downloaded here for windows and here for mac

I have only tested this plugin with maya 2013 64bit for Windows and Mac OS (Mountain Lion), but it should work on other versions.
If you run into any issues on 2011/2012 drop a comment about it and I will try and add support.

Features

  • Quickly scatter multiple instanced objects over mesh surfaces.
  • Control the density of scattered objects using an image map.
  • Objects can be oriented to face normals.
  • Script can now bypass the LOD step if you do not require it.
  • Screen-space objects culling to hide and show objects visible to a specified camera.
  • Rotation and scale of scattered objects can be controlled through image maps.
  • LOD Grouping is setup automatically and associated with a camera of your choice.

Requirements

  • PyQT libraries are required to use this plugin (the interface was built with pyqt)
    Nathan Horne very kindly has built libraries of PyQT for maya and they are available here
  • This plugin has only been tested on maya 2013 x64 (windows), but it should work with all version from 2011 onward.

Keep Updated

  • If you would like to be kept in the loop as to new versions of this software please sign up to the mailing list below

Installation

  • Install the PyQt libraries if required. They can be downloaded here. Copy them into site-packages folder located in your maya install directory.
    e.g C:Program FilesAutodeskMaya2013PythonLibsite-packages
  • Copy ScatterMap.ui to your default script directory located in your user folder.
    e.g. C:UsersusernameDocumentsmayascripts
  • Copy the shelf file “shelf_uvScatter.mel” to your default shelf directory.
    e.g. C:UsersusernameDocumentsmaya2013-x64prefsshelves
  • Copy the shelf icon “uvScatter.png ” to your default icon directory.
    e.g. C:UsersusernameDocumentsmaya2013-x64prefsicons
  • Copy ScatterMap.py to your maya plugins directory.
    e.g. C:Program FilesAutodeskMaya2013binplug-ins
  • Open up maya and display the plugins menus. (windows -> setting/preferences -> Plugin Manager)
  • Activate the plugin. (if pyqt is found and the UI file is loaded successfully the plugin will activate)
  • Load the shelf.
  • To launch the scatter plugin, click the shelf icon or type “uvScatter;” into the mel command line at the bottom of the maya window

UI Layout & Controls

UI window for uv scatter script

  • 1. “Load target”:
    loads the object that will be scattered onto.
  • 2. “Orient Scatter to Target”:
    Rotates the scattered objects to match the orientation of the face normals of each face being scattered onto.
  • 3a-3b. “Load Meshes”:
    Loads and displays a list of the high-resolution meshes that will be scattered. The order can be rearranged by clicking and dragging in the list box (3a).
  • 4a-4b. “lod replacements”:
    loads and displays a list of the proxy / “Level of detail” (LOD) meshes that will be swapped out when the camera moves outside of the specified LOD boundary.
  • 5a-5c. “search & replace”:
    By naming you meshes with the suffixes contained in the search & replace boxes, the script will be able to auto-load your LOD objects by replacing the “search” suffix with the “replace” suffix thereby correctly loading the object(s) into the LOD list.
    e.g. it will look for an object called “TREE_hires” and load “TREE_lod” into the LOD list. This is the recommended workflow. This will ensure that the LOD objects are associated with the correct high res mesh.
  • 5d. “Bypass LOD”:
    Scatters instances without setting up an LOD system.
  • 6a. “Select LOD Camera”:
    Displays a list of cameras that can drive the LOD switching.
  • 6b. “refresh list”:
    Refreshes the list of cameras.
  • 6c. “LOD Switch Distance:”
    Sets the distance from the camera that will trigger the switch between the high resolution object and the matching LOD objects.
  • 7. “load Map”:
    Loads an image map to determine the likelyhood of scattering in a particular area of the map. Useful for controlling where you want objects to be scattered.
  • 8. “Grid Density”:
    Sets how many “samples” the script will take of the target mesh and the image map. Higher values take longer to process. This value is dependent on the scale of your target and objects you wish to scatter. It is best to test with low numbers (around 64).
  • 9. “Scatter Quantity”:
    Sets the quantity of objects to be scattered.
  • 10 “Go!”:
    Checks the settings and scatters the object.

Standard Workflow

  • 1. Model target surface.
    The surface must be a mesh object and unwrapped correctly without any uv overlaps (auto unwrap will work too if necessary). The uv’s must fall within 0 – 1 space and should ideally use as much of the UV space as possible for optimum performance. The script uses UV co-ordinates to do a lot of the work so without good UV’s the script will fail. Transformations on the model should be frozen before scattering as they affect how the scattered objects will be oriented to the surface.
  • 2. Prepare the high resolution and LOD models.
    Set you pivot points and origins very carefully. For best results, place the two objects on top of each other at the origin, set the pivots and freeze transformations.
  • 3. Name your objects for easy LOD association.
    uvScatter script supports auto-loading of the LOD models based on naming convention. If you append the search and replace suffix to your object names, the LOD objects will be auto loaded and associated correctly with the matching hi-resolution object when you click the “guess lod” button. An example of the naming would be as follows:
    “TREE_hires”
    “TREE_lod”
  • 4. Clean up model.
    Make sure history is deleted on your objects and that you do not have any transforms parented under them. The script does not currently support nested transforms and will result in a failure.
  • 5. Open the uvScatter window.
    click the “uvScatter” shelf button to launch the menu or type uvScatter; into the mel command bar at the bottom of the maya window.
  • 6.Load the target.
    Select the mesh you want to scatter onto and click “load target”.
  • 7.Load your meshes.
    Select your high resolution mesh objects and load them by clicking “loads meshes”.
    Either repeat for the LOD objects (you may need to manually arrange them, by dragging the names in the list) or click “guess LOD” if you have named your objects correctly.
  • 8. Select your LOD camera.
    Select the camera out of the camera list that will drive the LOD system. This will most likely be your render camera.
  • 9. Set the LOD switch distance.
    The best way to work out this value is by turning on camera distance in your Heads-Up-Display and select an object in your camera view
  • 10.Load the scatter map.
    Load a grey scale image that will determine where on your target the meshes will be scattered. If no image is loaded, the meshes will be scattered uniformly.
  • 11. Set the grid density.
    The script divides the mesh into a grid in order to efficiently calculate the placement of objects. The more objects you want to scatter, the higher this number needs to be. Higher values will increase calculation time.
  • 12. Set the amount of objects you want to scatter
  • 13. Save your scene
    Calculation of this script can be resource intensive so it is advised that you save your scene before continuing with the scatter.
  • 13. Click “Go” to scatter objects
    If any errors in your setup are detected a warning message will display pointing out the issues. If the settings pass the check, the script will execute and scattering will commence.

Current Limitations

  • The target object must be unwrapped without any overlapping uv’s (you can achieve this with an automatic unwrap if you want). Utilise as much of the 0-1 UV space as possible. anything out of that range will be ignored.
  • Only mesh objects can be targets. Nurbs and curves will not work.
  • Meshes being scattered cannot have complex hierarchies (i.e. objects parents under objects etc)

Bugs Reporting / Feature Requests

  • If you have any bugs you would like to report, or if you would like to request a feature please leave me a comment or send me a mail: info(at)shanemarks.co.za

Changelog

  • Version 1.3:
    • Added object / camera culling
    • Fixed orientation bug
    • Fixed crash on low grid density
    • added debug mode (set debugMode to True in debug.py)
    • Modularised Code
    • Version 1.3:
      • Cleaned up undo system
      • Added scale and rotation control
    • Version 1.1.1:
      • Fixed UI loading error.
    • Version 1.1:
      • Added “Bypass LOD” feature
      • Improved LOD generation
      • Improved human-error checking
    • Version 1.01:
      • Added Mac OS support.
UV Scatter Script 1.4

2 Responses

  1. Is there a build of these files for python 2.7?

    Colin May 13, 2016 at 4:46 am #
    • Hi

      I believe so (or whatever version of python came with maya at the time – might of been 2.6?)

      I haven’t really worked in this project in a while, I hope it is of use to you!

      shane May 13, 2016 at 9:38 am #

Leave a Reply

css.php