﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Doc%3A2.6%2FManual%2FRender%2FCycles%2FNodes%2FOSL</id>
	<title>Doc:2.6/Manual/Render/Cycles/Nodes/OSL - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Doc%3A2.6%2FManual%2FRender%2FCycles%2FNodes%2FOSL"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Doc:2.6/Manual/Render/Cycles/Nodes/OSL&amp;action=history"/>
	<updated>2026-05-07T17:29:03Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Doc:2.6/Manual/Render/Cycles/Nodes/OSL&amp;diff=138749&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Doc:2.6/Manual/Render/Cycles/Nodes/OSL&amp;diff=138749&amp;oldid=prev"/>
		<updated>2018-06-28T20:51:18Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 20:51時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Doc:2.6/Manual/Render/Cycles/Nodes/OSL&amp;diff=138748&amp;oldid=prev</id>
		<title>2014年10月12日 (日) 16:41にwiki&gt;DingToによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Doc:2.6/Manual/Render/Cycles/Nodes/OSL&amp;diff=138748&amp;oldid=prev"/>
		<updated>2014-10-12T16:41:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Page/Header||}}&lt;br /&gt;
&lt;br /&gt;
=Open Shading Language=&lt;br /&gt;
&lt;br /&gt;
Users can now create their own nodes using the [http://code.google.com/p/openshadinglanguage/ Open Shading Language] (OSL). Note that these nodes will only work for CPU rendering; there is no support for running OSL code on the GPU. '''To enable it, select Open Shading Language as the shading system''' in the render settings.&lt;br /&gt;
&lt;br /&gt;
Note: on Linux, C/C++ compiler tools (in particular /usr/bin/cpp) must be installed to compile OSL scripts. &lt;br /&gt;
&lt;br /&gt;
==== Script Node ====&lt;br /&gt;
&lt;br /&gt;
OSL was designed for node-based shading, and '''each OSL shader corresponds to a node''' in a node setup. To add an OSL shader, add a script node and link it to a text datablock or an external file. Input and output sockets will be created from the shader parameters on clicking the update button in the node or the text editor.&lt;br /&gt;
&lt;br /&gt;
OSL shaders can be linked to the node in a few different ways. With the '''Internal''' mode, a text datablock is used to store the OSL shader, and the OSO bytecode is stored in the node itself. This is useful for distributing a .blend file with everything packed into it.&lt;br /&gt;
&lt;br /&gt;
The '''External''' mode can be used to specify a .osl file on disk, and this will then be automatically compiled into a .oso file in the same directory. It is also possible to specify a path to a .oso file, which will then be used directly, with compilation done manually by the user. The third option is to specify just the module name, which will be looked up in the shader search path.&lt;br /&gt;
&lt;br /&gt;
The shader search path is located in the same place as the scripts or configuration path, under:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%&amp;quot; {{Css/prettytable}}&lt;br /&gt;
|-&lt;br /&gt;
| Linux&lt;br /&gt;
| &amp;lt;code&amp;gt;/home/$user/.config/blender/''Version Number''/shaders/&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Windows&lt;br /&gt;
| &amp;lt;code&amp;gt;C:\Users\$user\AppData\Roaming\Blender Foundation\Blender\''Version Number''\shaders\&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Mac OS X&lt;br /&gt;
| &amp;lt;code&amp;gt;/Users/$user/Library/Application Support/Blender/''Version Number''/shaders/&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
(Replace ''Version Number'' with the release number of your current Blender installation, e.g. ''2.65'' or ''2.66''.)&lt;br /&gt;
&lt;br /&gt;
For use in production, we suggest to '''use a node group to wrap shader script nodes''', and link that into other .blend files. This makes it easier to make changes to the node afterwards as sockets are added or removed, without having to update the script nodes in all files.&lt;br /&gt;
&lt;br /&gt;
==== Writing Shaders ====&lt;br /&gt;
&lt;br /&gt;
For more details on how to write shaders, see the [https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf OSL specification]. Here is a simple example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: lightgreen&amp;quot;&amp;gt;shader&amp;lt;/span&amp;gt; simple_material(&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color: lightgreen;&amp;quot;&amp;gt;color&amp;lt;/span&amp;gt; Diffuse_Color = color(&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;0.6&amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;0.8&amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;0.6&amp;lt;/span&amp;gt;),&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color: lightgreen;&amp;quot;&amp;gt;float&amp;lt;/span&amp;gt; Noise_Factor = &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;0.5&amp;lt;/span&amp;gt;,&lt;br /&gt;
     &amp;lt;span style=&amp;quot;color: lightgreen;&amp;quot;&amp;gt;output closure color&amp;lt;/span&amp;gt; BSDF = &amp;lt;span style=&amp;quot;color: orange;&amp;quot;&amp;gt;diffuse&amp;lt;/span&amp;gt;(N))&lt;br /&gt;
 {&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color: lightgreen;&amp;quot;&amp;gt;color&amp;lt;/span&amp;gt; material_color = Diffuse_Color * &amp;lt;span style=&amp;quot;color: orange;&amp;quot;&amp;gt;mix&amp;lt;/span&amp;gt;(&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;1.0&amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color: orange;&amp;quot;&amp;gt;noise&amp;lt;/span&amp;gt;(P * &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;10.0&amp;lt;/span&amp;gt;), Noise_Factor);&lt;br /&gt;
    BSDF = material_color * &amp;lt;span style=&amp;quot;color: orange;&amp;quot;&amp;gt;diffuse&amp;lt;/span&amp;gt;(N);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==== Closures ====&lt;br /&gt;
&lt;br /&gt;
OSL is different from, for example, RSL or GLSL, in that it does not have a light loop. There is no access to lights in the scene, and the material must be built from closures that are implemented in the render engine itself. This is more limited, but also makes it possible for the render engine to do optimizations and ensure all shaders can be importance sampled.&lt;br /&gt;
&lt;br /&gt;
The available closures in Cycles correspond to the shader nodes and their sockets; for more details on what they do and the meaning of the parameters, see the [[Doc:2.6/Manual/Render/Cycles/Nodes/Shaders|shader nodes manual]].&lt;br /&gt;
&lt;br /&gt;
====== BSDF ======&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;diffuse(N)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;oren_nayar(N, roughness)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;diffuse_ramp(N, colors[8])&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;phong_ramp(N, exponent, colors[8])&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;diffuse_toon(N, size, smooth)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;glossy_toon(N, size, smooth)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;translucent(N)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;reflection(N)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;refraction(N, ior)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;transparent()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;microfacet_ggx(N, roughness)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;microfacet_ggx_aniso(N, T, ax, ay)&amp;lt;/code&amp;gt; {{NewIn|2.72}}&lt;br /&gt;
* &amp;lt;code&amp;gt;microfacet_ggx_refraction(N, roughness, ior)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;microfacet_beckmann(N, roughness)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;microfacet_beckmann_aniso(N, T, ax, ay)&amp;lt;/code&amp;gt; {{NewIn|2.72}}&lt;br /&gt;
* &amp;lt;code&amp;gt;microfacet_beckmann_refraction(N, roughness, ior)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;ashikhmin_shirley(N, T, ax, ay)&amp;lt;/code&amp;gt; {{NewIn|2.72}}&lt;br /&gt;
* &amp;lt;code&amp;gt;ashikhmin_velvet(N, roughness)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== HAIR ======&lt;br /&gt;
* &amp;lt;code&amp;gt;hair_reflection(N, roughnessu, roughnessv, T, offset)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;hair_transmission(N, roughnessu, roughnessv, T, offset)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== BSSRDF ======&lt;br /&gt;
* &amp;lt;code&amp;gt;bssrdf_cubic(N, radius, texture_blur, sharpness)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;bssrdf_gaussian(N, radius, texture_blur)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== Volume ======&lt;br /&gt;
* &amp;lt;code&amp;gt;henyey_greenstein(g)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;absorption()&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====== Other ======&lt;br /&gt;
* &amp;lt;code&amp;gt;emission()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;ambient_occlusion()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;holdout()&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;background()&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Attributes ====&lt;br /&gt;
&lt;br /&gt;
Some object, particle and mesh attributes are available to the built-in getattribute() function. UV maps and vertex colors can be retrieved using their name. Other attributes are listed below:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%&amp;quot; {{Css/prettytable}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:generated&amp;lt;/code&amp;gt;&lt;br /&gt;
| Generated texture coordinates&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:uv&amp;lt;/code&amp;gt;&lt;br /&gt;
| Default render UV map&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:dupli_generated&amp;lt;/code&amp;gt;&lt;br /&gt;
| For instances, generated coordinate from duplicator object&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:dupli_uv&amp;lt;/code&amp;gt;&lt;br /&gt;
| For instances, UV coordinate from duplicator object&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:trianglevertices&amp;lt;/code&amp;gt;&lt;br /&gt;
| 3 vertex coordinates of the triangle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:numpolyvertices&amp;lt;/code&amp;gt;&lt;br /&gt;
| Number of vertices in the polygon (always returns 3 currently)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:polyvertices&amp;lt;/code&amp;gt;&lt;br /&gt;
| Vertex coordinates array of the polygon (always 3 vertices currently)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:name&amp;lt;/code&amp;gt;&lt;br /&gt;
| Name of the object&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:is_curve&amp;lt;/code&amp;gt;&lt;br /&gt;
| Is object a strand or not&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:curve_intercept&amp;lt;/code&amp;gt;&lt;br /&gt;
| Point along the strand, from root to tip&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:curve_thickness&amp;lt;/code&amp;gt;&lt;br /&gt;
| Thickness of the strand&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;geom:curve_tangent_normal&amp;lt;/code&amp;gt;&lt;br /&gt;
| Tangent Normal of the strand&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;path:ray_length&amp;lt;/code&amp;gt;&lt;br /&gt;
| Ray distance since last hit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;object:location&amp;lt;/code&amp;gt;&lt;br /&gt;
| Object location&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;object:index&amp;lt;/code&amp;gt;&lt;br /&gt;
| Object index number&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;object:random&amp;lt;/code&amp;gt;&lt;br /&gt;
| Per object random number generated from object index and name&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;material:index&amp;lt;/code&amp;gt;&lt;br /&gt;
| Material index number&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:index&amp;lt;/code&amp;gt;&lt;br /&gt;
| Particle instance number&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:age&amp;lt;/code&amp;gt;&lt;br /&gt;
| Particle age in frames&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:lifetime&amp;lt;/code&amp;gt;&lt;br /&gt;
| Total lifespan of particle in frames&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:location&amp;lt;/code&amp;gt;&lt;br /&gt;
| Location of the particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:size&amp;lt;/code&amp;gt;&lt;br /&gt;
| Size of the particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:velocity&amp;lt;/code&amp;gt;&lt;br /&gt;
| Velocity of the particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;particle:angular_velocity&amp;lt;/code&amp;gt;&lt;br /&gt;
| Angular velocity of the particle&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Trace ====&lt;br /&gt;
&lt;br /&gt;
We support the trace(point pos, vector dir, ...) function, to trace rays from the OSL shader. The &amp;quot;shade&amp;quot; parameter is not supported currently, but attributes can be retrieved from the object that was hit using the getmessage(&amp;quot;trace&amp;quot;, ..) function. See the OSL specification for details on how to use this.&lt;br /&gt;
&lt;br /&gt;
This function can't be used instead of lighting; the main purpose is to allow shaders to &amp;quot;probe&amp;quot; nearby geometry, for example to apply a projected texture that can be blocked by geometry, apply more “wear” to exposed geometry, or make other ambient occlusion-like effects.&lt;/div&gt;</summary>
		<author><name>wiki&gt;DingTo</name></author>
		
	</entry>
</feed>