<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>publicreative lab &#187; 3dsMax</title>
	<atom:link href="http://lab.publicreative.com/tag/3dsmax/feed/" rel="self" type="application/rss+xml" />
	<link>http://lab.publicreative.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jul 2010 15:59:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>3dsMax Texture Baking and Papervision</title>
		<link>http://lab.publicreative.com/2009/01/3dsmax-texture-baking-and-papervision/</link>
		<comments>http://lab.publicreative.com/2009/01/3dsmax-texture-baking-and-papervision/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 19:01:32 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[3dsMax]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Papervision]]></category>

		<guid isPermaLink="false">http://lab.publicreative.com/?p=64</guid>
		<description><![CDATA[<script type="text/javascript" src="http://lab.publicreative.com/wp-includes/js/jquery/jquery.js"></script><script type="text/javascript" src="http://lab.publicreative.com/wp-content/plugins/pb-embedflash/js/sbadapter/shadowbox-jquery.js"></script><script type="text/javascript" src="http://lab.publicreative.com/wp-content/plugins/pb-embedflash/js/shadowbox.js"></script><script type="text/javascript"><!--
window.onload = function() {var options ={assetURL:'',loadingImage:'http://lab.publicreative.com/wp-content/plugins/pb-embedflash/css/images/loading.gif',flvPlayer:'http://lab.publicreative.com/wp-content/plugins/pb-embedflash/swf/mediaplayer.swf',animate:true,animSequence:'wh',overlayColor:'#000',overlayOpacity:0.9,overlayBgImage:'http://lab.publicreative.com/wp-content/plugins/pb-embedflash/css/images/overlay-85.png',listenOverlay:true,autoplayMovies:true,showMovieControls:true,resizeDuration:0.35,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:'default',viewportPadding:20,handleLgImages:'resize',initialHeight:160,initialWidth:320,enableKeys:true,keysClose:['c', 'q', 27],keysPrev:['p', 37],keysNext:['n', 39],handleUnsupported:'',text: {cancel:'Cancel',loading: 'loading',close:'<span class="shortcut">C</span>lose',next:'<span class="shortcut">N</span>ext',prev:'<span class="shortcut">P</span>revious',errors:{single: 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',shared: 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',either: 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'}}};Shadowbox.init(options);}
--></script>3d is really exciting us at the moment. Papervision is great but so far we’ve only used primitive shapes within Papervision to do all our work. Chris, our newest arrival in the Public development pit has been amazing us with his 3dsMax skills and of course prompted us to get up with the play and [...]]]></description>
			<content:encoded><![CDATA[<p>3d is really exciting us at the moment. Papervision is great but so far we’ve only used primitive shapes within Papervision to do all our work. Chris, our newest arrival in the Public development pit has been amazing us with his 3dsMax skills and of course prompted us to get up with the play and start exporting from Max into flash.</p>
<p>It’s also prompted me, having no 3dsMax experience but plenty of Papervision experience to start having a play. After many hours at work and home coming up to speed with the basics of modelling, lightning and materials and learning how to texture bake and deal with UV maps I think I’ve got a handle on what this is all about.</p>
<p>Here’s the first test. Nothing amazing but the speakers are fully UVW unwrapped in 3dsMax and the textures are baked on.</p>
<p>Next up will be testing animation exported from 3dsMax and some more detailed modeling.</p>
<p><strong>Click image to open:</strong></p>
<p><small>(Please open the article to see the flash file or player.)</small></p>
<p><span id="more-64"></span><br />
<strong>Here is the source:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3 actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> com.publicreative.<span style="color: #004993;">graphics</span>.BackgroundGradient;
	<span style="color: #0033ff; font-weight: bold;">import</span> com.publicreative.pv.interaction.MouseGrab;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.objects.parsers.DAE;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<span style="color: #004993;">ByteArray</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.materials.BitmapFileMaterial;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.materials.ColorMaterial;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.materials.utils.MaterialsList;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.objects.primitives.Cube;
	<span style="color: #0033ff; font-weight: bold;">import</span> org.papervision3d.view.BasicView;
&nbsp;
	<span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span> = <span style="color: #990000;">&quot;600&quot;</span>, <span style="color: #004993;">height</span> = <span style="color: #990000;">&quot;450&quot;</span>, <span style="color: #004993;">backgroundColor</span> = <span style="color: #990000;">&quot;#000000&quot;</span>, <span style="color: #004993;">frameRate</span> = <span style="color: #990000;">&quot;60&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> BakedStage extends BasicView
	<span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;speakers.DAE&quot;</span>, mimeType = <span style="color: #990000;">&quot;application/octet-stream&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> SpeakerDAE<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Class</span>; 
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dae<span style="color: #000000; font-weight: bold;">:</span>DAE;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _stage<span style="color: #000000; font-weight: bold;">:</span>Cube;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _grab<span style="color: #000000; font-weight: bold;">:</span>MouseGrab;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> const DISTANCE<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">1200</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> BakedStage<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span>.<span style="color: #004993;">stageWidth</span> , <span style="color: #004993;">stage</span>.<span style="color: #004993;">stageHeight</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">addChildAt</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> BackgroundGradient<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,0<span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> byteArray<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">ByteArray</span> = <span style="color: #0033ff; font-weight: bold;">new</span> SpeakerDAE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">ByteArray</span>;
&nbsp;
			 _dae = <span style="color: #0033ff; font-weight: bold;">new</span> DAE<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> ml<span style="color: #000000; font-weight: bold;">:</span>MaterialsList = <span style="color: #0033ff; font-weight: bold;">new</span> MaterialsList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			ml.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SpeakerImageMap.png&quot;</span>,<span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span> , <span style="color: #990000;">&quot;SpeakerImageMap.png&quot;</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #009900;">//Speakers are texture baked round dae file.</span>
			_dae.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span> byteArray , ml<span style="color: #000000;">&#41;</span>;
			_dae.<span style="color: #004993;">scale</span> = <span style="color: #000000; font-weight:bold;">3.5</span>;
			_dae.useOwnContainer = <span style="color: #0033ff; font-weight: bold;">true</span>;
			_dae.rotationY = <span style="color: #000000; font-weight:bold;">180</span>;
			scene.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span> _dae <span style="color: #000000;">&#41;</span>; 
&nbsp;
			<span style="color: #009900;">//Stage is done in traditional way using a skinned cube.</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> stageML<span style="color: #000000; font-weight: bold;">:</span>MaterialsList = <span style="color: #0033ff; font-weight: bold;">new</span> MaterialsList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			stageML.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;floorFront.jpg&quot;</span><span style="color: #000000;">&#41;</span> , <span style="color: #990000;">&quot;back&quot;</span><span style="color: #000000;">&#41;</span>;
			stageML.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;floorSide.jpg&quot;</span><span style="color: #000000;">&#41;</span> , <span style="color: #990000;">&quot;left&quot;</span><span style="color: #000000;">&#41;</span>;
			stageML.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;floorSide.jpg&quot;</span><span style="color: #000000;">&#41;</span> , <span style="color: #990000;">&quot;right&quot;</span><span style="color: #000000;">&#41;</span>;
			stageML.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> BitmapFileMaterial<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;floorTop.jpg&quot;</span><span style="color: #000000;">&#41;</span> , <span style="color: #990000;">&quot;top&quot;</span><span style="color: #000000;">&#41;</span>;
			stageML.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> ColorMaterial<span style="color: #000000;">&#40;</span>0x111111<span style="color: #000000;">&#41;</span> , <span style="color: #990000;">&quot;bottom&quot;</span><span style="color: #000000;">&#41;</span>;
			stageML.addMaterial<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> ColorMaterial<span style="color: #000000;">&#40;</span>0x111111<span style="color: #000000;">&#41;</span>, <span style="color: #990000;">&quot;front&quot;</span><span style="color: #000000;">&#41;</span>;  
&nbsp;
			stageML.getMaterialByName<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;top&quot;</span><span style="color: #000000;">&#41;</span>.smooth = <span style="color: #0033ff; font-weight: bold;">true</span>;
&nbsp;
			_stage = <span style="color: #0033ff; font-weight: bold;">new</span> Cube<span style="color: #000000;">&#40;</span> stageML , <span style="color: #000000; font-weight:bold;">484</span> , <span style="color: #000000; font-weight:bold;">484</span> , <span style="color: #000000; font-weight:bold;">16</span>, <span style="color: #000000; font-weight:bold;">4</span> , <span style="color: #000000; font-weight:bold;">1</span> , <span style="color: #000000; font-weight:bold;">4</span><span style="color: #000000;">&#41;</span>;
			_stage.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">8</span>;
			scene.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span> _stage <span style="color: #000000;">&#41;</span>;
&nbsp;
			camera.<span style="color: #004993;">zoom</span> = <span style="color: #000000; font-weight:bold;">100</span>;
			camera.z = <span style="color: #000000; font-weight: bold;">-</span>DISTANCE;
&nbsp;
			_grab = <span style="color: #0033ff; font-weight: bold;">new</span> MouseGrab<span style="color: #000000;">&#40;</span>  camera , <span style="color: #004993;">stage</span> <span style="color: #000000;">&#41;</span>;
			_grab.addSingleAxis<span style="color: #000000;">&#40;</span> MouseGrab.<span style="color: #004993;">VERTICAL</span> , MouseGrab.Y , <span style="color: #000000; font-weight:bold;">1000</span> , <span style="color: #000000; font-weight:bold;">10</span> , <span style="color: #000000; font-weight:bold;">30</span> <span style="color: #000000;">&#41;</span>;
			_grab.addDoubleAxis<span style="color: #000000;">&#40;</span> MouseGrab.<span style="color: #004993;">HORIZONTAL</span> , MouseGrab.XZ, DISTANCE, <span style="color: #000000; font-weight:bold;">1000</span>, <span style="color: #000000; font-weight:bold;">10</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
			startRendering<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> onRenderTick<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span>=<span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			_grab.processFrame<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">super</span>.onRenderTick<span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Here is the MouseGrab class as a few people have requested. It&#8217;s far from my best work and pretty much untested so use at your own risk. <a href='http://lab.publicreative.com/wp-content/uploads/2009/01/mousegrab.as'>MouseGrab</a>. Things have been very busy here of late so sorry for the slow replies.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.publicreative.com/2009/01/3dsmax-texture-baking-and-papervision/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

