Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 6986de75f6e996835c622ea8eafbf38c > files > 29

Pixie-docs-2.2.6-4.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta name="robots" content="noindex,follow" />
		<meta name="keywords" content="Documentation/Raytracing in SL" />
		<link rel="shortcut icon" href="../favicon.ico" />
		<link rel="search" type="application/opensearchdescription+xml" href="/pixiewiki_install/opensearch_desc.php" title="PixieWiki (English)" />
		<title>Documentation/Raytracing in SL - PixieWiki</title>
		<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "../css/main.css?63"; /*]]>*/</style>
		<link rel="stylesheet" type="text/css"  href="../css/commonPrint.css?63" />
		<link rel="stylesheet" type="text/css" media="handheld" href="../css/handheld.css?63" />
		<!--[if lt IE 5.5000]><style type="text/css">@import "../css/IE50Fixes.css?63";</style><![endif]-->
		<!--[if IE 5.5000]><style type="text/css">@import "../css/IE55Fixes.css?63";</style><![endif]-->
		<!--[if IE 6]><style type="text/css">@import "../css/IE60Fixes.css?63";</style><![endif]-->
		<!--[if IE 7]><style type="text/css">@import "../css/IE70Fixes.css?63";</style><![endif]-->
		<!--[if lt IE 7]><script type="text/javascript" src="../css/IEFixes.js?63"></script>
		<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
		
		<script type= "text/javascript">/*<![CDATA[*/
var skin = "monobook";
var stylepath = "../css/";
var wgArticlePath = "/pixiewiki/$1";
var wgScriptPath = "/pixiewiki_install";
var wgServer = "http://www.george-graphics.co.uk";
var wgCanonicalNamespace = "";
var wgCanonicalSpecialPageName = false;
var wgNamespaceNumber = 0;
var wgPageName = "Documentation/Raytracing_in_SL";
var wgTitle = "Documentation/Raytracing in SL";
var wgAction = "view";
var wgArticleId = "1539";
var wgIsArticle = true;
var wgUserName = null;
var wgUserGroups = null;
var wgUserLanguage = "en";
var wgContentLanguage = "en";
var wgBreakFrames = false;
var wgCurRevisionId = "3201";
/*]]>*/</script>
                
		<script type="text/javascript" src="../css/wikibits.js?63"><!-- wikibits js --></script>
		<script type="text/javascript" src="../css/WikiExtraJs.js"><!-- site js --></script>
		<style type="text/css">/*<![CDATA[*/
@import "../css/MediaWiki_Common.css";
@import "../css/MediaWiki_Monobook.css";
@import "../css/WikiExtraCss.css";
/*]]>*/</style>
		<!-- Head Scripts -->
	</head>
<body  class="mediawiki ns-0 ltr page-Documentation_Raytracing_in_SL">
 <div id="titleBar"></div>
	<div id="globalWrapper">
		<div id="column-content">
	<div id="content">
		<a name="contentTop" id="top"></a>
				<h1 class="firstHeading">Documentation/Raytracing in SL</h1>
		<div id="bodyContent">
			<h3 id="siteSub">From PixieWiki</h3>
			<div id="contentSub"><span class="subpages">&lt; <a href="../Documentation.html" title="Documentation">Documentation</a></span></div>
									<div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div>			<!-- start content -->
			<p><br />
