Saturday, August 22, 2009

nice solution to rounding float in MEL

though I use MEL less and less this day, it's still nice to have some solution for some problem, like the one below.

If you want to round a float to nearest integer in python, just use round(4.33) . But we don't have round function in MEL. so we need to do some workaround. I found below technique in Maya Station blog :


float $float = 3.14159265;

floor ( $float + 0.5 );

// Result: 3

Wednesday, April 08, 2009

add something like [code][/code] in blogger

When you need to post multiple-line source codes(mel,C,python,whatever)..you need the exact format as in your code editor because it'll look much tidier. But if you paste the code here in the standard blogger post editor, it'd look as ugly as you can imagine. So I search the net the found this site (also a blogger site):

http://formatmysourcecode.blogspot.com/


Basically you just need to paste the codes there, and it'll return the "correct" formatting for you. And then you can paste them back to your post editor.

Here's an example of it:
{
polySelectConstraint -m 3 -t 0x8000 -w 1 ;
polySelectConstraint -dis;
$selection = `ls -sl -fl -l` ;

string $borderShell[];
int $borderSize[];
int $currSize=0;
for($currID= 0;$currID<size($selection);$currID++)
{

if($selection[$currID]=="")
continue;

$borderShell[$currSize] = $selection[$currID];


string $tmp[]=`polyListComponentConversion -fe -tv $selection[$currID]`;
string $verts[]=`ls -fl $tmp`;

int $found=0;
int $iter=0;
int $maxIter = 20000;
do
{
$found=0;

for($nID = 0;$nID<size($selection);$nID++)
{
if($selection[$nID]=="")
continue;

if($selection[$nID] == $selection[$currID])
continue;

$tmp=`polyListComponentConversion -fe -tv $selection[$nID]`;
string $nVerts[] = `ls -fl $tmp`;


for($i=0;$i<size($verts);$i++)
{

for($j=0;$j<size($nVerts);$j++)
{
if($verts[$i] == $nVerts[$j])
{
$borderShell[$currSize] = $borderShell[$currSize] + " " + $selection[$nID];
$selection[$currID]="";
$selection[$nID] = "";
$j =!$j;
$verts[$i] = $nVerts[$j];

$found=1;
break;

}
}

if($found)
break;
}
if($found)
break;
}
$iter+=1;
}while($found && $iter<$maxIter);

$currSize+=1;
}
print $borderShell;
}


The example codes above are mel codes. The usage is to organize border edges into each separate border shells.

Saturday, March 14, 2009

Funny mind...


About six years ago, just graduated from high school, I was deeply obsessed with Kiyosaki's words. The most important thing seemed to be making quick money, then retire early and enjoy the "free life". But at that time, I had no idea and clear plan of how to quickly become rich and financial independent, aside from the abstract idea like "investing","leverage","ma
ke the money multiplies itself", etc.

Today, I still had no idea and clear plan :). But toward these years,my focus and main goals slowly shifted to become a "creative and inventive" person. By that I mean a man who possess technical and artistic skills to create astounding works,which in turn will generate money "enough" for my living needs. My interest in duplicating the income (for example by investing in stocks or real estate or whatever the investor teaches ^ ^ ) has been diminished, or more correctly, postponed.

Of course I'm still aware that I need to do some investing in order to "live easier" instead of counting on the "not so great" monthly income. But I think the first and foremost thing to do is to educate myself with the skills mentioned above so that I'm at least as competent as any others in my field, since it's a flat world now (thanks to Mr Friedman for the term). As long as you're competent, the demand for your skill will always exist, and the reward may increase exponentially when you're the 'A' list.

This may not be the best route to be financially independent (it's still my important consideration, I mean, who isn't?), but I think it's the most suitable and satisfying one for me, because basically I'm a person who's quite hungry for knowledge and information,and admittedly, recognition from others. For me it's quite satisfying when people recognize my work or appreciate my technical support/help. So hopefully I could contribute more and more in the future , and get satisfying reward in the process.

I wonder though, what will my 10 years older mind think about in this matter, will it dismiss my current thought as I'm doing now with my adolescence idea? :)

Sunday, February 01, 2009

fallen, and forgotten...

This is the rendered image of my latest personal works, mainly to practice my modeling, texturing, and rendering skills. No fancy stuff, I'm just trying to create a realistic image.

Description : A mask accidentally dropped on the street. He's not considered a valuable item, so nobody cared about him, and he gradually became dirty, and useless, ready to be thrown into trashcan..




software used : Maya as main platform, Photoshop for texturing, and 3Delight for rendering.

large image link :
http://r4inm4ker.frihost.net/works/images/mask-render1.jpg

Thursday, December 04, 2008

where did those logos come from?























Here's an interesting article about the logos of some of the big Hollywood studios, including Dreamworks SKG, Paramount Pictures, MGM, etc. Some interesting notes:
1. Warner Bros. (yes, that's legally "Bros." not "Brothers") was founded by four Jewish brothers who emigrated from Poland: Harry, Albert, Sam, and Jack Warner.
2.The original logo of Paramount had 24 stars, which symbolized Paramount's then 24 contracted movie stars.
3.Many of Columbia Pictures' early productions were low-budget affairs, so it got nicknamed "Corned Beef and Cabbage."

Link to the article

Saturday, November 22, 2008

I love living in Taipei..



Many people at work asked me :why do you want to study and work here (Taipei/Taiwan), and not in your own country(Indonesia). For me it's a trivial question. For almost every aspect I care about, Taipei just won comfortably. Let me explain some of them:





1. Public security is much better here (though my bicycle just got stolen some days ago,what an irony lol ). I feel safe walking in this city around midnight, unlike my home city (Medan) where I I had to worry everytime I was going home beyond 10 pm .

2. Public transportation is also very good. Traffic jam is rare occasion, MRT is doing an awesome job, and broken signs/ roads get fixed quickly. The only concern is taxi cabs, but I think it's just the same everywhere in the world. Maybe someone need to show me a town where the taxi drivers behave neatly :p.

3. It's a super convinient city. 24-7 stores(yes, 711 I'm talking about you) are everywhere. You can pay phone bills, parking fees,even fines there. Alot of night markets also running until 1 am more. That's why I'm living near one of those night markets, because I can find almost anything I need without driving too far.

4. I think this is the most important thing why I still live and work here after graduating, because I feel at home. Overall people are nice and treat me like a local, not a foreigner. That's something I could hardly get when I'm in my hometown. Funny isn't it? You're treated like a foreigner in your own country, but that's exactly what I felt when I'm in Medan before.

The current global crisis may change the situation a bit (people are more depressed), but I believe it still will be a place to live some years ahead. Maybe Taiwanese poeple need to be grateful to have such wonderful place to live, and not just complaining about something almost non-existent everyday.

Thursday, November 13, 2008

rainConnector Mel script

I've published a mel script to split polygon by vertex/edge selection in Highend3d. I called it rainConnector. The tool works by connecting selected edges/ vertices. It's especially useful when the model is in smooth mode (maya 2008 & 2009). The usual split polygon doesn't work in this mode, and it makes splitting polygon difficult to do. But using rainConnector, you can easily connect the desired vertices or edges. And it works on selection order too, by utilizing undo operation. Here's a gif screen shot of what rainConnect does:

This tool is actually inspired by connectComponent tool in OMToolBox. That original tool unfotunately doesn't work on most cases, so I rewrite it.