<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for fusedworks.com</title>
	<atom:link href="http://www.fusedworks.com/comments/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fusedworks.com</link>
	<description>interactive, immersive and internet 3d design studio</description>
	<lastBuildDate>Tue, 24 Aug 2010 07:59:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Flash Webcam into Unity 3D by Jon</title>
		<link>http://www.fusedworks.com/blog/development/688/comment-page-1#comment-153</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Tue, 24 Aug 2010 07:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=688#comment-153</guid>
		<description>Although I have carried out further experimentation, at higher resolutions and with splitting data over many sockets as opposed to one, the best results still seem to come from the example shown, although I have further tests to do and scripts to ammend including a flash control script this is still ongoing in my spare time.

Both flash SWF and Unity3d objects must be loaded in browser on webpage or (possibly both pages active at same time, this I haven&#039;t tried)

The described process below is ideal for taking a snapshot of image data from flash and sending it to unity, currently this works best at sending 160x120 pixels RGBA which is very low res, but probably ok for motion tracking and some AR techniques in terms of speed, even for simple facial texture mapping for game characters, but there is no reason this couldn&#039;t be scaled, however as it is web-based it is important to consider the speed of users machines.

The Current Working ActionScript code looks something like (pseudo-code):

SetupCamera, Bitmap (320x240)
Set up socket (localhost,port 8080)
Set up Connect timer,started
Set up SendData Timer,stopped
Connect Timer Function {Connect}
On Connect Init Listener{Send Data Timer Start, Stop Connect Timer}
On Close Connect Listener{Reset Timers, Re-Connect}
On Errors Listener{try..Catch then Close Connect(null) - Re-Connect}
Send Data Timer Function{if not connected connect, get Image from cam, scale using matrix (160x120), get bytes of bitmapdata, send data }

The current Unity.cs script looks like (pseudo-code):

Declare vars: texture2d,pixels color array, material, thread, TcpClient, is running bool, sent policy bool etc
Start: Set up thread function, Put pixel data to chosen material, thread function starter
LateUpdate: Copy any pixelsdata[] to texture, Update
Thread (see forums on thread scripts): {
      Try Setup 8080 listener, Try GetClient Get Stream, While !Pending Sleep else
      if (connected and data, haven&#039;t sent policy), send policy(see above), set policy sent bool true,
      if (connected and data, have sent policy), Read Bytes from stream (160x120x4) if complete process bytes to pixeldata
      Catch all errors, solve problems.
OnDisable: (important otherwise web-browser crash when leave site): Close Connection, Close Thread, Reset Vars
OnAppQuit: Close Connection, Close Thread, Reset Vars
 
Thats about as far as I can go for now, and this should have given enough information, including the posts above for coders to get this working, Hope this helps.

By the way, I stumbled across a cunning way to get the memory address of flash bitmap data, but due to sandboxing and security, no way of passing this to unity in webplayer plus its probably local memory adress so would require base address, if any devs have any ideas or indeed anyway of accessing the browser clipboard from unity or accesing unlocal memory address in webplayer, I would be keen to hear from you, although to my knowledge for security reasons I understand why this should not be possible.</description>
		<content:encoded><![CDATA[<p>Although I have carried out further experimentation, at higher resolutions and with splitting data over many sockets as opposed to one, the best results still seem to come from the example shown, although I have further tests to do and scripts to ammend including a flash control script this is still ongoing in my spare time.</p>
<p>Both flash SWF and Unity3d objects must be loaded in browser on webpage or (possibly both pages active at same time, this I haven&#8217;t tried)</p>
<p>The described process below is ideal for taking a snapshot of image data from flash and sending it to unity, currently this works best at sending 160&#215;120 pixels RGBA which is very low res, but probably ok for motion tracking and some AR techniques in terms of speed, even for simple facial texture mapping for game characters, but there is no reason this couldn&#8217;t be scaled, however as it is web-based it is important to consider the speed of users machines.</p>
<p>The Current Working ActionScript code looks something like (pseudo-code):</p>
<p>SetupCamera, Bitmap (320&#215;240)<br />
Set up socket (localhost,port 8080)<br />
Set up Connect timer,started<br />
Set up SendData Timer,stopped<br />
Connect Timer Function {Connect}<br />
On Connect Init Listener{Send Data Timer Start, Stop Connect Timer}<br />
On Close Connect Listener{Reset Timers, Re-Connect}<br />
On Errors Listener{try..Catch then Close Connect(null) &#8211; Re-Connect}<br />
Send Data Timer Function{if not connected connect, get Image from cam, scale using matrix (160&#215;120), get bytes of bitmapdata, send data }</p>
<p>The current Unity.cs script looks like (pseudo-code):</p>
<p>Declare vars: texture2d,pixels color array, material, thread, TcpClient, is running bool, sent policy bool etc<br />
Start: Set up thread function, Put pixel data to chosen material, thread function starter<br />
LateUpdate: Copy any pixelsdata[] to texture, Update<br />
Thread (see forums on thread scripts): {<br />
      Try Setup 8080 listener, Try GetClient Get Stream, While !Pending Sleep else<br />
      if (connected and data, haven&#8217;t sent policy), send policy(see above), set policy sent bool true,<br />
      if (connected and data, have sent policy), Read Bytes from stream (160&#215;120x4) if complete process bytes to pixeldata<br />
      Catch all errors, solve problems.<br />
OnDisable: (important otherwise web-browser crash when leave site): Close Connection, Close Thread, Reset Vars<br />
OnAppQuit: Close Connection, Close Thread, Reset Vars</p>
<p>Thats about as far as I can go for now, and this should have given enough information, including the posts above for coders to get this working, Hope this helps.</p>
<p>By the way, I stumbled across a cunning way to get the memory address of flash bitmap data, but due to sandboxing and security, no way of passing this to unity in webplayer plus its probably local memory adress so would require base address, if any devs have any ideas or indeed anyway of accessing the browser clipboard from unity or accesing unlocal memory address in webplayer, I would be keen to hear from you, although to my knowledge for security reasons I understand why this should not be possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Flash Webcam into Unity 3D by robinamasio</title>
		<link>http://www.fusedworks.com/blog/development/688/comment-page-1#comment-152</link>
		<dc:creator>robinamasio</dc:creator>
		<pubDate>Tue, 24 Aug 2010 02:34:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=688#comment-152</guid>
		<description>Hello Jon, 

Well done!

I&#039;m trying very hard to understand what&#039;s going on here.  Could you point me in the right direction as you offered to Daniel above?  Any help would be hugely appreciated!

Many thanks in advance,

-r</description>
		<content:encoded><![CDATA[<p>Hello Jon, </p>
<p>Well done!</p>
<p>I&#8217;m trying very hard to understand what&#8217;s going on here.  Could you point me in the right direction as you offered to Daniel above?  Any help would be hugely appreciated!</p>
<p>Many thanks in advance,</p>
<p>-r</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Unity3d Terrain/Water Procedural Mesh by Joe Hamilton</title>
		<link>http://www.fusedworks.com/blog/tutorial/unity3d-tutorial-blog/procedural/257/comment-page-1#comment-138</link>
		<dc:creator>Joe Hamilton</dc:creator>
		<pubDate>Tue, 10 Aug 2010 08:04:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=257#comment-138</guid>
		<description>Ah.. Sorry.
I opened it in a new project and the errors stopped!
Thanks again. Great script.</description>
		<content:encoded><![CDATA[<p>Ah.. Sorry.<br />
I opened it in a new project and the errors stopped!<br />
Thanks again. Great script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Unity3d Terrain/Water Procedural Mesh by Joe Hamilton</title>
		<link>http://www.fusedworks.com/blog/tutorial/unity3d-tutorial-blog/procedural/257/comment-page-1#comment-137</link>
		<dc:creator>Joe Hamilton</dc:creator>
		<pubDate>Tue, 10 Aug 2010 07:43:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=257#comment-137</guid>
		<description>This is great!

It is working but I keep getting lots of errors in the console.

&quot;Assets/DynamicTerrain.js(26,25): BCE0044: expecting an identifier, found &#039;?&#039;.&quot; etc

Any idea why this is happening.

Thanks!</description>
		<content:encoded><![CDATA[<p>This is great!</p>
<p>It is working but I keep getting lots of errors in the console.</p>
<p>&#8220;Assets/DynamicTerrain.js(26,25): BCE0044: expecting an identifier, found &#8216;?&#8217;.&#8221; etc</p>
<p>Any idea why this is happening.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Unity3d Terrain/Water Procedural Mesh by Jon</title>
		<link>http://www.fusedworks.com/blog/tutorial/unity3d-tutorial-blog/procedural/257/comment-page-1#comment-128</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Tue, 03 Aug 2010 11:44:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=257#comment-128</guid>
		<description>Hi Mojo,

Sorry for the wait, we had a few problems to solve here at FusedWorks HQ... In your project view you must have a folder named Plugins, with the Perlin.cs file placed in it, then you must also have an empty gameobject without a mesh attached ie: remove the plane mesh component, then just attach the script above to the empty gameobject, the mesh for the game object and mesh renderer are created for the gameobject automatically in the script: - 

gameObject.AddComponent(MeshFilter);
gameObject.AddComponent(“MeshRenderer”);

There may also be a possibility, if this isn&#039;t working that the Perlin.cs script isn&#039;t working due to having an Indie License and it not supporting plug-ins, in which case you need to take the above code, convert it into C# and add it to the Perlin CS script, then attach that new script to your GameObject (which is a little trickier depending on your coding knowledge), hope this helps and let us know how you get on! 

PS:- you could download the package file above where it reads (downloaded here) and import it into you project, I think I put a prefab gameobject in there which you can just drag to stage once imported.</description>
		<content:encoded><![CDATA[<p>Hi Mojo,</p>
<p>Sorry for the wait, we had a few problems to solve here at FusedWorks HQ&#8230; In your project view you must have a folder named Plugins, with the Perlin.cs file placed in it, then you must also have an empty gameobject without a mesh attached ie: remove the plane mesh component, then just attach the script above to the empty gameobject, the mesh for the game object and mesh renderer are created for the gameobject automatically in the script: &#8211; </p>
<p>gameObject.AddComponent(MeshFilter);<br />
gameObject.AddComponent(“MeshRenderer”);</p>
<p>There may also be a possibility, if this isn&#8217;t working that the Perlin.cs script isn&#8217;t working due to having an Indie License and it not supporting plug-ins, in which case you need to take the above code, convert it into C# and add it to the Perlin CS script, then attach that new script to your GameObject (which is a little trickier depending on your coding knowledge), hope this helps and let us know how you get on! </p>
<p>PS:- you could download the package file above where it reads (downloaded here) and import it into you project, I think I put a prefab gameobject in there which you can just drag to stage once imported.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Unity3d Terrain/Water Procedural Mesh by mojo</title>
		<link>http://www.fusedworks.com/blog/tutorial/unity3d-tutorial-blog/procedural/257/comment-page-1#comment-121</link>
		<dc:creator>mojo</dc:creator>
		<pubDate>Fri, 30 Jul 2010 14:16:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=257#comment-121</guid>
		<description>I continually get errors a line 78 and 94 claiming the commas are unexpected.  Any idea what&#039;s going on?  All I did was attach this script to plane.</description>
		<content:encoded><![CDATA[<p>I continually get errors a line 78 and 94 claiming the commas are unexpected.  Any idea what&#8217;s going on?  All I did was attach this script to plane.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Flash Webcam into Unity 3D by Greg Dunn</title>
		<link>http://www.fusedworks.com/blog/development/688/comment-page-1#comment-109</link>
		<dc:creator>Greg Dunn</dc:creator>
		<pubDate>Sat, 24 Jul 2010 16:14:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=688#comment-109</guid>
		<description>This is a pretty brilliant idea... I&#039;ve done a lot of AR and would love to marry Unity&#039;s capabilities with that.  Flash is so limited it&#039;s painful.  I definitely need to look into this more.  Thanks for sharing some ideas and techniques.</description>
		<content:encoded><![CDATA[<p>This is a pretty brilliant idea&#8230; I&#8217;ve done a lot of AR and would love to marry Unity&#8217;s capabilities with that.  Flash is so limited it&#8217;s painful.  I definitely need to look into this more.  Thanks for sharing some ideas and techniques.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Flash Webcam into Unity 3D by Jon</title>
		<link>http://www.fusedworks.com/blog/development/688/comment-page-1#comment-99</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Thu, 15 Jul 2010 12:31:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=688#comment-99</guid>
		<description>On this version, no compression is included JPG/PNG encode it tended to slow things down. The image transmitted is unfortunatly low-resolution currently in byte format, and I haven&#039;t tried pushing up the resolution yet due to other work commitments. If higher resolutions fail performance speed some kind of vector math based compression could be utilised, this works quickly in as3, and some of the routines I wish to push into the AS3 class such as background removal, motion detection and OpenSURF may take away some of the needs of transmitting all colour image data. 

This all remains to be seen although one thing I am sure of, is that when I release the first draft i&#039;m hoping the community will overhaul and help with optimisation. What would the feelings be on setting up a SVN Depository with GoogleCode in the near future?</description>
		<content:encoded><![CDATA[<p>On this version, no compression is included JPG/PNG encode it tended to slow things down. The image transmitted is unfortunatly low-resolution currently in byte format, and I haven&#8217;t tried pushing up the resolution yet due to other work commitments. If higher resolutions fail performance speed some kind of vector math based compression could be utilised, this works quickly in as3, and some of the routines I wish to push into the AS3 class such as background removal, motion detection and OpenSURF may take away some of the needs of transmitting all colour image data. </p>
<p>This all remains to be seen although one thing I am sure of, is that when I release the first draft i&#8217;m hoping the community will overhaul and help with optimisation. What would the feelings be on setting up a SVN Depository with GoogleCode in the near future?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Flash Webcam into Unity 3D by c0dem4gnetic</title>
		<link>http://www.fusedworks.com/blog/development/688/comment-page-1#comment-98</link>
		<dc:creator>c0dem4gnetic</dc:creator>
		<pubDate>Thu, 15 Jul 2010 12:08:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=688#comment-98</guid>
		<description>You did not mention anything about compression soo.. afaik you get raw bitmap data from the webcam. Before you send it over the socket, compress the data using something &quot;fast&quot; (perhaps run-length encoding?) as3corelib (http://code.google.com/p/as3corelib/) includes jpeg and png encoders, but i think it might be slower than sending compressed raw data since there is also the overhead of decoding.

Very interesting, I look forward to seeing Unity being used for AR! :)</description>
		<content:encoded><![CDATA[<p>You did not mention anything about compression soo.. afaik you get raw bitmap data from the webcam. Before you send it over the socket, compress the data using something &#8220;fast&#8221; (perhaps run-length encoding?) as3corelib (<a href="http://code.google.com/p/as3corelib/" rel="nofollow">http://code.google.com/p/as3corelib/</a>) includes jpeg and png encoders, but i think it might be slower than sending compressed raw data since there is also the overhead of decoding.</p>
<p>Very interesting, I look forward to seeing Unity being used for AR! <img src='http://www.fusedworks.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Flash Webcam into Unity 3D by Patrick Hogenboom</title>
		<link>http://www.fusedworks.com/blog/development/688/comment-page-1#comment-96</link>
		<dc:creator>Patrick Hogenboom</dc:creator>
		<pubDate>Wed, 14 Jul 2010 13:48:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusedworks.com/?p=688#comment-96</guid>
		<description>Thanks for the info.
I must say that my video transfer/augmented reality project is on the backburner at the moment.
But I&#039;ll give you a shout when I make progress again.</description>
		<content:encoded><![CDATA[<p>Thanks for the info.<br />
I must say that my video transfer/augmented reality project is on the backburner at the moment.<br />
But I&#8217;ll give you a shout when I make progress again.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
