Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 61 11-06-2006 , 01:32 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Oh- you have to triangulate every single polyon mesh and delete ALL history before you run the script. NOW it should work user added image


Live the life you love, love the life you live
# 62 11-06-2006 , 02:09 PM
Registered User
Join Date: Aug 2005
Posts: 80
Ok, first time I didn't triangluate all mesh and got an error msg saying the same thing I posted earlier..."mesh tried to use 'phong1' material which has not be defined". Now, second time I triangulated all mesh and error msg appears again.

It seems that the exporter does not recognize about phongs? Anything else to be fixed?

I will try with a blinn material to see if it works or not.

Btw, are you serious it takes a day to export? That's a killer. I tried to export a big file and left it overnight and was still exporting this morning. Does it matters what spec your comp has to increase the process faster?

# 63 11-06-2006 , 02:20 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Well, you have to delete ALL history first. And yes it recognizes phong, it doesn't recognize blinn. Arneoog is working on using Indigo Diffuse, Indigo Phong, Indigo Specular... etc... instead of Maya materials.

And- leave it overnight and it still didn't work- it crashed user added image

I'm doing some research on how to make the MEL into C++, that would be waaaay faster.

-Matt


Live the life you love, love the life you live
# 64 11-06-2006 , 02:46 PM
Registered User
Join Date: Aug 2005
Posts: 80
Ok, just finished exporting and tested it out. And Nope, did not work...same msg again. I did delete all histories, does this mean I also need to delete history on light and camera too..lol?

There's something about the materials that bugging indigo not to render. Maybe I need to change something in "inifile" or materials?

# 65 11-06-2006 , 02:48 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
hmmm... can you post the .xml file?


Live the life you love, love the life you live
# 66 11-06-2006 , 03:02 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
i got it. Delete the material with incandescense- and then create another one (so that it comes at the end of the list of materials).

Then try it.

-Matt


Live the life you love, love the life you live
# 67 11-06-2006 , 03:13 PM
Registered User
Join Date: Aug 2005
Posts: 80
Does this matter...the incandescense is in lambert, so lambert goes first then phong is last?

Rendering as we speak.

# 68 11-06-2006 , 03:19 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
no, its just the numerical order that Maya uses. Not lambert first, phong last, just the order in which you create the materials. For some reason, there is a bug that breaks the material writing loop if it finds an incandescent material. I'm working on fixing it now.


Live the life you love, love the life you live
# 69 11-06-2006 , 03:23 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
hmmm... well I can't open it... I have Maya 6.5.

But- try this- turn all of your material's incandescense values to zero, and use skylight or physical sky. If that doesn't work, assign all materials to Lambert1- no incandescense, then use skylight or physical sky. If that works, then reassign the materials, phongs, whatever and THE LAST THING YOU DO would be to assign a material with incandescense to the meshlights.

Delete ALL history and run the script. (edit->history->delete all history)

-Matt


Live the life you love, love the life you live
# 70 11-06-2006 , 03:24 PM
Registered User
Join Date: Aug 2005
Posts: 80
Let's hope it works. :bow:

I'm using 7.0

# 71 11-06-2006 , 03:44 PM
Registered User
Join Date: Aug 2005
Posts: 80
Ok, it works w/out the incandescense. Now I'm trying with reassigning materials but incandescense last. Question about the light setup, once I create a point light do I need to modify it like turn on raytrace shadows, play with intensity, etc or you already modified it by having skylight or physical light?

# 72 11-06-2006 , 04:00 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Yeah. if you do use physical sky, don't modify it. If you do, nothing's gonna happen. But you have to realize that Maya lights won't do anything in Indigo. Indigo is physically correct, so only objects with surface area can be lights.


Live the life you love, love the life you live
# 73 11-06-2006 , 05:26 PM
Registered User
Join Date: Aug 2005
Posts: 80
Ok, went on few things here. Incandescense doesn't work for me, I'm still getting the msg. So I just rendered w/out the incandenscese and indigo file renders at 800x600 and maya render is at 640x480 so when the image finished, it cuts the image half, not whole size. Do I put the same settings in inifile as in maya?

