Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 121 21-05-2006 , 05:36 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
I think ArneOOg said this earlier:

Indigo For Animations? No Way!!!

Check this out (NOT DONE BY ME!!!!)

There is an AVI (640x480) that the same guy did, but I won't post it.

He said each big frame (640x480) was rendered in 20 minutes.

user added image


Live the life you love, love the life you live
# 122 22-05-2006 , 01:37 AM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
cones! lol. 2 hrs, rendered originally at 640x480 (scaling down trick- it reduces noise really well, and in less time!!!)

Attached Images

Live the life you love, love the life you live
# 123 22-05-2006 , 12:36 PM
arneoog's Avatar
Registered User
Join Date: Mar 2006
Posts: 189
yeah.. hehe I did say that :blush:
But I thought it was really cool when I saw it!!! user added image

That's some awsome looking cones, Matt! user added image hehe

The first script for Maya to Indigo v.0.0.1 has been made :attn:
Can't wait to see it finish!!! user added image

# 124 22-05-2006 , 08:28 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
yeah, I am gonna make one too, gonna start on it soon.

'cept, it will actually produce an XML file (I hope!!!) and run indigo with it! It will work with meshlights, and have custom materials that you can assign to objects, and it will have a box (with checkboxes for physical sky, DOF, etc...)


Live the life you love, love the life you live

Last edited by MattTheMan; 23-05-2006 at 12:31 PM.
# 125 27-05-2006 , 12:42 AM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
I've written a Maya->Indigo exporter!

Please test it! Oh- your up vector needs to be set to Z.

no meshlights yet, it makes a default background light, triangulate mesh first-

IMPORTANT Triangulate every single polygon in your scene. Also, delete ALL history first.I will have the script to do that, but, 'till then...

Lambert materials are plain diffuse

Phong materials-

Color is actual color

Reflectivity is specular color

If you want a non-constant specular color (eg 1 0 1 instead of 1 1 1) you need to set reflectivity to 0 and use the reflected color gauge

Cosine power is specular sharpness (warning- it is multiplied by 10- eg. 12 is 120 and 0.3 is 3)

you need to use a camera- camera, aim, and up. Don't rename it.

Code:
//Script by Matt B. (ThatDude33) for export from Maya 6.5+ to Indigo 0.5.3
//Fixed by Arne OOG
//Outputs in script window
//Copy-Paste results into XML file, run using Ini File.
//No edits should be neccesary

//Start Writing:
string $write = "<?xml version='1.0' standalone=no>\n";
$write += "<!--Exported from Maya-->\n\n";

proc vector normalize(vector $v){
float $len = sqrt($v.x*$v.x+$v.y*$v.y+$v.z*$v.z);
vector $n = <<$v.x/$len, $v.y/$len, $v.z/$len>>;
return $n;
}
//Will have a prompt window, but now uses settings from render globals
$write +="<scene>\n";
$write += "\n<renderer_settings>\n";
$write += "\t<width>" + `getAttr defaultResolution.width` +"</width>\n";
$write += "\t<height>" + `getAttr defaultResolution.height` +"</height>\n";
$write += "\t<metropolis>true</metropolis>\n";
$write += "\t<large_mutation_prob>0.2</large_mutation_prob>\n";
$write += "\t<max_change>0.025</max_change>\n";
$write += "\t<russian_roulette_live_prob>0.7</russian_roulette_live_prob>\n";
$write += "\t<max_depth>1000</max_depth>\n";
$write += "\t<bidirectional>true</bidirectional>\n";
$write += "\t<strata_width>10</strata_width>\n";
$write += "\t<frame_upload_period>20</frame_upload_period>\n";
$write += "\t<halt_time>-1</halt_time>\n";
$write += "\t<logging>true</logging>\n";
$write += "\t<image_save_period>30</image_save_period>\n";
$write += "\t<save_tonemapped_exr>false</save_tonemapped_exr>\n";
$write += "\t<save_untonemapped_exr>false</save_untonemapped_exr>\n";
$write += "</renderer_settings>\n\n";
$write += "\t<tonemapping>\n";
$write += "\t\t<reinhard>\n";
$write += "\t\t\t<pre_scale>2.0</pre_scale>\n";
$write += "\t\t\t<post_scale>1.0</post_scale>\n";
$write += "\t\t</reinhard>\n";
$write += "\n\t\t<colour_correction>1.0 1.0 1.0</colour_correction>\n";
$write += "\t</tonemapping>\n";
$write += "<background>\n<radiance>1 1 1</radiance>\n</background>\n\n";
$write += "\n<camera>\n";
float $px = `getAttr camera1.tx`;
float $py = `getAttr camera1.ty`;
float $pz = `getAttr camera1.tz`;
vector $pos = <<$px, $py, $pz>>;
float $tx = `getAttr camera1_aim.tx`;
float $ty = `getAttr camera1_aim.ty`;
float $tz = `getAttr camera1_aim.tz`;
vector $aria-label="User link" rel="noopener noreferrer nofollow" class="giveMeEllipsisa" target= <<$tx, $ty, $tz>>;
vector $front = $target-$pos;
vector $dist = $front;
$front = normalize($front);
$write += "\t<pos>"+$px+" "+$py+" "+$pz+"</pos>\n";
float $ux = `getAttr camera1_up.tx`;
float $uy = `getAttr camera1_up.ty`;
float $uz = `getAttr camera1_up.tz`;
vector $up = <<$ux, $uy, $uz>>;
$up = $up - $pos;
$up = normalize($up);
$write += "\t<up>"+$up.x+" "+$up.y+" "+$up.z+"</up>\n";
$write += "\t<forwards>"+$front.x+" "+$front.y+" "+$front.z+"</forwards>\n";
float $fstop = 8;
if ($fstop < 1.0){
$fstop = 1.0;
}
if ($fstop > 22){
$fstop = 22;
}
float $aprad = 50/$fstop;
$aprad = $aprad/200;
$write += "\t<aperture_radius>"+$aprad+"</aperture_radius>\n";
float $FD = sqrt($dist.x*$dist.x+$dist.y*$dist.y+$dist.z*$dist.z);
$write += "\t<focus_distance>"+$FD+"</focus_distance>\n";
$write += "\t<aspect_ratio>"+`getAttr defaultResolution.deviceAspectRatio`+"</aspect_ratio>\n";
$write += "\t<sensor_width>0.036</sensor_width>\n";
$write += "\t<lens_sensor_dist>0.0523314</lens_sensor_dist>\n";
$write += "\t<white_balance>D65</white_balance>\n";
$write += "</camera>\n\n";

