<?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>www.doriengunnels.com/blog</title>
	<atom:link href="http://www.doriengunnels.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.doriengunnels.com/blog</link>
	<description>The personal blog of Dorien Gunnels</description>
	<lastBuildDate>Mon, 30 Nov 2009 13:58:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DCG_Lighter</title>
		<link>http://www.doriengunnels.com/blog/?p=105</link>
		<comments>http://www.doriengunnels.com/blog/?p=105#comments</comments>
		<pubDate>Mon, 30 Nov 2009 13:57:11 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[MEL Scripting Final]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=105</guid>
		<description><![CDATA[Well, here it is&#8230;
I&#8217;ve finally uploaded my final project from my MEL scripting class.  I created a small lighting toolkit that can be used to automate several commonly used tasks when lighting a scene in Maya.  The script as well as a PDF description on how to use it can be downloaded from [...]]]></description>
			<content:encoded><![CDATA[<p>Well, here it is&#8230;</p>
<p>I&#8217;ve finally uploaded my final project from my MEL scripting class.  I created a small lighting toolkit that can be used to automate several commonly used tasks when lighting a scene in Maya.  The script as well as a PDF description on how to use it can be downloaded from my <a href="http://doriengunnels.com/links.html">links page</a>.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=105</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy (Late) Turkey Day</title>
		<link>http://www.doriengunnels.com/blog/?p=101</link>
		<comments>http://www.doriengunnels.com/blog/?p=101#comments</comments>
		<pubDate>Sat, 28 Nov 2009 17:53:20 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=101</guid>
		<description><![CDATA[Well, it&#8217;s the Saturday after Thanksgiving, and, as usual, my family is celebrating the holiday on a completely different day.  I guess we&#8217;re not much for tradition.   
I took a nice break from working after my finals week from hell (ie: I slept a LOT). Overall, I&#8217;m pretty happy with the way [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s the Saturday after Thanksgiving, and, as usual, my family is celebrating the holiday on a completely different day.  I guess we&#8217;re not much for tradition.  <img src='http://www.doriengunnels.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I took a nice break from working after my finals week from hell (ie: I slept a LOT). Overall, I&#8217;m pretty happy with the way my MEL scripting final turned out.  After everything was said and done, I ended up with a working lighting toolkit that I feel is very useful and easily expandable.  I plan on uploading the scripts to my site after I write up some short documentation.  I&#8217;ll also need to trim down the demo video (it&#8217;s around 9 minutes long).</p>
<p>As far as my Renderman II final went&#8230; well, it wasn&#8217;t much to look at.  I guess that&#8217;s what comes from proposing a final that doesn&#8217;t actually have a set final produce <img src='http://www.doriengunnels.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  It sounds kinda cheesy to say &#8220;But I learned a lot!&#8221; but it&#8217;s true.  I learned a great deal about the interaction of light-shaders and surface-shaders and this interaction&#8217;s possible application in non-photorealistic  rendering.  I still need to do a write-up on this project&#8230; but it&#8217;s coming.</p>
<p>My Photorealistic Rendering class went pretty well.  However, there is still a lot of work I think needs to be done before I would think any of these projects are reel-ready.</p>
<p>Anyway, Happy belated Thanksgiving!</p>
<p>-Dorien</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=101</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RSL: Manipulating the Termination Angle of a Light</title>
		<link>http://www.doriengunnels.com/blog/?p=90</link>
		<comments>http://www.doriengunnels.com/blog/?p=90#comments</comments>
		<pubDate>Tue, 17 Nov 2009 14:45:45 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[Renderman II Final Project]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=90</guid>
		<description><![CDATA[In an earlier post, I made notes on how the Renderman Shading Language uses &#8220;illuminance&#8221; loops to define how a surface shader reacts to light coming from a light source.  The &#8220;luminance&#8221; loop used to define a Lambertian shading model in RSL is:
Nn = normalize(N);
illuminance( P, Nn, PI/2 )
{
 Ln = normalize(L);
Ci += Cs [...]]]></description>
			<content:encoded><![CDATA[<p>In an earlier <a href="http://www.doriengunnels.com/blog/?p=51">post</a>, I made notes on how the Renderman Shading Language uses &#8220;illuminance&#8221; loops to define how a surface shader reacts to light coming from a light source.  The &#8220;luminance&#8221; loop used to define a Lambertian shading model in RSL is:</p>
<blockquote><p>Nn = normalize(N);<br />
<strong>illuminance</strong>( P, Nn, PI/2 )<br />
{</p>
<dd> Ln = normalize(L);<br />
Ci += Cs * Cl * Ln.Nn; </dd>
<p>}</p></blockquote>
<p>I mentioned that it is possible to change the termination angle of a light.  In reality, if a sphere were to be lit from a light source coming from a specific direction, half the sphere would be in light and half would be in shadow.  This termination angle can be defined as being 90 degrees from the light&#8217;s direction.  If this angle were changed to something above 90, the light would theoretically seem to wrap around the surface.</p>
<p>The illuminance statement needs three arguments.  The third of which is a cone angle (measured in radians) used by the shader to sample incoming light (see this <a href="http://www.doriengunnels.com/blog/?p=51">post</a>).  By default, the angle is &#8220;PI/2&#8243; (90 degrees).  While this angle is not actually measuring the angle between the light&#8217;s direction and the light/shadow termination line, they happen to be equal.  If the angle in the illuminance statement were changed to &#8220;PI&#8221; (180 degrees), the whole surface would be lit.</p>
<p>While it&#8217;s possible to manipulate this single value, there is a way to make this a little more useful.  By default, light has a natural falloff before the surface transitions completely into shadow.  It might be useful to define a point where the transition will start (begin to fade from fully illuminated) and where it will end (the point the surface will be completely in shadow).</p>
<p>This can be done using the following block of code:</p>
<blockquote><p>
color lightColor = color(1,1,1);<br />
color	diffuseColor = 0;<br />
normal n = normalize(N);<br />
float lightfall_begin_angle = 0;<br />
float lightfall_end_angle = 90;</p>
<p>illuminance(&#8221;wrapper&#8221;,P, n, PI ) {</p>
<dd>	//declare illuminance variables</p>
<p>	vector l = normalize(L);<br />
	float dot = n.l;</p>
<p>	//PROCESS LIGHTWRAP<br />
	//	note: angle = 0 = facing light<br />
	//	note: angle = 180 = away from light<br />
	float lightfall_begin_radian = radians(lightfall_begin_angle);<br />
	float lightfall_end_radian = radians(lightfall_end_angle);<br />
	float illum =  smoothstep(cos(lightfall_end_radian), cos(lightfall_begin_radian), dot);</p>
<p>	diffuseColor += Cl * lightColor * illum;<br />
	}</dd>
</blockquote>
<p>1) Define the lightColor and diffuseColor.</p>
<p>2) Normalize the surface normal N.</p>
<p>3) Define the beginning and ending angles for the falloff (measured from the light&#8217;s direction vector L).</p>
<p>4) Define the illuminance loop.  In this case, the loop will be applied only when using lights with the category of &#8220;wrapper&#8221;.  Notice that instead of the angle defining the cone being PI/2, it is simply PI.  This is so that, by default, the entire surface is sampling the light.  The falloff will be done <em>inside</em> the illuminance loop, not <em>by</em> it.</p>
<p>5) Normalize the light&#8217;s direction vector L.</p>
<p>6) Take the dot product of the normalized normal N and the normalized vector L.  This will essentially give the cosine of the two vectors.  This means that a point facing the light will have a &#8220;dot&#8221; value of 1.  A point facing 90 degrees from the light will have a &#8220;dot&#8221; value of 0.  A point facing completely away from the light will have a &#8220;dot&#8221;value of -1.  </p>
<p>7) Convert the beginning and ending falloff angles into radians.</p>
<p>8 ) use the &#8220;smoothstep&#8221; function to apply the gradient.  This way, any value before the &#8220;lightfall_begin&#8221; angle will be white (in light).  Any angle above the &#8220;lightfall_end&#8221; angle will be black (in shadow).  There will be a steady gradient between the two values (the falloff).  You have to take the cosine of both radian angles so they can be measured against the &#8220;dot&#8221; value.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=90</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Photoshop:  Cropping a single layer</title>
		<link>http://www.doriengunnels.com/blog/?p=88</link>
		<comments>http://www.doriengunnels.com/blog/?p=88#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:31:19 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[Photoshop]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=88</guid>
		<description><![CDATA[Here&#8217;s a little trick I just learned.  In Photoshop, if you are resizing a layer, you might want to crop that layer to the size of a specific selection.  If you invert that selection and press Delete, it only deletes the visible pixels.  If you move the layer around, you&#8217;ll notice that [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little trick I just learned.  In Photoshop, if you are resizing a layer, you might want to crop that layer to the size of a specific selection.  If you invert that selection and press Delete, it only deletes the visible pixels.  If you move the layer around, you&#8217;ll notice that there are still pixels kept that were out of frame when you pressed Delete.</p>
<p>In order to keep <em>only</em> the pixels in the selection, just make the selection and press Ctrl+J.  I usually use this just to duplicate (or &#8220;jump&#8221;) a layer.  However, if you have a specific area selected, it will just jump that selection&#8230; trashing the rest of the pixels in the process.  Jump the layer and delete the old one&#8230; instant single-layer crop.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=88</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSL: Passing values from lights shaders to surface shaders</title>
		<link>http://www.doriengunnels.com/blog/?p=81</link>
		<comments>http://www.doriengunnels.com/blog/?p=81#comments</comments>
		<pubDate>Thu, 12 Nov 2009 23:59:13 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[Renderman II Final Project]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=81</guid>
		<description><![CDATA[Sometimes there are parameters defined in a surface shader that would ideally be controlled by the lighting artist.  It is possible to have variables edited in the light and passed to the surface shader.
The process is pretty straight-forward:
In the light, define the editable variable.  For example:
In the light shader:

light
wrapperlight(
float  intensity = 1;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes there are parameters defined in a surface shader that would ideally be controlled by the lighting artist.  It is possible to have variables edited in the light and passed to the surface shader.</p>
<p>The process is pretty straight-forward:</p>
<p>In the light, define the editable variable.  For example:</p>
<p>In the light shader:</p>
<blockquote><p>
light<br />
wrapperlight(</p>
<dd>float  intensity = 1;<br />
             color  lightcolor = 1;<br />
             string  __category = &#8220;wrapper&#8221;;<br />
             <strong>float  wrapAngleFromLight = 0</strong>)</dd>
<p>{</p>
<dd>(body)</dd>
<p>}</p></blockquote>
<p>Then, define a variable in the body of the surface shader, and use the &#8220;lightsource&#8221; function to feed the value from the light shader into the value into the surface shader.</p>
<p>In the body of the surface shader:</p>
<blockquote><p>float wrapAngleInSurface;</p>
<p>illuminance(&#8221;-wrapper&#8221;, P, n, PI/2 ){</p>
<dd><strong>lightsource(&#8221;wrapAngleFromLight&#8221;, wrapAngleInSurface);</strong><br />
*rest of illuminance statement*</dd>
<p>}</p></blockquote>
<p>In these examples, the lighter can now change &#8220;wrapAngleFromLight&#8221; in the light itself.  The value will be passed to &#8220;wrapAngleInSurface&#8221; in the surface shader.  The surface shader will then use &#8220;wrapAngleInSurface&#8221; to perform calculations where the value is needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=81</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSL Notes: illuminate, solar, and illuminance functions and Changing the termination angle of lights</title>
		<link>http://www.doriengunnels.com/blog/?p=51</link>
		<comments>http://www.doriengunnels.com/blog/?p=51#comments</comments>
		<pubDate>Thu, 12 Nov 2009 23:26:30 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[Renderman II Final Project]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=51</guid>
		<description><![CDATA[Just a few RSL notes&#8230;
Illuminance loops:
-Illuminance loops are placed in the surface shader and essentially define how the shader interacts with the light coming from incoming light sources.  There are two forms of this loop:
illuminance(string &#8220;category&#8220;, point position){
statement
}
illuminance(string &#8220;category&#8220;, point position, vector axis, float angle){
statement
}
From the Pixar documentation: &#8220;The first form specifies that the integral [...]]]></description>
			<content:encoded><![CDATA[<p>Just a few RSL notes&#8230;</p>
<p><span style="text-decoration: underline;"><strong>Illuminance loops:</strong></span></p>
<p>-Illuminance loops are placed in the surface shader and essentially define how the shader interacts with the light coming from incoming light sources.  There are two forms of this loop:</p>
<blockquote><p>illuminance(string<strong> </strong>&#8220;<strong>category</strong>&#8220;, point<strong> position</strong>){<br />
<strong>statement</strong><br />
}</p></blockquote>
<blockquote><p>illuminance(string<strong> </strong>&#8220;<strong>category</strong>&#8220;,<strong> </strong>point<strong> position</strong>, vector <strong>axis</strong>, float <strong>angle</strong>){<br />
statement<br />
}</p></blockquote>
<p>From the Pixar documentation: &#8220;The first form specifies that the integral extends over the entire sphere centered at <em>position</em>. The second form integrates over a cone whose apex is on the surface at <em>position</em>.&#8221;</p>
<p>The &#8220;cone&#8221; created in the second form, is essentially a cone eminating from a <strong>position</strong> on the surface (usually point P , centered on an <strong>axis</strong> (usually the surface normal), and spread out using a given <strong>angle</strong>.  By increasing the cone angle, the user is essentially allowing the sampling of more illumination.  A traditional Lambertian shading model can be defined as:</p>
<blockquote><p>Nn = normalize(N);<br />
<strong>illuminance</strong>( P, Nn, PI/2 )<br />
{</p>
<dd> Ln = normalize(L);<br />
Ci += Cs * Cl * Ln.Nn; </dd>
<p>}</p></blockquote>
<p>Inside the &#8220;luminance&#8221; statement, the user is now given access to certain variables:</p>
<p>L &#8211; vector &#8211; incoming light ray direction<br />
Cl &#8211; color &#8211; incoming light ray color<br />
Ol &#8211; incoming light ray color</p>
<p>Knowing these variables, we can see that the above block of code says:</p>
<p>1) normalize the surface normal N.<br />
2) Check if vector L is detected inside a cone emanating from surface point P (centered on the normalized surface normal and spread using the angle 90 degrees).<br />
3) If L is detected, normalize L.  Also, Ci (the apparent surface color of the surface) equals Cs (the actual surface color) times Cl (the light&#8217;s color) times the dot product of the normalized N and L vectors.</p>
<p><span style="text-decoration: underline;">Changing the termination angle of the light</span><br />
The angle given in the illuminance loop is always measured in radians. In the code block above, the angle used is PI/2 (90 degrees).  This essentially means that the light will stop illuminating the surface 90 degrees from the direction the light is pointing.  In the case of a sphere, half the sphere will be illuminated.  If this angle is changed below 90 degrees, the light will unrealistically cease to have an effect before the natural termination angle of 90 degrees.  If the angle is changed above 90 degrees, this will cause the light to seemingly wrap around the object.  The ability to change this termination angle is extremely useful, especially when working with non-photorealistic rendering.  Theoretically, if the angle were changed to 180 degrees, the entirety of the surface would be illuminated regardless of light position or direction.</p>
<p><span style="text-decoration: underline;">Light category string</span><br />
It is possible for surface shaders to contain more than one &#8220;illuminance&#8221; statement.  The &#8220;category&#8221; string given at the beginning of both types of illuminance loops will state which lights will affect the surface in the way given by that particular illuminance statement.  The category is given to the light in the light shader using a flag &#8221; __category&#8221; (&#8221;category&#8221; preceded by two underscores).  For example:</p>
<blockquote><p>light<br />
spotlightWrapper(</p>
<dd> float  intensity = 1;<br />
color  lightcolor = 1;<br />
point  from = point &#8220;shader&#8221; (0,0,0);<br />
point  to = point &#8220;shader&#8221; (0,0,1);<br />
float  coneangle = radians(30);<br />
float  conedeltaangle = radians(5);<br />
float  beamdistribution = 2;<br />
<strong> string __category = &#8220;wrapper&#8221;;</strong></dd>
<p>)<br />
{</p>
<dd>(body)</dd>
<p>}</p></blockquote>
<p>The category is then called in the surface shader like this:</p>
<blockquote><p>illuminance(<strong>&#8220;wrapper&#8221;</strong>,P, n, PI/2 ) {</p>
<dd> Ln = normalize(L);<br />
Ci += Cs * Cl * Ln.Nn; </dd>
<p>}</p></blockquote>
<p><strong><br />
<span style="text-decoration: underline;">&#8220;Illuminate&#8221; and &#8220;Solar&#8221; functions:</span></strong></p>
<p>These two statements are defined in the light shader.  Like the &#8220;illuminance&#8221; statement, the user is given access to vector <strong>L</strong> (the light&#8217;s direction) and color <strong>Cl</strong> (the light&#8217;s color).</p>
<p><span style="text-decoration: underline;">&#8220;Illuminate&#8221; function</span></p>
<p>This function is used when defining light coming from a localized light source (ie: spot lights, point lights, etc.)  and the arguements essentially define a 3d cone eminating from the light source.  Again, there are two forms to this statement:</p>
<blockquote><p>illuminate( point <strong>position</strong> )<br />
<strong>statement</strong></p></blockquote>
<p>and</p>
<blockquote><p>illuminate( point <strong>position</strong>, vector <strong>axis</strong>, float <strong>angle</strong> )<br />
<strong>statement</strong></p></blockquote>
<p>From the Pixar docs:<br />
&#8220;The first form specifies that light is cast in all directions. The second form specifies that light is cast only inside the given cone. The length of L inside an illuminate statement is equal to the distance between the light source and the surface currently being shaded.&#8221;</p>
<p>Essentially, the arguments say:</p>
<p>The lightsource illuminates from point <strong>position</strong>, aimed down vector <strong>axis</strong>, and is spread by <strong>angle</strong> (measured in radians).  In the first form, since light is being cast in all directions, the statement only needs point <strong>position</strong>.</p>
<p><span style="text-decoration: underline;">&#8220;Solar&#8221; function</span></p>
<p>The &#8220;solar&#8221; function is called when illuminating a surface using a directional light (distance light).  With this type of light, there is not point from which the light is emanating.  Instead, a wall of light is coming evenly from a particular direction.</p>
<blockquote><p>solar( )<br />
<strong>statement</strong></p></blockquote>
<blockquote><p>solar( vector <strong>axis</strong>, float <strong>angle</strong> )<br />
<strong>statement</strong></p></blockquote>
<p>From the Pixar docs:<br />
&#8220;The first form specifies that light is being cast from all points at infinity (e.g., an illumination map). The second form specifies that light is being cast from only directions inside a cone.</p>
<p>An example of the solar statement is the specification of a distant light source:</p>
<dd> solar( D, 0 )<br />
Cl = intensity * lightcolor;</dd>
<p>This defines a light source at infinity that sends light in the direction D. Since the angle of the cone is 0, all rays from this light are parallel.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Interview with Jay Maisel</title>
		<link>http://www.doriengunnels.com/blog/?p=47</link>
		<comments>http://www.doriengunnels.com/blog/?p=47#comments</comments>
		<pubDate>Tue, 10 Nov 2009 01:07:10 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[Useful Links]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=47</guid>
		<description><![CDATA[Here is a pretty cool interview i found given by Chris Orwig with photographer Jay Maisel.  I think a lot of the insight given here can be applied to many other disciplines.
http://www.chrisorwig.com/flipside/2009/11/08/jay-maisel-interview/
]]></description>
			<content:encoded><![CDATA[<p>Here is a pretty cool interview i found given by Chris Orwig with photographer Jay Maisel.  I think a lot of the insight given here can be applied to many other disciplines.</p>
<p><a href="http://www.chrisorwig.com/flipside/2009/11/08/jay-maisel-interview/">http://www.chrisorwig.com/flipside/2009/11/08/jay-maisel-interview/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=47</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>modelPanel problem&#8230; fixed!</title>
		<link>http://www.doriengunnels.com/blog/?p=44</link>
		<comments>http://www.doriengunnels.com/blog/?p=44#comments</comments>
		<pubDate>Sun, 08 Nov 2009 23:55:33 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[MEL Scripting Final]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=44</guid>
		<description><![CDATA[Yeah&#8230; I&#8217;m kind of an idiot&#8230;
if (`modelPanel -exists dcg_lighter_guiElem_modelPanel_lightLooker`) {
deleteUI -panel dcg_lighter_guiElem_modelPanel_lightLooker;
}
I forgot the -panel flag&#8230;
I can now close my &#8220;Light Looker&#8221; window and reopen it without having to create a new scene.
]]></description>
			<content:encoded><![CDATA[<p>Yeah&#8230; I&#8217;m kind of an idiot&#8230;</p>
<blockquote><p>if (`modelPanel -exists dcg_lighter_guiElem_modelPanel_lightLooker`) {<br />
deleteUI -panel dcg_lighter_guiElem_modelPanel_lightLooker;<br />
}</p></blockquote>
<p>I forgot the -panel flag&#8230;</p>
<p>I can now close my &#8220;Light Looker&#8221; window and reopen it without having to create a new scene.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=44</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>modelPanel problem fix?</title>
		<link>http://www.doriengunnels.com/blog/?p=39</link>
		<comments>http://www.doriengunnels.com/blog/?p=39#comments</comments>
		<pubDate>Sat, 07 Nov 2009 22:39:15 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[MEL Scripting Final]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=39</guid>
		<description><![CDATA[Well, I think I might have a solution to the modelPanel issue in my script.
I spoke to my professor today about the issue.  He suggested explicitly deleting the UI element using an &#8220;if&#8221; statement similar to the way you would delete/refresh the entire UI if the script is run twice without the window being [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I think I might have a solution to the modelPanel issue in my script.</p>
<p>I spoke to my professor today about the issue.  He suggested explicitly deleting the UI element using an &#8220;if&#8221; statement similar to the way you would delete/refresh the entire UI if the script is run twice without the window being closed.</p>
<p>Deleting the UI:</p>
<blockquote><p>if (`window -exists dcg_fp_lighterUIWindow`) {<br />
		deleteUI dcg_fp_lighterUIWindow;<br />
	}</p></blockquote>
<p>Deleting the UI element:</p>
<blockquote><p>if (`modelPanel -exists dcg_lighter_guiElem_modelPanel`) {<br />
		deleteUI dcg_lighter_guiElem_modelPanel;<br />
	}</p></blockquote>
<p>I thought this would fix my script, end war, fix the economy, and eliminate poverty.  It turns out that, as it stands, it did none of the above.  When I added the delete-modelPanel block to my script, its almost like it ignored it.  When the UI is closed and the script is run a second time, it still errors out saying that the name &#8220;dcg_lighter_guiElem_modelPanel&#8221; is not unique (in other words, it didn&#8217;t delete the modelPanel).</p>
<p>I tried each line individually&#8230;</p>
<blockquote><p>
modelPanel -exists dcg_lighter_guiElem_modelPanel;</p></blockquote>
<p>This returned a value of 1&#8230; true&#8230; it still exists.  Ok, let&#8217;s delete it&#8230;</p>
<blockquote><p>
deleteUI dcg_lighter_guiElem_modelPanel;</p></blockquote>
<p>Maya crashes&#8230;</p>
<p>Sooo&#8230; problem not solved&#8230; yet&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=39</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GUI Madness!</title>
		<link>http://www.doriengunnels.com/blog/?p=28</link>
		<comments>http://www.doriengunnels.com/blog/?p=28#comments</comments>
		<pubDate>Fri, 06 Nov 2009 09:12:16 +0000</pubDate>
		<dc:creator>TheRiverside</dc:creator>
				<category><![CDATA[MEL Scripting Final]]></category>

		<guid isPermaLink="false">http://www.doriengunnels.com/blog/?p=28</guid>
		<description><![CDATA[Well, tonight&#8217;s been a pretty long and trying night&#8230;
As part of my MEL scripting final project, I&#8217;m trying to expand upon a &#8220;light dropper&#8221; script writen by Jordan Rempel (http://jordanrempel.com/links.html).  This script creates a spotlight with the same translation and rotation value as the perspective camera.  Simple&#8230; but pretty cool!
I&#8217;m trying to provide the user [...]]]></description>
			<content:encoded><![CDATA[<p>Well, tonight&#8217;s been a pretty long and trying night&#8230;</p>
<p>As part of my MEL scripting final project, I&#8217;m trying to expand upon a &#8220;light dropper&#8221; script writen by Jordan Rempel (http://jordanrempel.com/links.html).  This script creates a spotlight with the same translation and rotation value as the perspective camera.  Simple&#8230; but pretty cool!</p>
<p>I&#8217;m trying to provide the user with the ability to press a button, drop a light (in this case a spot light) at the location of the perspective camera, and quickly look through it using a pre-defined modelPanel.  I would also like to be able to have an object selected.  The light would then auto-correct its rotation (while keeping its translation values the same as the perspective camera) and essentially focus on said object.  The user would then have the freedom to fine-tune the light&#8217;s location interactively without having to go to &#8220;Look Through Selected&#8221;, adjust, then switch back to perspective mode.  Every type of Maya light should have a dedicated button.</p>
<p>I honestly thought that this was a pretty straight-forward task.  It was not meant to be the major part of my final by any means&#8230;  I have a lot to learn&#8230;</p>
<p>Before I could really start, I had to create a rough User Interface consisting of a button to create the spotlight and a modelPanel with which to look through the light (as well as some other layout elements&#8230; trying to plan ahead).  I&#8217;m quickly starting to feel that modelPanels are the devil.  To make a long story short, I&#8217;ve been wading through layout and parenting issues for hours.  ModelPanels seem to interact much differently with Interfaces than other objects.  Also, aparently modelPanels are not deleted when windows are closed.  Thus, if the script is run a second time, the explicit name I gave the modelPanel is no longer unique, resulting in the script crashing.  I tried letting Maya name the modelPanel and storing it under a variable to call back later.  However, say the script is run two dozen times.  There are two dozen newly-created modelPanels now cluttering up your scene.</p>
<p>Anyway, I now have a very temporary GUI to work with.  After all this, beginning to write the light generation procedure seemed extremely easy.  There are, however, a good many kinks that can&#8217;t really be worked out until I figure out a way to manage the modelPanel issue.</p>
<p>I shall now leave you with a script I accidently wrote&#8230;</p>
<p>When trying to figure out the best way to judge the distance between an object and the newly created light, I came up with this:</p>
<blockquote><p>global proc dcg_distanceBetweenObjects()<br />
{<br />
string $selection[] = `ls -selection`;<br />
float $translateObject1[] = `xform -query -translation $selection[0]`;<br />
float $translateObject2[] = `xform -query -translation $selection[1]`;<br />
string $distanceBetween = `distanceDimension -endPoint $translateObject1[0] $translateObject1[1] $translateObject1[2]<br />
-startPoint $translateObject2[0] $translateObject2[1] $translateObject2[2]`;<br />
}</p></blockquote>
<p>Simply select two objects and run the script (excluding the &#8220;global proc&#8221; line).  A &#8220;distanceDimension&#8221; will be created used to interactively show the distance between them.</p>
<p>aaaaaaand it&#8217;s 4:12 in the AM&#8230;</p>
<p>Goodnight.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doriengunnels.com/blog/?feed=rss2&amp;p=28</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
