Pages

Sunday, January 31, 2010

A few notes about code optimization

A few notes about code optimization is my first tutorial topic at ScriptSpot. Yes, it's for MaxScript coders, but it's a very basic issue for all level (from beginners to advanced) script users.

Custom-made multi-channel OpenEXR


Deeper look (by Louis Marcoux) at the new Multi Channel OpenEXR file I/O in order to combine multiple bitmaps into a single Open EXR file.
Note: it's a feature for 3ds Max 2010 owners which are subscrition members as well.

Friday, January 29, 2010

Material Library to Material Editor

ML2ME
This come as a continuation of previous post.

Yes, an simple assistant tool for all people that found 24 Material Editor slots for not enough. The script is here.

More than 24 materials


Marco Brunetta post a maxscript for all people asking to use more than 24 materials in Max Material Editor. Well, 24 material limit in Max is not "stupid" for me, Material Editor is a temp art (working) palette, and 24 are enough slots. Marco's script dont extend the MEditor itself, he create material "pages" each having 24 materials. This "pages" are virtual array copies which saved in the scene (on root) by Custom Attributes and can be used after the file has been reopen. By default Max save into the file all used in the scene materials. That's enough and safe. There is Libraries files (.mat files) in Max where to keep your materials. However, I know an army of fans of this idea out there :) so if you are one of them then just try Marco's script.

There is standard (without scripts) work-around if 24 slots come not enouth:
1. Put to current Library your material (before clean the slot).


2. Backup all slots at once to Library
(and then clean all by MEdit menu / Utilities / Reset Material Editor Slots).

Thursday, January 28, 2010

Key Up Event


This is a topic ("Key Up Event") related to MaxScript that I found into ScriptSpot forum, where asked for how to track the state of a keyboard key, and in the current context - how to keep rollout dialog window open until the key is pressed and when the key is released to close the rollout.

Yes, there no such event handler like "on key up ..." in 3ds Max, but I suggest some fake "to do" trick based on timer (rollout controller). So if you feel an interest in this, just look at the forum here.

Car Body Design

Amazing! So many car modeling tutorails at one place (Car Body Design).

Wednesday, January 27, 2010

Star56


There is a new (just for fun) maxscript from me. It's a custom attributes that must be added to the Shape object on base level, not add them to the Attribute Holder or other modifiers, else will not work. For more details read the comments inside the code. The script you can find on my MaxScript page. The trick is in the ratio between Radius1 and Radius2 of the Star, which is binded to 1 Radius spinner (animatable, see the video). And the radio buttons switch between 2 presets - Pentagonal and Hexagonal star. Enjoy! :)

Procedural Map Scale


Another scripted tool from me. Good for global rescale at once the size of all procedurals. Works on any resizable procedural map. Read more and download the script from here.

Tuesday, January 26, 2010

Some old resources

With this site I go back in time, hehe... :) yes, I remember all these models there. The last upload on 3Dup.com is almost 3 years old. Although not something unique as art work, the models and textures there are still free.

Monday, January 25, 2010

Quick Fake Pivot Animator


I am quite busy lately, however, I saved a little time to rest with working on this "idiot-guide" tool for the fake pivot animations :) Yes, it's can really assist you.

I thing no need examples for the fake pivot in animation, everyone use it where they need. But if needed, "rolling box" is a good example for that. There is one "rolling box" animation from me:

Watch on YouTube: http://www.youtube.com/watch?v=5QX_vNnx01s
Watch on Yandex: http://video.yandex.ru/users/project3d/view/52/

We all know that Link Constraint is your best friend for this purpose at all, but... baking (collapse transform) to keys is Not exactly the same as swaping transform controllers. You yourself will feel the difference (if you try my scripted tool) and you'll find benefit from this method in some cases.

So, the core of the method based on the 3ds Max built-in function swap() . Very useful function (at least for me).

MXS help description for the swap():
Takes two valid assignment destinations (property, array index, or variable) as arguments and swaps their values.