string $mats[] = `ls -mat`;
for ($one in $mats){
	if (`objectType $one` == "lambert"){
		$write+= "\n<material>\n";
		if($one == "initialMaterialInfo"){
			$one = "lambert1";
		}
		$write += "\t<name>"+$one+"</name>\n";
		$write += "\t<diffuse>\n";
		float $color[] = `getAttr ($one + ".color")`;
		$write+="\t\t<colour>"+$color[0]+" "+$color[1]+" "+$color[2]+"</colour>\n";
		$write += "\t</diffuse>\n";
		$write += "</material>\n";
	}
	if (`objectType $one` == "phong"){
		$write += "\n<material>\n";
		$write += "\t\t<name>"+$one+"</name>\n";
		$write += "\t<phong>\n";		
		float $col[] = `getAttr ($one + ".color")`;
		$write += "\t\t<diffuse>"+$col[0]+" "+$col[1]+" "+$col[2]+"</diffuse>\n";
		float $reflectivity = `getAttr($one +".reflectivity")`;
		if ($reflectivity > 0.0){
			$write += "\t\t<specular>"+$reflectivity+" "+$reflectivity+" "+$reflectivity+"</specular>\n";
		}
		if ($reflectivity == 0.0){
			float $refl[] = `getAttr ($one +".reflectedColor")`;
			$write += "\t\t<specular>"+$refl[0]+" "+$refl[1]+" "+$refl[2]+"</specular>\n";
		}		
		float $exp = `getAttr ($one + ".cosinePower")`;
		float $exp = $exp * 10;
		$write += "\t\t<exponent>"+$exp+"</exponent>\n";
		$write += "\t</phong>\n";
		$write += "</material>\n";
	}
}