</p>
<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#Raytracing_in_shading_language"><span class="tocnumber">1</span> <span class="toctext">Raytracing in shading language</span></a>
<ul>
<li class="toclevel-2"><a href="#trace"><span class="tocnumber">1.1</span> <span class="toctext">trace</span></a></li>
<li class="toclevel-2"><a href="#gather"><span class="tocnumber">1.2</span> <span class="toctext">gather</span></a></li>
<li class="toclevel-2"><a href="#tranmission"><span class="tocnumber">1.3</span> <span class="toctext">tranmission</span></a></li>
<li class="toclevel-2"><a href="#indirectdiffuse"><span class="tocnumber">1.4</span> <span class="toctext">indirectdiffuse</span></a></li>
<li class="toclevel-2"><a href="#occlusion"><span class="tocnumber">1.5</span> <span class="toctext">occlusion</span></a></li>
<li class="toclevel-2"><a href="#raydepth"><span class="tocnumber">1.6</span> <span class="toctext">raydepth</span></a></li>
<li class="toclevel-2"><a href="#raylabel"><span class="tocnumber">1.7</span> <span class="toctext">raylabel</span></a></li>
<li class="toclevel-2"><a href="#rayinfo"><span class="tocnumber">1.8</span> <span class="toctext">rayinfo</span></a></li>
</ul>
</li>
</ul>
</td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<a name="Raytracing_in_shading_language"></a><h1><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=1" title="Edit section: Raytracing in shading language">edit</a>]</span> <span class="mw-headline"> Raytracing in shading language </span></h1>
<p>For an object to be raytraced, it must be marked as raytraceable by setting the visibility attribute.
</p>
<pre>Attribute "visibility" "trace" 1
</pre>
<p>The following new shading language constructs and functions are available:
</p>
<a name="trace"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=2" title="Edit section: trace">edit</a>]</span> <span class="mw-headline"> trace </span></h2>
<pre>color trace(point P,vector R);
float trace(point P,vector R);
</pre>
<p>The <tt>trace</tt> shadeop fires a single ray from <tt>P</tt> in direction <tt>R</tt> and returns either the color hit (the color version) or the percentage visibility (the float version).  You can use the explicit prefix in situations which are ambiguous.  Trace also takes these optional arguments:
</p>
<table class="wikitable">
<tr>
<td> <tt>uniform float bias</tt> </td><td>		The self intersection bias.
</td></tr>
<tr>
<td> <tt>uniform string label</tt></td><td>		A label for the ray
</td></tr>
<tr>
<td> <tt>uniform float numSamples</tt></td><td>		The number of samples for the ray
</td></tr>
<tr>
<td> <tt>varying float coneAngle</tt></td><td>		The cone in which to spread the rays
</td></tr>
<tr>
<td> <tt>varying float blur</tt></td><td>		Alternate way to specify the cone in which to spread the rays (coneAngle=blur*Pi)
</td></tr></table>
<a name="gather"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=3" title="Edit section: gather">edit</a>]</span> <span class="mw-headline"> gather </span></h2>
<pre>gather(	string category,
    point P,
    vector dir,
    float angle,
    float numSamples,
    ...)
    statement
    [else statement]