Here's an base example for clarity:
-- 1. create 2 objects
b = Box pos:[-20,0,0] wireColor:black
s = Sphere pos:[20,0,0] wireColor:white
-- 2. now test the function
swap b.wireColor s.wireColor

You'll see the objects wire colors swaped.
I left some comments in the code.
The script you can find on my MaxScript page.

I don't give you direct download link, not cause I wish to show you my site, hehe..., no, it's a hosting server complication. Posted download links out side are detected and will redirect you to page where need to fill out a security code.

Well, I gotta get back to my duties ;)

Thursday, January 21, 2010

Loopable Flag


It's a cloth simulation tutorial by 3dean which is add a few modifications and notes to the existent tutorial by Vitsly.

Play with Array


Yes, it's about MaxScript arrays.
These are last 2 forum topics in ScriptSpot, just take a look...

Duplicate object finder/selecter
Find two (or more) objects in the same position but select only 1 of them.

Material ID percentage by height
Generate and apply randomness colors value between sets of colors with different randomness ratio by objects Z position.

Tuesday, January 19, 2010

IK/FK Solver


Felix Joleanes has released an IK/FK controller plugin. He also shared other plugins and script and a few rigging tutorials. Don't miss Technical Stuff sections too :)

Monday, January 18, 2010

Instantly Auto Edges


Instantly Auto Edges is a MaxScript that I just I published today. As usual I can share the link to the ScriptSpot post where you can read short description and usage notes, but... I would like to add some tips comments, which could be useful in writing other scripts, so...

First, I looked for a similar script and found 2 old that just loop through selected objects and performs auto edge, shortly - nothing special. Also I found a script by Pierre-Felix Breton. Interesting in the code is excluding instances optimization, which part come from Chris P. Johnson. But honestly, all code snippet looks like Chris job :) However. Well, even in this code, I saw many things that could be improved. As you will see yourself, I used mapped funcions. They are real magic, but the final awesome runtime speed result would be impossible without some tricks. So I wish to focus your attention at them.

First one is about collecting objects edges. Here needed all edges, and Max has easy ways to get faces but not edges. For example there no $MeshObject.NumEdges . Knowing that any face in mesh has 3 edges, Chris use loop from 1 to 3 end expression to collect all edges. This is slow. There is my way (using bitArray and ".numFaces" all is done in 1 command):

edgeList = #{1..(objs.numFaces * 3)}

Ok, Im add it to my mapped function and even this is enough optimization, i.e. my tests show that the script can operate almost 3 million edges per second ! But why not improve it if possible, right?

So the Second step is as Chris idea but in different method. Knowing that InstanceMgr.GetInstances output an array, it's clear so if the array keep only 1 item then the object has not instances (it's unique). Simple :) And if has more then we need just one of them, so here also not need separate commands. All what we need is to collect the 1st item only. Note: appendIfUnique function is also important! For more see inside the script code.

Well, the fast collecting instances deputy/delegate is not affect directly the final auto edges procedure, but I like it faster :) and as a said - this is a good trick for coding at all.

However, this step is also important because affects drastic scenes with many instances. If you have to say 100 instances - the script will proceed only 1, so it will end 100 times faster. In other words, even large scenes with many instances will end in no time !

My script you can find here.
Ok, that's all :)

Bigger/Smaller Comparisons

Well, it's about MaxScript comparision topic. I wonder why people continue to write custom funcions like this:
fn bigVal v1 v2 = if v1 > v2 then v1 else v2
fn smallVal v1 v2 = if v1 < v2 then v1 else v2

...provided that Max has great built functions amax() and amin().
Even more, they take more than 2 arguments and/or array.
-- Examples:
myMin1 = amin #(5,1,4,2,8)
myMin2 = amin 5 1 4 2 8 -- same as above
myMin1 == myMin2 --> true

In plain speed test both ((bigVal v1 v2) and (amax v1 v2), or (smallVal v1 v2) and (amin v1 v2)) has equal runtime. Well, even this is enough to skip writing of such functions, right? I know many people with a nice reputation in coding which still continue to do just that :) ... but not to digress from the topic... instead, let see the strong hand of those functions by simple test:
-- Let's fill an array with 100000 random integers
testArray = for i=1 to 100000 collect random 1 100

-- test 1
timeStart = timestamp()
amin testArray -- find min
amax testArray -- find max
timeEnd = timestamp()
t1 = (timeEnd - timeStart)

-- test 2
timeStart = timestamp()
sort testArray -- 1st need to sort the array
testArray[1] -- find min
testArray[testArray.count] -- find max
timeEnd = timestamp()
t2 = (timeEnd - timeStart)

format "Test 1 Time:\t\t% ms.\n" t1
format "Test 2 Time:\t\t% ms.\n" t2

-- result:
Test 1 Time: 0 ms.
Test 2 Time: 31 ms.

So, let's say, end of story here :)

Saturday, January 16, 2010

Extended Dummy with custom Mesh

Hi Dave, this post is specially for your question:
Can I extend a dummy object and replace the mesh and wirecolor of the Dummy object?

Yes, you can, using getDisplayMesh and createInstance just like its done in simpleObject geometry class plugins. In createInstance function you can supply needed propetries like wirecolor and etc.

I know a site with existing example code - Snipplr.com - it's a coders community where to get or upload code snippets and they have (not so rich but useful) MaxScript section. There is the link to the example extended Dummy helper with custom mesh:
http://snipplr.com/view/11904/scripted-helper-object-plugin/

3ds Max 2010 and stability

This is like to me more as defend lecture than ... :) well, there is a few hardware tips, but Ken Pimentel put accent on CERs (costumer error reports) system.

Friday, January 15, 2010

WireFence update


Some quick and simple update over my WireFence script today. Nothing special, yep :) but just in case you curious about how to open scripted utilities (from button or macros for example) - take a look at openUtility() function ;) and ...

if you like some of my scripts then please vote for them (at ScriptSpot) to have more incentive to share, thanks ! :D

Wednesday, January 13, 2010

DummyEx

DummyEx
May seem quite trivial to extend the Dummy, but this scripted plugin is useful in cases where scaling transform is undesirable (in rigging for example).

You can download DummyEx from here.

Monday, January 11, 2010

Select objects visible to camera

Select objects visible to camera is an interesting topic in Autodesk Area forum related to MaxScript.

Saturday, January 9, 2010

Transparent Alpha Channel


Mental ray tutorial by Ramy Hanna.

Autodesk Backburner 101


Part1 - BackBurner overview:

Part2 - Backburner install, setup and demonstration of job submission:

ScriptSpot upgraded


Some of the changes is - new directory struct. Old links for now redirect to new one. For more details read Upgrade status news by site admin.

Create a Marching Army Animation using Particles


Particle Flow video tutorial by Hugo Tromp.

Thursday, January 7, 2010

Electric plug modeling


A lazy modeling tutorial used mainly Boolean operations.

Monday, January 4, 2010

Contrastive Wire Color

Here's a script that I just wrote - Contrastive Wire Color .


Just make your objects more readable in the viewport.
Yes, this is NOT a random color generator!
The utility adjust RGB channels of objects wirecolor.
The purpose is clear (I hope).


[*] Undo available
[*] Tested on 3ds Max 2009
* (should work with any version)

Enjoy!

Sunday, January 3, 2010

Bokeh in 3dsmax with particle flow and maxscript



Described method by Vladimir Alexeev shown how to render fast camera DOF effect using MaxScript and PFlow.

Saturday, January 2, 2010

HDR's tutorials and tips


CGTechniques web site seems not updated from years but their is some HDR's tutorials and tips, plus a free HDRi library, and some old MaxScripts as well.

Friday, January 1, 2010

Happy New Year !