Monday, November 18, 2013

Painting geometry and MEL scripts (Poplate)

I just added a new post to my other blog, Last Light Film Blog, where I talk a little about a MEL script I made a few quarters ago which was designed to allow me to randomly place as many different geometry files on a surface while controlling various aspects such as collision detection and scaling.  Long story short, my script had too many bugs to use in my forest scene for my senior film, so i decided to use another tool I recently discovered called the Paint Geometry tool.  No this tool doesn't let you paint on geometry (there are plenty of other ways to do that already, I prefer Z Brush or Mudbox myself).  Rather, this tool allows you to literally paint geometry on the surface of any geo you want.  So you could paint 3D bears on a sphere, grass on a plane, or in my case, a forest of pine trees on a mountain.

I decided to use this tool but there are a few issues with it I still need to work out.  First of all, it allows penetrating geometry, which may not be a problem in my case since the trees are all far away, but I will have to spend the time to see if it is noticeable and fix it if it is.  It also only allows one geometry to be painted on, which means I had to repeat the process with a different geo to get some variety.  Luckily it also supports randomizing scale and rotation, and even translation, but it does each axis by itself.  This means I could potentially have a flat tree, which is not desirable.

So while I am still using this tool for now and have made adjustments to make sure it looks good, I have decided to still look into fixing my existing script, "Populate".  Populate will allow me to chose how many trees I want (or how dense I want it), how close together they are (for collision detection), select from as many ma and mb files as I want (and eventually obj, fbx, and alembic), and allow me to not only have random rotation on one or more axis, but also control random scaling in one of 3 ways, uniform scaling, diameter vs height (x+z vs y), or each axis separately.  I don't have to time right now to fix this... it is finals week, but during the winter break I want to take another look at this code and get a final fully functional version out there and then share it on here for anyone to use.

I will provide more documentation on Populate when I get the chance to refine it.  It does have some specific requirements for the importing geometry, and I would LOVE to have it use rib archives or even instances of an object instead of just geometry, to fit the user's needs.  For now, enjoy a screenshot from the opening shot of my final film (not lit or textured yet).

No comments:

Post a Comment