string $shapes[] = `ls -s`;
for ($one in $shapes){
	if(`objectType $one` == "mesh"){
	int $nV[] = `polyEvaluate -v $one`;
	int $nF[] = `polyEvaluate -f $one`;
	int $x = 0;
	$write += "\n<mesh>\n";
	$write += "\t<name>"+$one+"</name>\n";
	$write += "\t<embedded>\n";
	for($x=0;$x < $nV[0];$x++){
		string $cv = $one+".vtx["+$x+"]";
		float $pos[] = `pointPosition $cv`;
		$write += "\t\t<vertex pos='"+$pos[0]+" "+$pos[1]+" "+$pos[2]+"'";
		float $normal[] = `polyNormalPerVertex -q -xyz $cv`;
		$write += " normal='"+$normal[0]+" "+$normal[1]+" "+$normal[2]+"'";
		string $uv[] = `polyListComponentConversion -fv -tuv $cv`;
		float $uvcoord[] = `polyEditUV -q $uv`;
		$write += " uv0='"+$uvcoord[0]+" "+$uvcoord[1]+"'/>\n";
		}	
	$write += "\t<triangle_set>\n";
	string $sg[] = `listConnections -type shadingEngine $one`;
	string $mat[] = `listConnections $sg[0]`;
	//$mat[2] holds the actual material.	
	print(`listConnections $sg[0]`);
	if ($mat[2] == "initialMaterialInfo"){
		$mat[2] = $mat[0];
	}
	if ($mat[2] == "renderPartition"){
	$mat[2] = $mat[3];
	}
	$write += "\t<material_name>"+$mat[2]+"</material_name>\n";
	for($x = 0;$x < $nF[0];$x++){
		string $curface = $one +".f["+$x+"]";
		string $vfl[] = `polyListComponentConversion -ff -tvf $curface`;
		$vfl = `filterExpand -sm 70 $vfl`;
		$write +="\t\t<tri>";
		for ($v in $vfl){
			string $vert[]=`polyListComponentConversion -fvf -tv $v`;
			string $vnum = match("[0-9]+",match("[0-9]+\]",$vert[0]));
			int $conv = $vnum;
			$write += $conv + " ";
		}
		$write += "</tri>\n";
	}	
	$write += "\t</triangle_set>\n";
	$write += "\t</embedded>\n";
	$write += "</mesh>";
	}
}

//Models
string $trans[] =`ls -s`;
for ($one in $trans) {
			string $shape[] = `listRelatives -shapes $one`;
			if (`objectType $one` == "mesh"){
			$write += "\n\n<model>\n\t<pos>0 0 0</pos>";
		$write += "\n\t<scale>1</scale>";
		$write += "\n\t<rotation><matrix>1 0 0 0 1 0 0 0 1</matrix></rotation>";
		$write += "\n\t<mesh_name>"+$one +"</mesh_name>\n</model>";
	}
}
$write += "\n</scene>";
print($write);
if (`window -exists indOut`) deleteUI indOut;
window -title "Output for Indigo Renderer" indOut;
windowPref -wh 500 600 indOut;
rowLayout -h 600;
scrollField -w 480 -h 560 -editable false -tx $write;
showWindow indOut;
Thanks to Arneoog for fixing a fatal bug!!!!

Not perfect- I wrote it last night and this morning.

I have plans for a UI and some more interesting lighting (sun and meshlight)

Please test it!!!! Use with Indigo 0.5.3 or 0.5.4- get it from here: https://www.flipcode.dxbug.com/board.php?topic=441

please test my Maya exporter!!!!!


Live the life you love, love the life you live

Last edited by MattTheMan; 27-05-2006 at 05:24 PM.
# 126 27-05-2006 , 07:14 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
I rendered a HUGE image just to test how far my computer can go. I am afraid to make an image any bigger, my computer was already going slooooooooow.

I rendered at 5000x3333 size. Reached 0.75 mutations per pixel in 30 mins. Average 7500 mutations per second.

Obviously- 1000 GI bounces isn't enough. Neither is 100 for maximum number of consecutive rejections in the MLT algorithm.

Here is one at 10% size:

user added image

Lol, origional PNG file was 45.2 MB user added image And I might have crashed Photoshop trying to save it for web user added image

Please excuse all of the JPeg compression- you try cramming an image that is 5000x3333 into 1024 KB

Here it is: 0.99 MB (PNG was 45.2 MB)

user added image


Live the life you love, love the life you live
# 127 05-06-2006 , 11:18 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
if anyone is interested- look in the MEL scripts and programming section to find an update for my Maya->Indigo script. It now supports meshlights! user added image


Live the life you love, love the life you live
# 128 06-06-2006 , 10:15 PM
13th_resident's Avatar
Subscriber
Join Date: Feb 2006
Location: London
Posts: 703
wow matt your simply a GENIUS.
maybe prodigy will suit you better. :eeek2: user added image user added image user added image


A pint of example is worth a gallon of advice!!
# 129 07-06-2006 , 08:42 PM
gster123's Avatar
Moderator
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
Matt aparantly theres a demo version of Maxwell V1.0 available, the links on CG talk but I closed it before I copied it into this post.

Sorry dude.

# 130 07-06-2006 , 09:40 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Yeah, I found it, it's alright, I'm downloading it now user added image

Thanks anyway
-Mattuser added image


Live the life you love, love the life you live
# 131 07-06-2006 , 09:44 PM
gster123's Avatar
Moderator
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
Ha ha, nice one mate!!

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads