maxsript

Suzuki Grand Designs TVC by David Mackenzie

Suzuki Grand Vitara TVC

Towards the end of last year we (Our Vision) were engaged to create a Grand Designs inspired TVC for Suzuki who are sponsors of Grand Designs Australia. As usual we had a tight timeline to turn it around in. The animation went from previz to final in one week, over the next week we rendered an comped. We used our own animation rig on the car that I wrote sometime ago which let me animate it very quickly. The rig I guess is a cross between simulation and straight animation which lets us have total control over all parts of he car.

[flv:http://daveandgoliath.com/wp-content/video/Suzuki_Final.flv 600 337]

Below is the first render test we did with animation on the car. I actually preferred this camera animation but we thought it was a bit much for the subject matter and in hindsight I think we were right.

[flv:http://daveandgoliath.com/wp-content/video/Suzuki_Render_Test.flv 600 337]

You can see all the work Our Vision has done for Grand Designs Australia and the Suzuki Grand Vitara TVC on Lifestyle channel.

Links:

Cortex by David Mackenzie

I thought this was worth a mention. The guys at Ephere have been working on an exciting project that looks quite promising. What looks like a node interface for creating plug-ins for max has the potential to make the SDK even more accessible to artists and TDs. I am assuming the plug-ins it creates are using their .Net wrapper for the SDK. I have to say that it is great to see these guys continuing to add great products to max. I really like that they seem to also focus on making it easier for TDs to be able to solve problems, there .Net wrapper (which the Autodesk's .Net wrapper is based on) has made my life MUCH easier. I have been able to bust out new tools and plug-ins much faster (perhaps 2-3x) than using the standard SDK.

Check it out below:

In any case it certainly looks exciting. Will watch this space.

Cheers,

Dave

 

Infocenter WHAT?? by David Mackenzie

Infocenter

No Infocenter!  

I hate the infocenter in max. I also hate the big "M" button they added when they removed the file menu (this file menu can at least be easily add back). I can understand Autodesk changing/adding these things as they decrease the learning curve for new users which is great as the more accessible Max is to new  users the better.

But none the less, people like myself that have been beating max in to doing what we want for many years no might not always appreciate these small "enhancements". If it where up to me I imagine max would still look exactly the same as version 2009 before they added all UI tweaks.  So it was with much excitement when a collegue of mine at Ourvision flicked me a link to a script that removed it. As soon as I looked at the 4 or so lines of codes I realised this is something I should had have thought of a long time ago.

None the less if you like to remove the info center check out the script below:

 Close Infocenter

If you would also like to remove the buttons that are to the right of the big "M" button you can use this version below:

( controlshwnds=windows.getChildrenHWND #max; InfoCenter=for c in controlshwnds where c[5]=="InfoCenterHwndSource" collect c; QATWind=for c in controlshwnds where c[5]=="QATHwndSource" collect c; try(UIAccessor.CloseDialog InfoCenter[1][1])catch(); try(UIAccessor.CloseDialog QATWind[1][1])catch(); )

 

No Buttons!

Both of these scripts should be placed in your scripts/startup directory. I have not found away to turn off the big "M" yet, if anyone knows how to I would be very interested in hearing about it.

Cheers,

Dave

Meet Larry, the 3dsmax layer manager. by David Mackenzie

layers_feature

Why build a new layer manager? 3d Studio Max has had a layer manager for a long, long time. It works very well for what it is, however, as scenes over the years have grown large and complex the layer manager has not evolved to over come this. Scenes these days have more levels of detail and with that detail has come a need for better scene management. When deciding to create a new layer manager there were a couple of things that I wanted to do:

  • Keep the existing layer manager, this seems strange but I like solutions to problems that build in redundancy. If my new layer manager decided to stop working in the middle of production I wanted to be able to revert back to the old one. This meant anything new I created would either need to be built on top of or use the existing layer manager as its core.
  • The layer manager needed to be more granular. Everyone has wanted layer manager that has had sub-layers. I wanted to be able to have sub-layers of any depth.
  • Sub-Layers would inherit the properties of there parents.
  • Make it easy to build new tools and features into the new layer manager. If I was going to build a layer manager I wanted to be able to extend it easily.
  • Standardise our layers and workflow. I wanted to create a workflow were our files and how we worked in them was standardised so that anyone in the studio could open someones file and be able to hit the ground running.
With those goals in mind I got to work. I chose to write the layer manager with Max Script and .Net instead of hitting the SDK. The upside to working with Max Script and .Net is that I could write the tools very fast and after 2 days I had the first version out the door for the artists to try. Since then it has grown and been updated as it has needed to be. There were originally a flurry of bug fixes that were required but after that we set about creating new features as production called for it. It has been about a year since I first wrote it and now it is a solid production tool after cutting its teeth on small jobs and then proving itself on larger jobs it has become an integral part of our workflow.

Custom Features of the layer manager

There are many custom features I have written into the layer manager some of them are below:

  • Isolate Layer. Similar to Max's isolate feature when you right click on a layer and select isolate all other layers are hidden and the selected layer is turned on. The next time you right click on the layer you have the option to de-isolate it. This has proved very handy when yo need to do some quick modeling fixes in large scenes.
  • Rename Layers and Children. I wanted an easy way to rename layers and there children right in the dialog. This proved a little trickier than I first thought it would, however, you can now easily rename layers just by double clicking on them and typing.
  • Node View. An external view for handling nodes.
  • Export Layer. Saves the selected tree of layers as an X-Ref.
  • Layer Sets. For saving the layer states of layers. For instance you can save a state for a camera with all of the relevant layers turned on. This is great for large scenes that have multiple cameras.

A new Layer Manager

Below are some screen shots of the new layer manager. As you can see the interface is very simple and faithful to the original layer manager, this lets new artists in the studio get up to speed with the tool right away.

 

LayerManager v2.0

Standard Layer Manager

Most recently we used the tool on the Renovators with great success. Using it in conjunction with a few other tools we were able to achieve the impossible delivering animation for 6 houses in 6 days. You can see some of the work here.

 

What Next?

Moving forward there are a couple of things that I am currently working:

  • Increased Performance. I want to increase the performance of the tool so that I can add support of scene objects in the tree view. So far I have re-written the control and I am pleased to say the performance is much faster. Not to say the current version is slow but there is a difference between adding 200 or so layers and 5000 objects.
  • Tighter integration with X-Refs and containers. I want to make splitting up max files to be completely seamless and transparent. This will be a huge benefit on large projects with more than one artist working on it. Hopefully the layer manager will become a bug for scene management.
  • Create an connection between render passes and layers. It would be great to expand the layer sets functionality to be able to create different render passes.
Overall I am hoping the layer manager to grown into more of a scene manager which will allow artists to manage there scenes as quickly as possible all in one place.
A silver lining?
The biggest upside of writing this tool has been the change in artist behavior. Our scenes are now much more standardised enabling anyone to pick up a project and continue to work on it. Changing a team of artist habits is difficult at best some times it takes a good tool to serve as the catalyst for change. I happy to say that new layer manager has succeeded in this respect.
Cheers,
Dave

 

GML Importer Version 2 by David Mackenzie

gml_feature

I will assume most of you know what GML is, if not check out this post I made some time ago here. In the months that have gone passed we have developed three different version of the GML importer. The first version that was featured in a video here, was a basic hack that we used to get a job done. The second version was an expansion of the first while it was a little better it lacked a few important features:

  1. Easily update-able framework.
  2. An "API" or a library of functions to take advantage of in other scripts or tools.
  3. A single unified User Interface that exposes all of the data in the GML File.

So after taking a moment and addressing these issues we created what we believe to be a great tool. It includes a library of code that other 3ds Max TDs and scripters can take advantage of. We choose to focus more on the data and library that goes with it. In it's current form the script will only create a spline shape from the GML file. I will be updating it to include a feature to create proper geometry. We currently have it working by creating a sequence of points and using Delaunay Triangulation to create the surface.

The User Interface

The interface at first glance looks quite complicated, however, it is actually very simple. We wanted to expose everything to the artists so there are quite a lot of UI controls, most of which can easily be tucked away for later use. I was going to document what all of the UI controls do below but since each one has a question mark I'll let you work it out.

GML Importer Version 2
GML Importer Version 2

The Library

We believe simplicity is the ultimate sophistication so we tried to keep everything as simple as possible. Below is a brief run down of the maxscript structs that make up our GML importer.

  • gml_point GML point is a simple struct the stores x, y, z along with t (time) values. If it was not for the t I would had have just used a point3.
  • gml_sketch This struct represents a whole sketch. It is made up of strokes (s_strokes). Each stroke is an array of gml_point()
  • gml_custom_props This struct just stores some custom data that is not from the gml file.
  • gml_header Stores all the information in the header of the GML file. Mainly stores name, username, version and keyword information. This data is reflected in the GUI in the information rollout.
  • gml_enviro This struct holds all of the environment data in the GML file. This includes the canvas size, up vectors and related data. This information is reflected in the GUI in the Environment rollout.
  • gml_document is the guts of everything, its instantiates every one of the above structs. Through this struct you can interact with all facets of a GML file. The struct also provides three methods to create objects and shapes from the data, these are mainly included as examples of what you could do. These functions are  implemented in the GUI. We are currently working on a new method to create geometry that will be included in new updates.

Looking through the gml_data.ms file will give you a good understanding on what is going on. There is a pretty detailed example in the comments showing you how to create gml_documet to sum up the simplicity there is a snippet below:

a = gml_document() a.file = "C:\\18763.gml" a.init() a.createShape()

You can download the GML importer below.

For everyone that has posted and emailed me asking where is the importer? Well it is here now, thank you for your support and let me know how you go. If you create something cool then please send it in. In the spirit of community if you are making this better then lets make it better for everyone! Send in any changes or updates you find. Feel free to posts bugs in the comments below.

Cheers,

Dave

V-Ray Proxy Tools by David Mackenzie

Proxy_Tools
V-Ray Proxy Tools
V-Ray Proxy Tools

Proxy Tools is another one of my most used scripts. It allows you to control the display modes of V-Ray proxies in your scene. This tool has speed up my workflow on large scenes 10 fold. Any scene with large numbers of proxies will benefit from using this tool.

As you can see in the screenshot above their are very few controls. You can easily hide and show proxies as well as change there display mode. If you have suggestions for any additions to Proxy Tools please let me know.

You can download it here.

Studio Tools - Rapid Tool Development by David Mackenzie

Studio_Tools

One of the best features of maxscript is that you can create tools very quickly and intuitively. Often the simplest tools are the ones that can lead to massive time savings. This was the case when my good friend Warwick Hays from Monkey3Media asked for my assistance in creating a small tool. The tool in question was Studio Tools which would let artists quickly load up pre-configured studio rendering scenes. They could also choose to load relevant render settings. From concept to completion we had a production ready tool in less than 3 hours. It just goes to show that when you need a custom maxscript to speed up your workflow it need not cost an arm and a leg.

From our initial conversations on the phone Warwick quickly mocked up the user interface that he wanted. From there I created a prototype that was functioning correctly. Warwick then supplied some custom graphics for use in the tool. Shortly after, we rolled out the finished version graphics and all. The result ended up being a very usable, useful and time saving tool. It is amazing the difference it makes replacing 5-10 mouse clicks with a single click. As artists respond to things visually naturally, the icons go along way to simplifying the thought process.

Hot Box Source by David Mackenzie

Maxscript_Image
Maya Style HotBox for 3dsmax
Maya Style HotBox for 3dsmax

I was recently asked if I could give out the source code to my Hot Box which I have decided to do. I had planned to develop it a lot further but time got the better of me. Starting a new job and jumping straight back into production meant that I had to abandon it. Truth be told I was always going to give away the source. I like to give back to the community that I have learned so much from, however, it was a messy hack and I decided to encrypt it. I have since done quite a lot of work to expand it and I am planning on using it as an interface to all the tools I have written at Our Vision. Unfortunately, I am cannot distribute that to the public I will, however, show some screen shots so you can see what can be done with this kind of interface.

The more I played with the hot box the more I realised that max did not need one. I am sure there are plenty of people who disagree. I do, however, really like this technique for creating an interface for suites of tools.

Feel free to download it below. I would ask that if you use this to create some thing cool or use it in production please let me know. Consider it to be Quoteware.

You can download it here. 

Cheers,

Dave

Select Objects By Material Name by David Mackenzie

AssetManager_Thumb_3

As the name implies this is a simple script for selecting objects based on the name of the material assigned to them. I originally wrote the tool to deal with a sketch up file that was exported for 3ds max. When it came in it had thousands of objects each with their own material, this made it very difficult to work with the file. The script supports wild cards. For example if you have objects with material names like "AC01_GLASS_01", "AC02_GLASS_02" etc. you can drop in wild cards at the start and end such as "*GLASS*". This will select the objects that have "GLASS" in the name of the object's assigned material.

Select Objects By Material Name
Select Objects By Material Name

You can download the script below.

I also wrote another script that works quite well with this one. It makes collapsing geometry a lot easier, faster and more reliable. Anyone who has used the collapse tool with a large object count, knows how much of a pain the ass it can be. I will upload Super Collapse soon.

Cheers,

Dave

As usual if you have any problems, suggestions or comments then please leave them below.

Logo Tools - Convert Bitmaps to MXS by David Mackenzie

Maxscript_Image
Logo Tools v1.00
Logo Tools v1.00

Here is a script designed for other script writers. Anyone who has spent some time creating custom images for their scripts and tools know how much of a pain it can be wrapping them for distribution. Logo Tools is designed to make that a little bit easier. It allows you to pick an image and then convert it to a maxscript array so you can embed your bitmap into your script. All of the functions and code required to convert your maxscript array back into a bitmap are included.

This is a very easy, neat and tidy way to package your scripts up. I normally include the code in a install script that writes all of the bitmaps to disk so they can be used again later. If anything ever happens to those images your script has the code to recreate them on the fly.

Logo Tools is very easy to use, just follow the steps below:

  1. Pick an image file that you would like to convert. Do this by clicking the "+" button.
  2. Now pick the file to output again by clicking the "+" button. This file will contain the array representing the bitmap and a code required to convert the array back to a bitmap.
  3. You can now hit the "Make It So" button to get the ball rolling. The progress bars will continue to update until complete.
  4. You can now open the outputted script file which will have the array and a function to create the bitmap already in it.

If you run into any trouble or have any ideas on how I could improve this script please let me know. Feel free to leave a comment below.

To download Logo Tools just click here.

Remember the bigger the image you select the longer it will take and the larger the resulting script file will be.  This script is really designed to handle small logos and button icons that would be added to custom tools. Running the script on a large image will take a long time and the script file will be huge!

I have been asked for an example on how to integrate the images into a GUI control. Below you can download the source for my script (I think some people thing I did not write it??) along with a small example showing how to add an image to a button. I should also mention that the max script help file has excellent resources for working with images and UI controls.

To download Logo Tools source and demo click the link below.

{filelink=5}

Audi S5 Burnout by David Mackenzie

S5_Burnout

Audi S5 Burnout Image This a scene I put together a year or so ago to show case my new car rig. It is a very simple animation with only a few key frames used to generate the animation, everything else is handled by the rig. You can see the animation in the below. Keen observers will notice that the one of the front wheels does intersect the body work, this however was my fault for not setting the limits correctly.

I have also included a quick compositing brake down after the animation. I am happy to say that as soon as we get some time to prepare the rig for distribution we will make it available to everyone.

[youtube]0j8CniP4tgk[/youtube]

[youtube]EkjlaAwi5x8[/youtube]

Hope you guys liked it.

Cheers,

Dave

Wire Colour Tools by David Mackenzie

WireColourTools_Thumb

Wire Colour Tools is a simple script for setting random wire colours to all of the objects in the scene. Anyone who does allot of post work either in PS or a compositing package should find this script useful. Being able to adjust any element or of your project in post by the object enables you to get the most of your image, rendering Wire Colour passes is very simple and inexpensive from render time point of view.

Wire Colour Tools
Wire Colour Tools

You can download it here.

Wire Colour Tools has three way in which you can use it:

  • Colour By Layer. This sets a random wire colour all of the objects on each layer.
  • Colour By Material. Perhaps the most useful of the three options this one will set all objects wire colour based on the material that is applied to it.
  • Random Colour. This is pretty self explanatory it allows you to set a random wire colour to every object in the scene.

There is also the option to run these only on selected objects.

To install just copy "wireColourTools.ms" to you 3dsmax/Scripts directory and then run "wireColourTools_Macro.mcr". You will then be able to find the script in the Customize User Interface options under the category "Daves Tools".

I hope you find Wire Colour Tools useful. Again if you are doing allot photoshop work on your images I imagine this tool will save you some time.  If you have any suggestions for new features please let me know and I will do my best to get them in there. If you do come across a bug please let me know.

Cheers,

Dave

Turn View Port Maps On/Off by David Mackenzie

Turn View Port Maps On

A simple script that wrote quite some time ago. It seems to have a great deal of staying power as artists continure to use it on a daily basis. It is very simple and only has a few options. At the moment it support standard materials and V-Ray materials including nested Multi Sub-Materials. If there are any other types of materials that you would like me to implement just let me know, even though I may not use them I am more than happy to add them for the sake of completeness.

Turn View Port Maps On/Off Screen Capture
Turn View Port Maps On/Off Screen Capture

I hope it helps you out. If you have any ideas for features to add just leave me a comment.

You can download it here.

To install just copy "TurnViewPortMapsOn.ms" to your 3dsmaxroot/Scripts directory and then run the included macro ("turnViewPortMapsOn_Macro.ms". Once the macro has been run you can find the script under the category "Daves Tools".

Updates:

29/07/2010  I have updated the version for download. Changes include:

  • I have fixed the problem that lead to bump maps not being turned off and on.
  • I have Added support for MR Arch Design material s.

Cheers,

Dave

Maxscript, speed up your workflow by David Mackenzie

Maxscript_Image

Every day I get asked if a can whip up a script for this or a script that etc. More often than not I just walk over to the artist machine and do a very simple type in, maybe a few lines at most and that will solve their problem. Now not that I mind walking to someones desk to help them I thought I might take a second to discuss some ideas about manipulating large numbers of objects quickly, effectively and working on specific object types.  I really believe that scripting can empower artists, many artists shy away from scripting especially when there sitting next to a TD but a simple understanding of some simple scripting ideas can speed up an artists ability to work. I do not intend this to be a introduction to scripting. I just want to show you how you can manipulate objects quickly using simple loops, basic conditional statements and the max script listener.

For Loops

Loops are how we iterate over objects, numbers, arrays etc. I found the best explanation of it in the Maxscript help file, "The for loop iterates through a range of numbers, time values, or a sequenced collection of values, such as an array or object set."

In this example we will be iterating over materials, a specific type of material. There are a number of way one can accomplish this you could simple iterate through sceneMaterials and check to see if each material is the correct class that you want, this however would be slow and unnecessary. Instead we are going to use the getClassInstances function that will return an array of objects of a given type. For exmaple:

getClassInstances Sphere -- This would return an array of every instance of a sphere in the scene. getClassInstances VrayMtl -- This will return an array of every Vray Material in the scene.

It is very simple to use the array returned by getClassInstances() in a loop. for i in (getClassInstances VrayMtl) do(print i) --This will print every Vray Material in the scene

So now that we can iterate a given type of object or "class" we really want to be able to do something with them. An important concept to understand is that when we loop through the returned array each item in the array as we move through it is stored in the variable "i". Consider the following code:

for i in (getClassInstances Sphere) do(i.radius = 100)

That statement will set the radius of every sphere to equal 100. It does this by first collecting them using the getClassInstances() function and "moving" the variable "i" through the array where "i" is used to access the  radius property and set to 100. We could also do something a bit more interesting like set the radius of every sphere to be random. We will use the random function in this example to give us a random integer. for i in (getClassInstances Sphere) do(i.radius = (random 25 100)) Now each sphere will have a random radius between the 25 and 100.

Unless you really wanted to create Spheres with a random radius lets move on and learn how to do something useful.

The Maxscript Listener

Using the listener you are able to record your "actions" so to speak. This is a very easy way to query a property that you may wish to manipulate in a script. For example you might want to turn off trace reflections on all V-Ray Materials. To do this open the max script listener (Maxscript -> Maxscript Listener or hit F11). Once the listener is open go to the Macro Reorder menu and enable the macro recorder.

Open Maxscript Listener Screen Capture

Maxscript Listener Enabled Screen Shot

If you now go and open the Material editor select a V-Ray Material and Turn off Trace reflections. Imediately you should notice that Listener updating, in this example it should read something like:

meditMaterials[1].option_traceReflection = off

In the above piece of code where are interested in everything after the ".", meditMaterials provides access to the materials in the editor (another article for that).

Now using what we learnt in the section covering loops we can now go ahead an change every V-Ray material in the scene:for i in (getClassInstances VrayMtl) do(i.option_traceReflection = false)

How easy was that? As you can see simple type in expressions or loops can save you a great deal of time. Just to recap we very quickly went over using loops with the getClassInstances() function and using the listener to ascertain what property's we need to change. If you have any question then please just post in the comments I will do my get back to ASAP. Also remember the maxscript help file is your friend it is a fantastic help, if you are having trouble of some of the more basic concepts I suggest you start there.

I hope that shed some light on some very simple scripts that you might be able to use. If you have an idea for a tutorial use this form, I am more than happy to tackle any challenges you have in 3d or 2d.

Cheers,

Dave

GML Importer by David Mackenzie

gml_motage

We were very inspired by what we saw over at http://graffitianalysis.com/ so we decided to write a GML importer for 3ds max. We where pretty happy with the very quick tests we have done. The tool is almost finished at which point we will release it. We are always in support of open formats and GML (Graffiti Markup Language) is not an exception. All of the test where created by the script which has options to produce spline shapes, animated objects, a simple particle flow setup (that's in the video) and point clouds. If you have any thoughts on what would be good to add just let me know.

Would love to hear what you guys think. Be sure to check our http://graffitianalysis.com/ and http://000000book.com/

[flv:http://daveandgoliath.com/wp-content/uploads/2010/04/GML_Importer_Vid.flv 547 308]

We are also adding support for Digital Fusion and Nuke we may add AE support all though we do not use it a great deal.

Cheers,

Dave