</pre>
<p>This construct is very similar to PrMan 11's gather construct. It will shoot <tt>numSamples</tt> rays rooted at <tt>P</tt> distributed in a cone centered at <tt>dir</tt> making <tt>angle</tt> angles. For each ray that hits something, the first statement will be executed. Otherwise  else statement will be executed. The following optional parameters can be provided:
</p>
<table class="wikitable">
<tr>
<td> <tt>uniform float bias</tt> </td><td>		The self intersection bias.
</td></tr>
<tr>
<td> <tt>uniform float maxdist</tt></td><td>		The maximum intersection distance
</td></tr>
<tr>
<td> <tt>uniform string distribution</tt> </td><td>		The sample distribution (<tt>"cosine"</tt> or <tt>"uniform"</tt>)
</td></tr>
<tr>
<td> <tt>uniform string label</tt></td><td>		The ray label
</td></tr>
<tr>
<td> <tt>varying type shadertype:variablename</tt></td><td>	The query value (output)
</td></tr>
<tr>
<td> <tt>varying float ray:length</tt></td><td>	Length of the ray (output)
</td></tr>
<tr>
<td> <tt>varying vector ray:direction</tt></td><td>	The ray direction (output)
</td></tr></table>
<p>For example:
</p>
<pre>color totalColor = 0;
color hitColor;
float numHits = 0;
gather("irradiance",P,N,PI/2,256,"surface:Ci",hitColor) {
    totalColor += hitColor;
    numHits++;
}
totalColor /= numHits;
</pre>
<p>is approximately equivalent (for single bounce color bleeding) to
</p>
<pre>totalColor = indirectdiffuse(P,N,256);
</pre>
<a name="tranmission"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=4" title="Edit section: tranmission">edit</a>]</span> <span class="mw-headline"> tranmission </span></h2>
<pre>color transmission(point P1,point P2,...);
</pre>
<p>This function gives the transmission between the two points. This function can be used to get raytraced shadows in light source shaders:
</p>
<pre>illuminate (from) {
    Cl = transmission(Ps,from) * intensity * lightcolor / (L . L);
}
</pre>
<a name="indirectdiffuse"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=5" title="Edit section: indirectdiffuse">edit</a>]</span> <span class="mw-headline"> indirectdiffuse </span></h2>
<pre>color indirectdiffuse(point P,vector N,float numSamples ...);
</pre>
<p>This function gives the average irradiance as seen be a hemisphere centered at  <tt>P</tt> <tt>N</tt>. The irradiance is computed by raytracing.  numSamples gives the number of rays to shoot. Depending on the  irradiance attributes of the current primitive, this value can be cached. The following optional parameters can be provided:
</p>
<table class="wikitable">
<tr>
<td> <tt>uniform float minR</tt> </td><td>		The minimum distance between samples.
</td></tr>
<tr>
<td> <tt>uniform float maxR</tt> </td><td>		The maximum distance between samples.
</td></tr>
<tr>
<td> <tt>uniform float bias</tt> </td><td>		Self intersection bias
</td></tr>
<tr>
<td> <tt>varying float occlusion</tt> </td><td>	The occlusion amount (output)
</td></tr>
<tr>
<td> <tt>uniform float maxdist</tt> </td><td>		The maximum intersection distance
</td></tr>
<tr>
<td> <tt>uniform vector backgroundColor</tt> </td><td>		This color will be used for rays that don't hit anything
</td></tr>
<tr>
<td> <tt>uniform float maxBrightness</tt> </td><td>		The ray brightness will be clamped by this number to avoid splotchy results
</td></tr>
<tr>
<td> <tt>uniform string environmentmap</tt> </td><td>		The incoming color for rays which don't hit anything will be estimated by sampling this map if specified
</td></tr>
<tr>
<td> <tt>output varying vector environmentdir</tt> </td><td>		The argument takes a variable, into which the average unoccluded environment direction will be placed
</td></tr>
<tr>
<td> <tt>output varying color occlusion</tt> </td><td>		The argument takes a variable, into which the value of occlusion will be placed
</td></tr></table>
<a name="occlusion"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=6" title="Edit section: occlusion">edit</a>]</span> <span class="mw-headline"> occlusion </span></h2>
<pre>float occlusion(point P,vector N,float numSamples ...);
</pre>
<p>This function computes the fraction of the hemisphere that is not occluded by another geometry. The interpretation of the parameters is the same with  indirectdiffuse. The following parameters can be passed:
</p>
<table class="wikitable">
<tr>
<td> <tt>uniform float minR</tt></td><td>		The closest distance between samples.
</td></tr>
<tr>
<td> <tt>uniform float maxR</tt></td><td>		The maximum distance between samples.
</td></tr>
<tr>
<td> <tt>uniform float bias</tt></td><td>		Self intersection bias
</td></tr>
<tr>
<td> <tt>varying color irradiance</tt></td><td>	The irradiance amount (output)
</td></tr>
<tr>
<td> <tt>uniform float maxdist</tt></td><td>		The maximum intersection distance
</td></tr></table>
<a name="raydepth"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=7" title="Edit section: raydepth">edit</a>]</span> <span class="mw-headline"> raydepth </span></h2>
<pre>uniform float raydepth();
</pre>
<p>This function returns the depth of the current shading point. It returns 0 for the camera rays.
</p>
<a name="raylabel"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=8" title="Edit section: raylabel">edit</a>]</span> <span class="mw-headline"> raylabel </span></h2>
<pre>uniform string raylabel();
</pre>
<p>This function returns the label of ray that caused the shading. You can assign labels to rays that are generated by the  gather statement.
</p>
<a name="rayinfo"></a><h2><span class="editsection">[<a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit&amp;section=9" title="Edit section: rayinfo">edit</a>]</span> <span class="mw-headline"> rayinfo </span></h2>
<pre>uniform float rayinfo(uniform string arg,varying &lt;type&gt; val);
</pre>
<p>The <tt>rayinfo</tt> shadeop returns information about a ray.  The <tt>arg</tt> parameter specifies which piece of information to fetch.  The value will be placed in <tt>val</tt>.  If no value can be found, <tt>rayinfo</tt> returns 0.  The table below shows what information can be obtained.  Note it's that values are premoted to varying as each ray hitting the surface can have different values.
</p>
<table class="wikitable">
<tr>
<td> <tt>varying string label</tt></td><td>  The label of the ray
</td></tr>
<tr>
<td> <tt>varying float depth</tt></td><td>  The depth of the ray
</td></tr>
<tr>
<td> <tt>varying point origin</tt></td><td>  The origin of the ray (<tt>P</tt> where it was fired from)
</td></tr>
<tr>
<td> <tt>varying vector direction</tt></td><td>  The direction of the ray (<tt>R</tt> when it was fired)
</td></tr>
<tr>
<td> <tt>varying float length</tt></td><td>  The length of the ray (distance from <tt>P</tt>)
</td></tr></table>

<!-- Saved in parser cache with key georgeg_pixiewikidb:pcache:idhash:1539-0!1!0!!en!2 and timestamp 20071121124353 -->
<div class="printfooter">
Retrieved from "<a href="http://www.george-graphics.co.uk/pixiewiki/Documentation/Raytracing_in_SL">http://www.george-graphics.co.uk/pixiewiki/Documentation/Raytracing_in_SL</a>"</div>
			<div id="catlinks"><p class='catlinks'><a href="../NotSupportedStatic.html" title="Special:Categories">Category</a>: <span dir='ltr'><a href="../Category_Documentation.html" title="Category:Documentation">Documentation</a></span></p></div>			<!-- end content -->
			<div class="visualClear"></div>
		</div>
	</div>
		</div>
		<div id="column-one">
	<div id="p-cactions" class="portlet">
		<h5>Views</h5>
		<div class="pBody">
			<ul>
					 <li id="ca-nstab-main" class="selected"><a href="../Documentation/Raytracing_in_SL.html" title="View the content page [c]" accesskey="c">Article</a></li>
					 <li id="ca-talk" class="new"><a href="/pixiewiki_install/index.php?title=Talk:Documentation/Raytracing_in_SL&amp;action=edit" title="Discussion about the content page [t]" accesskey="t">Discussion</a></li>
					 <li id="ca-edit"><a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=edit" title="You can edit this page. Please use the preview button before saving. [e]" accesskey="e">Edit</a></li>
					 <li id="ca-history"><a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;action=history" title="Past versions of this page. [h]" accesskey="h">History</a></li>
				</ul>
		</div>
	</div>
	<div class="portlet" id="p-personal">
		<h5>Personal tools</h5>
		<div class="pBody">
			<ul>
				<li id="pt-login"><a href="/pixiewiki_install/index.php?title=Special:Userlogin&amp;returnto=Documentation/Raytracing_in_SL" title="You are encouraged to log in, it is not mandatory however. [o]" accesskey="o">Log in / create account</a></li>
			</ul>
		</div>
	</div>
	<div class="portlet" id="p-logo">
		<a style="background-image: url(/pixiewiki_install/skins/common/images/wiki.png);" href="../NotIncludedStatic.html" title="Visit the Main Page [z]" accesskey="z"></a>
	</div>
	<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
		<div class='portlet' id='p-navigation'>
		<h5>Navigation</h5>
		<div class='pBody'>
			<ul>
				<li id="n-mainpage"><a href="../NotIncludedStatic.html" title="Visit the Main Page [z]" accesskey="z">Main Page</a></li>
				<li id="n-Documentation"><a href="../Documentation.html">Documentation</a></li>
				<li id="n-Examples"><a href="../NotIncludedStatic.html">Examples</a></li>
				<li id="n-Tutorials"><a href="../Tutorials.html">Tutorials</a></li>
				<li id="n-Sourceforge"><a href="http://pixie.sourceforge.net">Sourceforge</a></li>
				<li id="n-recentchanges"><a href="../NotSupportedStatic.html" title="The list of recent changes in the wiki. [r]" accesskey="r">Recent changes</a></li>
				<li id="n-help"><a href="../NotSupportedStatic.html" title="The place to find out.">Help</a></li>
			</ul>
		</div>
	</div>
		<div id="p-search" class="portlet">
		<h5><label for="searchInput">Search</label></h5>
		<div id="searchBody" class="pBody">
			<form action="../NotSupportedStatic.html" id="searchform"><div>
				<input id="searchInput" name="search" type="text" title="Search PixieWiki [f]" accesskey="f" value="" />
				<input type='submit' name="go" class="searchButton" id="searchGoButton"	value="Go" />&nbsp;
				<input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" />
			</div></form>
		</div>
	</div>
	<div class="portlet" id="p-tb">
		<h5>Toolbox</h5>
		<div class="pBody">
			<ul>
				<li id="t-whatlinkshere"><a href="../NotSupportedStatic.html" title="List of all wiki pages that link here [j]" accesskey="j">What links here</a></li>
				<li id="t-recentchangeslinked"><a href="../NotSupportedStatic.html" title="Recent changes in pages linked from this page [k]" accesskey="k">Related changes</a></li>
<li id="t-upload"><a href="../NotSupportedStatic.html" title="Upload images or media files [u]" accesskey="u">Upload file</a></li>
<li id="t-specialpages"><a href="../NotSupportedStatic.html" title="List of all special pages [q]" accesskey="q">Special pages</a></li>
				<li id="t-print"><a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;printable=yes&amp;printable=yes">Printable version</a></li>				<li id="t-permalink"><a href="/pixiewiki_install/index.php?title=Documentation/Raytracing_in_SL&amp;oldid=3201">Permanent link</a></li>			</ul>
		</div>
	</div>
		</div><!-- end of the left (by default at least) column -->
			<div class="visualClear"></div>
			<div id="footer">
				<div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="../css/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" /></a></div>
			<ul id="f-list">
				<li id="f-lastmod"> This page was last modified 19:43, 10 November 2007.</li>
				<li id="f-viewcount">This page has been accessed 1,755 times.</li>
				<li id="f-privacy"><a href="../NotSupportedStatic.html" title="PixieWiki:Privacy policy">Privacy policy</a></li>
				<li id="f-about"><a href="../NotSupportedStatic.html" title="PixieWiki:About">About PixieWiki</a></li>
				<li id="f-disclaimer"><a href="../NotSupportedStatic.html" title="PixieWiki:General disclaimer">Disclaimers</a></li>
			</ul>
		</div>
		
	
		<script type="text/javascript">if (window.runOnloadHook) runOnloadHook();</script>
</div>
<!-- Served by mercury.svr9-speedyservers.com in 0.241 secs. --></body></html>