I will post the pic.

# 74 11-06-2006 , 05:30 PM
Registered User
Join Date: Aug 2005
Posts: 80
Here's the render.

Attached Thumbnails
# 75 11-06-2006 , 05:54 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
Well, I fixed the meshlight thing. Turns out I was breaking a loop instead of an if statement user added image

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";


global 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;
}
if (`window -exists In`) deleteUI In;
window -title "Maya->Indigo Settings" In;
	windowPref -wh 300 100 In;
	columnLayout ColumnLayout;
	frameLayout -labelVisible false  -marginWidth 5 -marginHeight 5;
		columnLayout;
			text -label "Render Settings";
			rowLayout -numberOfColumns 3;
	string $physical = `button -label "Physical Sky"`;
	string $sky = `button -label "Skylight"`;
	string $none = `button -label "None"`;
	button -edit -command ("output physical") $physical;
button -edit -command ("output skylight") $sky;
button -edit -command ("output none") $none;
showWindow In;
global proc output(string $selected){		
string $write;
print $selected;
$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>false</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";
if ($selected == "skylight"){
$write += "<background>\n<radiance>1 1 1</radiance>\n</background>\n\n";
}
if ($selected == "physical"){
float $x = `getAttr pointLight1.tx`;
float $y = `getAttr pointLight1.ty`;
float $z = `getAttr pointLight1.tz`;
vector $sun = <<$x, $y, $z>>;
$sun = normalize($sun);
$write += "\n<skylight>\n\t<sundir>"+$sun.x+" "+$sun.y+" "+$sun.z+"</sundir>\n\t<turbidity>2.0</turbidity>\n\t<sky_gain>0.02</sky_gain>\n</skylight>\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){
float $inc[]=`getAttr ($one + ".incandescence")`;
		if ($inc[0]+$inc[1]+$inc[2] == 0.0){
	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`;
		$normal[0] = -$normal[0];
		$normal[1] = -$normal[1];
		$normal[2] = -$normal[2];
		$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) {
	if (`objectType $one` == "mesh"){	
		string $sg[] = `listConnections -t shadingEngine $one`;
		if ($sg[0] == "initialShadingGroup"){
			$sg[0] = "lambert1";	
		}
		string $amat[] = `listConnections $sg[0]`;
		if ($amat[2] == "renderPartition"){
			$amat[2] = $amat[3];
		}
		if ($amat[2] == "defaultShaderList1"){
			$amat[2] = "lambert1";
		}		
		float $inc[] = `getAttr ($amat[2]+".incandescence")`;
		print($one + "/:con " + $amat[2]+"\n");
		if ($inc[1]+$inc[2]+$inc[0] ==0){
		$write += "\n\n<model>\n\t<pos>0 0 0</pos>";
		$write += "\n\t<scale>1</scale>";
		$write += "\n\t<normal_smoothing>false</normal_smoothing>";
		$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>";
		}
		if ($inc[1]+$inc[2]+$inc[0] >0){
		$write += "\n<meshlight>\n";
		$write += "\t<pos>0 0 0</pos>\n";
		$write += "\t<scale>1</scale>\n";
		$write += "\t<rotation>\n";	
		$write += "\t\t<matrix>1 0 0 0 1 0 0 0 1</matrix>\n";
		$write += "\t</rotation>\n";
		$write += "\t<mesh_name>"+$one+"</mesh_name>\n";
		$write += "\t<spectrum>\n";
		float $rgb[3];
		$rgb[0] = 256*$inc[0]*5;
		$rgb[1] = 256*$inc[1]*5;
		$rgb[2] = 256*$inc[2]*5;
		$write += "\t<rgb>\n";
		$write += "\t\t<rgb>"+$rgb[0]+" "+$rgb[1]+" "+$rgb[2]+"</rgb>\n";
		$write += "\t</rgb>\n";
		$write += "\t</spectrum>\n";
		$write += "</meshlight>\n";
		}
	}
}
$write += "\n</scene>";
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;

}


Live the life you love, love the life you live
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