<?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>Unity playground</title>
	<atom:link href="http://ippomed.com/unity/feed/" rel="self" type="application/rss+xml" />
	<link>http://ippomed.com/unity</link>
	<description></description>
	<lastBuildDate>Fri, 02 Dec 2011 08:53:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Line in Unity 3d – Vectrosity 1.4 Tutorial 2 &#8211; A simple editor script for straight continuous lines</title>
		<link>http://ippomed.com/unity/line-in-unity-3d-%e2%80%93-vectrosity-1-4-tutorial-2-a-simple-editor-script-for-straight-continuous-lines/</link>
		<comments>http://ippomed.com/unity/line-in-unity-3d-%e2%80%93-vectrosity-1-4-tutorial-2-a-simple-editor-script-for-straight-continuous-lines/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 11:50:03 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=260</guid>
		<description><![CDATA[I made a simple editor script for Vectrosity 1.4. Its purpose is to allow users to draw straight continuous lines ( actually polylines, i.e continuous line segments ) in the scene view. Think of it as a primitive line editor. &#8230; <a href="http://ippomed.com/unity/line-in-unity-3d-%e2%80%93-vectrosity-1-4-tutorial-2-a-simple-editor-script-for-straight-continuous-lines/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I made a simple editor script for Vectrosity 1.4. Its purpose is to allow users to draw straight continuous lines ( actually polylines, i.e continuous line segments ) in the scene view. Think of it as a primitive line editor.<br />
It consists of two parts: The first part is the IppoLine1.js script that deals with line definition and update in runtime.</p>
<pre lang="javascript">// Add - Remove points in inspector
var linePoints:Vector3[];
// Proposed material : VectorLine
var myMat:Material;
var line : VectorLine;
function Start ()
{
	//Define the line, I found a width of 4.0 to be satisfacatory
	line = new VectorLine("Line", linePoints, myMat, 4.0, LineType.Continuous);
	// Draw the line
	Vector.DrawLine3DAuto(line, transform);
}

function Update()
{
	//This line forces the line to Update
	// and places it at (0,0,0) of local space of gameObject
	Vector.DrawLine3D(line, transform);
}</pre>
<p>The second script, CustomEditorIppoLine1.js deals with the manipulation of the line points in Scene view and drawing of a line in it.</p>
<pre lang="javascript">@CustomEditor( IppoLine1 )

class CustomEditorIppoLine1 extends Editor
{
	//Those Vector3 will define the points through which the line will pass in Scene view
	var positions : Vector3[];
	//This allows to do stuff in Scene view
	function OnSceneGUI()
	{
		Handles.color = Color.white;
		positions = new Vector3[target.linePoints.Length];
		var i :int =0;
		for(var item:Vector3 in target.linePoints )
		{
			// itemWorld is the position in world space of the FreeMoveHandle
			var itemWorld:Vector3 = Handles.FreeMoveHandle( target.transform.TransformPoint(item), Quaternion.identity, 0.2, Vector3.zero, Handles.RectangleCap);
			// move the linePoint[x] to the itemWorld position, translated in local space
			item = target.transform.InverseTransformPoint(itemWorld);
			Handles.DotCap(0, itemWorld, Quaternion.identity, 0.1);
			positions[i] = itemWorld;
			++i;
		}

		if (GUI.changed)
		{
			EditorUtility.SetDirty (target);
		}
		//Draw line in Scene view
		Handles.DrawAAPolyLine( 0.1, positions);
	}
}</pre>
<p>Usage: Create a new project. Add VectrosityDemos_Unity3.unitypackage in it.<br />
Create one folder called Editor and place CustomEditorIppoLine1.js in it. Add IppoLine1.js in your project too.<br />
Make a new scene, add a new GameObject, place it at 0,0,0, name it (say) Line1, add IppoLine1.js to it.<br />
Select the Line1 in the Hierarchy. In the Inspector, below the IppoLine1(script) select VectorLine as the Material.<br />
On the left of  LinePoints there is a small arrow. Click it. Set size to (say) 2. Set Element 0 x as -1 and Element 1 x as 1.<br />
Now you will notice that in the scene view 2 little squared appear on both sides of the game Object. Drag them around.<br />
Those define the begining and the end of the line. If you align the scene view with the camera view, what you see in the scene<br />
will be identical with what you will see in runtime.<br />
To add points, set size (as mentioned before) to 3 e.t.c. The trick is that the new points can be dragged out by selecting in the scene the last point or by setting manually their value in the Elements section.<br />
I hope you will find these scripts useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/line-in-unity-3d-%e2%80%93-vectrosity-1-4-tutorial-2-a-simple-editor-script-for-straight-continuous-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Line in Unity 3d &#8211; Vectrosity 1.4 Tutorial 1</title>
		<link>http://ippomed.com/unity/line-in-unity-3d-vectrosity-1-4-tutorial-1/</link>
		<comments>http://ippomed.com/unity/line-in-unity-3d-vectrosity-1-4-tutorial-1/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 18:59:08 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=257</guid>
		<description><![CDATA[Vectrosity 1.4 is out ! Congrats to all who bought it. It is a very solid packet. If you start with Vectrosity now, here is a small walkthrough with various tips and tricks. Start by importing VectrosityDemos_Unity3.unitypackage in an empty &#8230; <a href="http://ippomed.com/unity/line-in-unity-3d-vectrosity-1-4-tutorial-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Vectrosity 1.4 is out !<br />
Congrats to all who bought it. It is a very solid packet.<br />
If you start with Vectrosity now, here is a small walkthrough with various tips and tricks.<br />
Start by importing VectrosityDemos_Unity3.unitypackage in an empty project.<br />
In the Project view open the scene _Simple2DLine located in Vectrosity ->_Scenes.<br />
You see nothing in the scene editor and it is ok. In the Hierarchy view select Main Camera.<br />
In the Inspector view you will notice that besides the usual camera stuff there are 4 extra scripts, from which the one called Line is checked.<br />
Lets hit play&#8230; Ta-ta ! A beautiful line appears across the scene ! Wait&#8230; It is kinda jaggy. Where are those nice lines you expected ?<br />
Lets open the script. Pretty explanatory really.<br />
At line 8 it states &#8221;	// Make a VectorLine object using the above points and the default material, with a width of 2 pixels&#8221;<br />
Default material results in jaggy lines. Lets change this.<br />
We will use the following variant of VectorLine:<br />
VectorLine (name : String, points : Vector2[] or Vector3[],material : Material, lineWidth : float, lineType : LineType = LineType.Discrete, joins : Joins = Joins.None)<br />
It is documented in the Vectrosity Reference Guide.pdf that comes with Vectrosity. This variant allows as to add a material.<br />
Lets change the script to </p>
<pre lang="javascript">
var myMat:Material;
function Start () {
	// Make Vector2 array; in this case we just use 2 elements...
	var linePoints = [Vector2(0, Random.Range(0, Screen.height)),				// ...one on the left side of the screen somewhere
					  Vector2(Screen.width-1, Random.Range(0, Screen.height))];	// ...and one on the right

	// Changed null to myMat so we can choose a material in the inspector, width to 4.0 from 2.0.
	// Method signature: VectorLine (name : String, points : Vector2[] or Vector3[], material : Material, lineWidth : float, lineType : LineType = LineType.Discrete, joins : Joins = Joins.None)
	var line = new VectorLine("Line", linePoints, myMat, 4.0);

	// Draw the line
	Vector.DrawLine(line);
}
</pre>
<p>Now assign in the Inspector the material called VectorLine in the MyMat slot.<br />
Save scene, press play and you havea nice, anti-aliased line <img src='http://ippomed.com/unity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
If you like this kind of lines, make sure that you use the VectorLine material.</p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/line-in-unity-3d-vectrosity-1-4-tutorial-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GLSL shaders for Unity 3d &#8211; Simple Texture Transparent</title>
		<link>http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture-transparent/</link>
		<comments>http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture-transparent/#comments</comments>
		<pubDate>Mon, 30 May 2011 21:15:31 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=236</guid>
		<description><![CDATA[In this post we will make a shader that displays a transparent texture. There are also some reference links regarding rendering order and blending options in Unity 3d. If you tried to use the previous shader with a texture that &#8230; <a href="http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture-transparent/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this post we will make a shader that displays a transparent texture. There are also some reference links regarding rendering order and blending options in Unity 3d.<br />
If you tried to use the previous shader with a texture that is partially transparent, then you noticed that it does not show up correctly. Perhaps you also noticed that this also happens to the most built-in non Transparent shaders. You have to <span id="more-236"></span> specify to the GPU that you wish to take into account texture transparency, as well as how to blend the pixels that are transparent with the underlying pixels ( what is behind them in space ).</p>
<p>Well, to blend what is in front with what is in back you should have something in back to blend with <img src='http://ippomed.com/unity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It is necessary to schedule somehow the rendering so opaque objects are rendered first and transparent after (so they have what to blend with). <a href="http://unity3d.com/support/documentation/Components/SL-SubshaderTags.html" target="_blank">This page</a> discusses the rendering order and <a href="http://unity3d.com/support/documentation/Components/SL-Blend.html" target="_blank">this page</a> discusses the blending options. Building on the previous example, we will perform the following changes in the Subshader section of the code</p>
<pre lang="javascript">SubShader
{
        // This tells GPU how to blend the model with the rest
        //  of the scene, taking into account texture's
	Blend SrcAlpha OneMinusSrcAlpha
        // This tells GPU to render the shader after the opaque
        //  Geometry is drawn.
	Tags {"Queue" = "Transparent" }
	Pass
        {...}</pre>
<p>So the complete code of the shader will be :</p>
<form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="FJEUXYXUKDMDY" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p>&nbsp;</p>
<pre lang="javascript">
Shader "simple_Transparent_Shader"
{
	Properties
	{
	       // This allows to choose the texture from the Editor
	       _MainTex ("Base (RGB)", 2D) = "white" {}
	}
	SubShader
	{
		// This tells GPU how to blend the model with the rest
		//  of the scene, taking into account texture's
		Blend SrcAlpha OneMinusSrcAlpha
		// This tells GPU to render the shader after the opaque
		//  Geometry is drawn.
		Tags {"Queue" = "Transparent" }
		Pass
		{
		GLSLPROGRAM
		#ifdef VERTEX

		// varying is a special type of variable in glsl
		//  that lets you pass data from the Vertex to
		//  the Fragment shader
		varying vec2 the_uv;

		void main()
		{
		  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

		  // Access the first texture unit and retrieve the texture coordinates
		  // that correspond to the uv coordinates of the given vertice
		  the_uv = gl_MultiTexCoord0.st;
		}
		#endif

		#ifdef FRAGMENT
		// Receive texture data from Unity Editor
		uniform sampler2D _MainTex;

		// Receive data from the Vertex to
		//  the Fragment shader
		varying vec2 the_uv;

		void main()
		{
			// The pixel color will correspond
			//  to the uv coords of the texture
			//  for the given vertice, retrieved
			//  by the Vertex shader through varying vec2 the_uv

			gl_FragColor = texture2D(_MainTex, the_uv);
		}
		#endif
		ENDGLSL
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture-transparent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to access all children of a transform in Unity Script ( Javascript )</title>
		<link>http://ippomed.com/unity/how-to-access-all-children-of-a-transform-in-unity-script-javascript/</link>
		<comments>http://ippomed.com/unity/how-to-access-all-children-of-a-transform-in-unity-script-javascript/#comments</comments>
		<pubDate>Fri, 27 May 2011 15:14:57 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=225</guid>
		<description><![CDATA[Some things have changed in Unity 3.0, one of them is how to access the children of a gameObject. The Transform Component can have one or more children, but how can you access them ? The answer seems trivial. Look &#8230; <a href="http://ippomed.com/unity/how-to-access-all-children-of-a-transform-in-unity-script-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some things have changed in Unity 3.0, one of them is how to access the children of a gameObject. The Transform Component can have one or more children, but how can you access them ?</p>
<p><span id="more-225"></span></p>
<p>The answer seems trivial. Look it up in the docs, right <a href="http://unity3d.com/support/documentation/ScriptReference/Transform.html" target="_blank">here</a>. Only that it gives an error :</p>
<blockquote><p> BCE0022: Cannot convert &#8216;Object&#8217; to &#8216;UnityEngine.Transform&#8217;.</p></blockquote>
<p> After some search in the forums, in the Unity answers and #unity3d I found a solution (and spend 1 hour): I post it so you do not have to face the same frustration.</p>
<pre lang="javascript">
function Start()
{
	var myTrans:Transform[]  = gameObject.GetComponentsInChildren.<Transform>() as Transform[];

	for (var child : Transform in myTrans )
	{
		//Do your stuff
	}

}
</pre>
<p>The above code will give you back all the children of a gameObject, regardless their nesting level.<br />
Hope this helps <img src='http://ippomed.com/unity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/how-to-access-all-children-of-a-transform-in-unity-script-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GLSL shaders for Unity 3d &#8211; Simple Texture</title>
		<link>http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture/</link>
		<comments>http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture/#comments</comments>
		<pubDate>Thu, 26 May 2011 19:39:59 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=210</guid>
		<description><![CDATA[In this post we will make a shader that displays a texture. We will pass the texture information from the Unity Editor to the shader via shader properties and a special type of glsl variables, uniforms. The first thing to &#8230; <a href="http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this post we will make a shader that displays a texture. We will pass the texture information from the Unity Editor to the shader via shader properties and a special type of glsl variables, uniforms.<span id="more-210"></span></p>
<p>The first thing to do is to add an option to select a texture from Inspector view. To do so, we will modify the Properties code from the previous post. It will become</p>
<pre lang="javascript">Properties
{
       // This allows to choose the texture from the Editor
       _MainTex ("Base (RGB)", 2D) = "white" {}
}</pre>
<p>Ok,now if we select the shader in the inspector, we can choose a texture. The necessary info to display a texture is the texture itself and uv coordinates of each vertice. To inform the shader about the relation between texture coordinates and vertices uv we will change the Vertex shader code as follows :</p>
<pre lang="javascript">
#ifdef VERTEX

// varying is a special type of variable in glsl
//  that lets you pass data from the Vertex to
//  the Fragment shader
varying vec2 the_uv;

void main()
{
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

  // Access the first texture unit and retrieve the texture coordinates
  // that correspond to the uv coordinates of the given vertice
  the_uv = gl_MultiTexCoord0.st;
}
#endif
</pre>
<p>Now we should pass the texture and the texture coordinates to the Fragment shader. Modify the Fragmentshader as follows :</p>
<pre lang="javascript">
#ifdef FRAGMENT
// Receive texture data from Unity Editor
uniform sampler2D _MainTex;

// Receive data from the Vertex to
//  the Fragment shader
varying vec2 the_uv;

void main()
{
	// The pixel color will correspond
	//  to the uv coords of the texture
	//  for the given vertice, retrieved
	//  by the
	gl_FragColor = texture2D(_MainTex, the_uv);
}
#endif
</pre>
<p>So the complete code of the shader will be :<br />
<form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="FJEUXYXUKDMDY" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p>&nbsp;</p>
<pre lang="javascript">
Shader "simple_Texture_Shader"
{
	Properties
	{
	       // This allows to choose the texture from the Editor
	       _MainTex ("Base (RGB)", 2D) = "white" {}
	}
	SubShader
	{
		Tags { "Queue" = "Geometry" }
		Pass
		{
		GLSLPROGRAM
		#ifdef VERTEX

		// varying is a special type of variable in glsl
		//  that lets you pass data from the Vertex to
		//  the Fragment shader
		varying vec2 the_uv;

		void main()
		{
		  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

		  // Access the first texture unit and retrieve the texture coordinates
		  // that correspond to the uv coordinates of the given vertice
		  the_uv = gl_MultiTexCoord0.st;
		}
		#endif

		#ifdef FRAGMENT
		// Receive texture data from Unity Editor
		uniform sampler2D _MainTex;

		// Receive data from the Vertex to
		//  the Fragment shader
		varying vec2 the_uv;

		void main()
		{
			// The pixel color will correspond
			//  to the uv coords of the texture
			//  for the given vertice, retrieved
			//  by the Vertex shader through varying vec2 the_uv
			gl_FragColor = texture2D(_MainTex, the_uv);
		}
		#endif
		ENDGLSL
		}
	}
}
</pre>
<p>And that is all ! References from the first part still apply. </p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/glsl-shaders-for-unity-3d-simple-texture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GLSL shaders for Unity 3d &#8211; Flat color</title>
		<link>http://ippomed.com/unity/glsl-shaders-for-unity-3d-flat-color/</link>
		<comments>http://ippomed.com/unity/glsl-shaders-for-unity-3d-flat-color/#comments</comments>
		<pubDate>Wed, 25 May 2011 15:20:27 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=196</guid>
		<description><![CDATA[Suppose you wanna make a shader that displays any color instead of red only. You need to pass somehow this information from the Unity Editor to the shader. In this article we will use shader properties and a special type &#8230; <a href="http://ippomed.com/unity/glsl-shaders-for-unity-3d-flat-color/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Suppose you wanna make a shader that displays any color instead of red only. You need to pass somehow this information from the Unity Editor to the shader. In this article we will use shader properties and a special type of glsl variables, uniforms.<span id="more-196"></span></p>
<p>The first thing to do is to add an option to select a color from Inspector view. To do so, we will modify the Properties code from the previous post. It will become</p>
<pre lang="javascript">Properties
{
       // This allows to choose the color from the Editor
       _Color ("Main Color", Color) = (1,0.5,0.5,1)
}</pre>
<p>Ok,now if we select the shader in the inspector, we can choose a color. To pass this color in the shader we will change the fragment code as follows :</p>
<pre lang="javascript">
#ifdef FRAGMENT
	// This is a way to pass the data from the Unity Editor to the shader, via uniforms
	uniform vec4 _Color ;
	void main()
	{
	   gl_FragColor = _Color;
	}
#endif
</pre>
<p>So the complete code of the shader will be :</p>
<form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="FJEUXYXUKDMDY" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p>&nbsp;</p>
<pre lang="javascript">Shader "simple_Color_Shader"
{
	Properties
	{
	       // This allows to choose the color from the Editor
	       _Color ("Main Color", Color) = (1,0.5,0.5,1)
	}
	SubShader
	{
		Tags { "Queue" = "Geometry" }
		Pass
		{
		GLSLPROGRAM
		#ifdef VERTEX
			void main()
			{
			   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
			}
		#endif  

		#ifdef FRAGMENT
			// This is a way to pass the data from the Unity Editor to the shader, via uniforms
			uniform vec4 _Color ;
			void main()
			{
			   gl_FragColor = _Color;
			}
		#endif
		ENDGLSL
		}
	}
}</pre>
<p>And that is all ! References from the first part still apply.</p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/glsl-shaders-for-unity-3d-flat-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto write a GLSL ES 2.0 shader for Unity 3d</title>
		<link>http://ippomed.com/unity/howto-write-a-glsl-es-2-0-shader-for-unity-3d/</link>
		<comments>http://ippomed.com/unity/howto-write-a-glsl-es-2-0-shader-for-unity-3d/#comments</comments>
		<pubDate>Tue, 24 May 2011 16:16:52 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=191</guid>
		<description><![CDATA[GLSL shaders are useful for Mac, IOS, Android platforms. The documentation on how to write one that works with Unity 3d is minimal. In this post I will present a template for writing GLSL shaders for Unity 3d and some &#8230; <a href="http://ippomed.com/unity/howto-write-a-glsl-es-2-0-shader-for-unity-3d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>GLSL shaders are useful for Mac, IOS, Android platforms. The documentation on how to write one that works with Unity 3d is minimal. In this post I will present a template for writing GLSL shaders for Unity 3d and some aiding references.<span id="more-191"></span></p>
<p>There are two types of shaders that GLSL ES 2.0 supports : Vertex and Fragment. Other types ( e.g Geometry shaders ) are not supported. The Vertex shader might get some input (more on that later) and should output at least gl_Position. A minimum Vertex shader is</p>
<pre lang="javascript">
void main()
{
    // Each vertex position on screen ( window ) space ( = gl_Position ) is calculated
    //   by multiplying the vertex position in the World space ( = gl_Vertex )
    //   with the MVP matrix ( = gl_ModelViewProjectionMatrix ).
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
</pre>
<p>The Fragment shader might get some input and should output at least gl_FragColor. A minimum Fragment shader is</p>
<pre lang="javascript">
void main()
{
    // For every pixel on the screen that belongs to this object
    //   paint the pixel red.
    gl_FragColor = vec4 (1.0, 0.0, 0.0, 1.0);
}
</pre>
<p>To use the above shaders in a unity shader, the template is</p>
<form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="FJEUXYXUKDMDY" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<pre lang="javascript">
Shader "Shader name"
{
        Properties
        {
             //Fill any properties
        }
          SubShader
          {
                 Tags { "Queue" = "Geometry" }
                 Pass
                  {
                     GLSLPROGRAM
                     #ifdef VERTEX
                         // Add Vertex shader code here
                     #endif  

                     #ifdef FRAGMENT
                         // Add Fragment shader code here
                     #endif
                     ENDGLSL
                   }
           }
}
</pre>
<p>So a simple shader that displays the object in red is </p>
<pre lang="javascript">
Shader "simple_Red_Shader"
{
    Properties
    {        

    }
    SubShader
    {
        Tags { "Queue" = "Geometry" }
        Pass
            {
                GLSLPROGRAM
                #ifdef VERTEX
                void main()
                {
                   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
                }
                #endif  

                #ifdef FRAGMENT
                void main()
                {
                   gl_FragColor = vec4 (1.0, 0.0, 0.0, 1.0);
                }
                #endif
                ENDGLSL
            }
     }
}
</pre>
<p>In following posts, I &#8216;ll show how to create and access shader&#8217;s properties ( ie color, texture, etc ) from Unity Script and how to access Unity&#8217;s built-in values from UnityCG.glslinc.</p>
<p><a href="http://www.khronos.org/opengles/sdk/docs/man/">Reference</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/howto-write-a-glsl-es-2-0-shader-for-unity-3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to monetize a Unity 3d casual game &#8211; Kongregate</title>
		<link>http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-kongregate/</link>
		<comments>http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-kongregate/#comments</comments>
		<pubDate>Mon, 23 May 2011 18:52:19 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=181</guid>
		<description><![CDATA[Kongregate is a casual games portal that accepts Unity 3d games. It started accepting casual games made with Unity 3d in 2011. Many developers submitted their games in the Unity Game Contest  back in Feb 2011. So what is the &#8230; <a href="http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-kongregate/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Kongregate is a casual games portal that accepts Unity 3d games. It started accepting casual games made with Unity 3d in 2011. Many developers submitted their games in the Unity Game Contest  back in Feb 2011. So what is the deal with Kong ?<span id="more-181"></span>Kongregate shares with developers a percentage of the ads clicked when someone plays their game. You get 25% of ads revenue. If you use the Kongegate API and your game has 50 highscores, you earn +10% aka 35% of ads revenue. If you make the game exclusive for Kongregate ( in my opinion not a good idea, since you will lose other markets ) you get another 15% aka 50% of add revenue.</p>
<p>As an example, 1000 plays ( someone played your game = 1 play ) gives approx 3 dollars. If your share is 35%, you get approx 1 dollar. To make 1000 dollars, you should target to 1.000.000 plays and above. Another source of revenue are weekly and monthly contests, with prices that vary from 250 &#8211; 1500 $. For more info check <a href="http://www.kongregate.com/contests" target="_blank">here.</a> This month,  <a href="http://www.kongregate.com/games/quickfingerz/step-seq" target="_blank">Step Sequencer </a>is a Unity app that does well, so you could consider upvoting it !</p>
<p>As a tip, try to polish as possible the first minute of gameplay of your app. Kongregate users take fancy menus and polished graphics as a standard to consider playing a game. Another thing is that you should be aware that the publicity &#8220;window&#8221; that Kongregate provides is quite narrow, so if your game does not have many plays in the first days, it will be &#8220;buried&#8221; under another 41.000 games <img src='http://ippomed.com/unity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   So plan well the first impression, because it can make a difference. Also, Kongregate promotes games via placing them in the front page and creating &#8220;badges&#8221; for them. All those result in more plays -&gt; more revenue.</p>
<p>The profit may seems small, but I think Kongregate is a good chance for someone to &#8220;wet&#8221; his feet in game development. You can submit games made with Unity free, you get user feedback which can help you remodel your project. That said, my current profits from Kongregate are 0.60 euros <img src='http://ippomed.com/unity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I hope that a next version of my game <a href="http://www.kongregate.com/games/ippobour/thyella" target="_blank">Thyella</a> will do better !</p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-kongregate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to monetize a Unity 3d casual game &#8211; Union</title>
		<link>http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-union/</link>
		<comments>http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-union/#comments</comments>
		<pubDate>Sun, 22 May 2011 09:47:43 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=167</guid>
		<description><![CDATA[So you wanna monetize your unity 3d casual game ? One option is through Union , Unity&#8217;s new service for developers that allows reaching new markets. Currently Unity supports quite a few platforms : IOS, Android, Mac, Win, PS3, XBox. &#8230; <a href="http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-union/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you wanna monetize your unity 3d casual game ? One option is through <a href="http://unity3d.com/union/">Union</a> , Unity&#8217;s new service for developers that allows reaching new markets. Currently Unity supports quite a few platforms : IOS, Android, Mac, Win,  PS3, XBox. What is the deal with those &#8220;new markets&#8221; ? <span id="more-167"></span>There are many potential buyers of your casual game that use a platform not included in the supported ones. Think Nokia, Sony-Ericson, RIM etc. Those are closed platforms that usually co-operate with big companies, able to provide them with a lot of high quality games in bulk. This left indies outside, until now.</p>
<p>Union gathers unity 3d games, converts them for the platform and makes them available as a bundle. Indies get 80% of the profits their game makes. As I see it, it is a nice deal, since it allows entering in a market  that was closed and profiting from this.</p>
<p>Here are some links that can help you familiarize with Union.</p>
<ul>
<li>A <a href="http://unity3d.com/union/presentation">video </a>explaining what union is about.</li>
<li>Union -related <a href="http://blogs.unity3d.com/category/union/">posts</a> from Unity blogs.</li>
<li>Union <a href="http://unity3d.com/union/">page</a>, here you can find more info and submit your project.</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/how-to-monetize-a-unity-3d-casual-game-union/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to monetize a casual game made with Unity 3d</title>
		<link>http://ippomed.com/unity/how-to-monetize-a-casual-game-made-with-unity-3d/</link>
		<comments>http://ippomed.com/unity/how-to-monetize-a-casual-game-made-with-unity-3d/#comments</comments>
		<pubDate>Sat, 21 May 2011 09:12:47 +0000</pubDate>
		<dc:creator>ippo</dc:creator>
		
		<guid isPermaLink="false">http://ippomed.com/wordpress/?p=160</guid>
		<description><![CDATA[So you made a casual game with Unity 3d and you wanna monetize it. What are your options ? Fortunately, there are many. I have found the following : Union Kongragate Wooglie Dime Rocker Steam Iphone app store Mac app &#8230; <a href="http://ippomed.com/unity/how-to-monetize-a-casual-game-made-with-unity-3d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you made a casual game with Unity 3d and you wanna monetize it. What are your options ?<br />
Fortunately, there are many. I have found the following :<br />
<span id="more-160"></span></p>
<ol>
<li>Union</li>
<li>Kongragate</li>
<li>Wooglie</li>
<li>Dime Rocker</li>
<li>Steam</li>
<li>Iphone app store</li>
<li>Mac app store</li>
<li>Make your own site and sell your game through that.</li>
<li>Find a sponsor that will promote its product through your game</li>
</ol>
<p>In next posts I will write some thoughts and experiences with the above options.</p>
]]></content:encoded>
			<wfw:commentRss>http://ippomed.com/unity/how-to-monetize-a-casual-game-made-with-unity-3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

