<?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/"
	xmlns:series="http://organizeseries.com/"
	>

<channel>
	<title>Blender Cookie &#187; Beginner</title>
	<atom:link href="http://cgcookie.com/blender/category/difficulty/beginner/feed/" rel="self" type="application/rss+xml" />
	<link>http://cgcookie.com/blender</link>
	<description>Great Blender tutorials and training</description>
	<lastBuildDate>Thu, 23 May 2013 00:57:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Introduction to Dynamic Topology Sculpting in Blender</title>
		<link>http://cgcookie.com/blender/2013/04/29/intro-dynamic-topology-sculpting-blender/</link>
		<comments>http://cgcookie.com/blender/2013/04/29/intro-dynamic-topology-sculpting-blender/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 21:18:25 +0000</pubDate>
		<dc:creator>Jonathan Williamson</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[Sculpting]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[dynamesh]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[dynatopo]]></category>
		<category><![CDATA[sculpt]]></category>
		<category><![CDATA[sculpting]]></category>
		<category><![CDATA[tessellation]]></category>
		<category><![CDATA[topology]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=49389</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/04/blender_sculptingintro-dyntopo_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_sculptingintro-dyntopo_feature" /></div>Learn how to use Dynamic Topology ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/04/blender_sculptingintro-dyntopo_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_sculptingintro-dyntopo_feature" /></div><h2>Learn how to use Dynamic Topology Sculpting in <a href="http://blender.org" target="_blank">Blender</a></h2>
<p>The <a href="http://cgcookie.com/blender/tag/dynamic-topology" target="_blank">dynamic topology</a> system in Blender allows for a much more organic, creative <a href="http://cgcookie.com/blender/tag/sculpting" target="_blank">sculpting</a> process. It gives you much more flexibility in not only how, but what you sculpt by not limiting you to the original starting basemesh.</p>
<p>When working with dynamic topology, Blender will automatically tessellate the mesh under your brush stroke to account for the detail needed. This gives you the ability to add detail anywhere you wish, create new forms, and work with a much more optimized polycount since the tessellations are localized.</p>
</p>
<blockquote>
<h3 style="text-align: center;">Check out <a href="http://cgcookie.com/membership" target="_blank">CG Cookie Citizen</a> for more sculpting training</h3>
</blockquote>
<p>
<p>To learn more about using dynamic topology in your workflow and creating finished sculptures I recommend you check out <a href="http://cgcookie.com/blender/author/theluthier" target="_blank">Kent Trammell&#8217;s</a> training series on <a title="Learn Creature Modeling for production environments" href="http://cgcookie.com/downloads/creature-modeling-for-production/" target="_blank">Creature Modeling For Production</a>, and his <a href="http://cgcookie.com/membership/" target="_blank">Citizen course</a> on <a href="http://cgcookie.com/blender/cgc-series/sculpting-a-sci-fi-weapon/" target="_blank">Hard-Surface Sci-Fi Weapon Sculpting</a>.</p>
<p><a href="https://cgcookie.com/downloads/creature-modeling-for-production/"><img class="size-medium wp-image-49396 alignleft" style="margin: 5px;" alt="creaturemodeling" src="http://cgcookie.com/blender/files/2013/04/creaturemodeling-300x133.jpeg" width="300" height="133" /></a> <a href="http://cgcookie.com/blender/cgc-series/sculpting-a-sci-fi-weapon/"><img class="size-medium wp-image-49397 alignleft" style="margin: 8px;" alt="weaponsculpting" src="http://cgcookie.com/blender/files/2013/04/weaponsculpting-300x125.jpeg" width="300" height="125" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2013/04/29/intro-dynamic-topology-sculpting-blender/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Task Automation with Python Scripting in Blender</title>
		<link>http://cgcookie.com/blender/2013/04/15/blender-python-scripting-task-automation/</link>
		<comments>http://cgcookie.com/blender/2013/04/15/blender-python-scripting-task-automation/#comments</comments>
		<pubDate>Mon, 15 Apr 2013 13:00:15 +0000</pubDate>
		<dc:creator>Jonathan Williamson</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[blender python api]]></category>
		<category><![CDATA[bpy]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[python api]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=48762</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/04/blender_scripting_task-automation-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_scripting_task-automation" /></div>Learn how to automate tasks in ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/04/blender_scripting_task-automation-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_scripting_task-automation" /></div><h2>Learn how to automate tasks in Blender with <a title="See more scripting tutorials" href="http://cgcookie.com/blender/tag/scripting" target="_blank">Python scripting</a></h2>
<p>There are lots of things we do over and over again in a normal workflow. It might be that you need to add and apply a modifier to a hundred objects, or change the display traits of many objects, or any other repetitive task. These things add up quickly and increase the time it takes to finish our project. Luckily for us <a href="http://blender.org" target="_blank">Blender</a> has a complete <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python" target="_blank">Python API</a>  that allows us to access most of Blender&#8217;s tools and settings via scripting.</p>
<p>Python scripting in Blender is straight forward and relatively easy to learn but it can be very confusing if you don&#8217;t know where to start. In this tutorial I will take you through the process of writing a very simple script that allows you automate adding and applying Subsurf modifiers to all your selected objects.</p>
<p>The techniques you&#8217;ll learn in this tutorial can be applied to many, many different tasks in Blender. I am only scratching the surface of Python scripting in Blender in this tutorial.</p>
<h3> What you&#8217;ll learn:</h3>
<p>Below you can see the final script that you&#8217;ll be learning how to write. I&#8217;ll be showing you how to write it and what each part is.</p><pre class="crayon-plain-tag">import bpy

scene = bpy.context.scene
selected = bpy.context.selected_objects
object = bpy.ops.object

for obj in selected:
    scene.objects.active = obj

    object.modifier_add(type="SUBSURF")

    for mod in obj.modifiers:
        if mod.type == "SUBSURF":
            bpy.context.object.modifiers[mod.name].levels = 2
            object.modifier_apply(apply_as="DATA", modifier=mod.name)</pre><p></p>
<h3></h3>
<h3>Find more scripts</h3>
<p>You can check out more scripts from the <a title="The CG Cookie Crew" href="http://cgcookie.com/team/" target="_blank">CG Cookie Crew</a> via our GitHub repository: <a title="See all of CG Cookie's scripts" href="https://github.com/CGCookie/script-bakery" target="_blank">https://github.com/CGCookie/script-bakery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2013/04/15/blender-python-scripting-task-automation/feed/</wfw:commentRss>
		<slash:comments>68</slash:comments>
		</item>
		<item>
		<title>Modeling a Sci-fi Vehicle</title>
		<link>http://cgcookie.com/blender/cgc-series/modeling-sci-fi-vehicle/</link>
		<comments>http://cgcookie.com/blender/cgc-series/modeling-sci-fi-vehicle/#comments</comments>
		<pubDate>Thu, 11 Apr 2013 13:00:48 +0000</pubDate>
		<dc:creator>Jonathan Williamson</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Citizen Tutorial]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[cgc-featured]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[Jonathan Williamson]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[sci-fi]]></category>
		<category><![CDATA[scifi]]></category>
		<category><![CDATA[vehicle]]></category>
		<category><![CDATA[Vehicle Modeling]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?post_type=cgc_series&#038;p=48114</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_956x400-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="vehicle_sci-fi_gyrocopter_956x400" /></div>Vehicle Modeling Course in Blender
The Vehicle ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_956x400-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="vehicle_sci-fi_gyrocopter_956x400" /></div><h2>Vehicle Modeling Course in Blender</h2>
<p>The Vehicle Modeling DVD was released in the first quarter of 2011, after the <a href="http://cgcookie.com/blender/cgc-series/2010-blender-training-introduction-blender/" target="_blank">Intro to Blender</a> and <a href="http://cgcookie.com/blender/cgc-series/2010-blender-training-series-intro-character-modeling/" target="_blank">Character modeling series</a>. It was our first physical DVD ever shipped and has shipped more than any other training DVD we&#8217;ve ever produced. However, now that the series has reached the ripe age of 2 years, it is being inducted into the <a href="http://cgcookie.com/membership/" target="_blank">CG Cookie Citizen</a> library, making it accessible to all Citizen members.</p>
</p>
<blockquote>
<h2 style="text-align: center;">Trade the value of a couple lattes for complete access to our <a title="Join Citizen" href="http://cgcookie.com/membership" target="_blank">Citizen training</a> library</h2>
</blockquote>
<p>
<h2>What you&#8217;ll learn</h2>
<p>In this intensive, mesh modeling training series, you will be taken through the complete process of modeling a very detailed, sci-fi vehicle in Blender. The series makes use of modeling sheets and concept art by <a href="http://davidrevoy.com/">David Revoy</a>. This series is presented in such a way to be ideal for all levels of users. Each tool used is explained along the way for new users but the topics presented will intrigue even the most advanced modelers. Throughout this series you will learn extensive modeling techniques, mesh topology, and workflows for creating a manageable model in relatively little time.</p>
<h4 style="text-align: center;">Beauty renders of the final model</h4>
<h2><a href="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_03.png"><img class="alignleft  wp-image-48505" alt="vehicle_sci-fi_gyrocopter_03" src="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_03.png" width="256" height="144" /></a> <a href="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_detail_01.png"><img class="alignleft  wp-image-48506" alt="vehicle_sci-fi_gyrocopter_detail_01" src="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_detail_01.png" width="256" height="144" /></a> <a href="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_top_01.png"><img class="alignleft  wp-image-48507" alt="vehicle_sci-fi_gyrocopter_top_01" src="http://cgcookie.com/blender/files/2013/04/vehicle_sci-fi_gyrocopter_top_01.png" width="256" height="144" /></a></h2>
<h2></h2>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Included in the download</h2>
<p>The source files for this series contain the original concept art and modeling sheets by <a href="http://davidrevoy.com/" target="_blank">David Revoy</a>, a video breakdown form David himself showing how the concept came together, and all the .blend files for the final model.</p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/cgc-series/modeling-sci-fi-vehicle/feed/</wfw:commentRss>
		<slash:comments>90</slash:comments>
		</item>
		<item>
		<title>TIP:  Using the F2 Add-on</title>
		<link>http://cgcookie.com/blender/2013/03/19/tip-using-the-f2-add-on/</link>
		<comments>http://cgcookie.com/blender/2013/03/19/tip-using-the-f2-add-on/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 13:10:33 +0000</pubDate>
		<dc:creator>Kent Trammell</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[polygon modeling]]></category>
		<category><![CDATA[retopology]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[topology]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=46981</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/03/blender_tip_f2-feature-649x245.jpg" class="attachment-post-thumbnail wp-post-image" alt="blender_tip_f2-feature" /></div>Embrace the Power of F2
In this ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/03/blender_tip_f2-feature-649x245.jpg" class="attachment-post-thumbnail wp-post-image" alt="blender_tip_f2-feature" /></div><h1>Embrace the Power of F2</h1>
<p>In this quick tip you will learn how to enable and use the <a title="F2 Home Page" href="https://sites.google.com/site/bartiuscrouch/scripts/f2">F2 addon</a> by Crouch. F2 is an extension of the F-key <a title="Blender Wiki: Make Faces" href="http://wiki.blender.org/index.php/Doc:2.6/Manual/Modeling/Meshes/Editing/Faces">fill-faces</a> function for mesh editing.  Its purpose is to increases workflow efficiency and user friendliness when it comes to filling holes in polygonal meshes.</p>
<p>For any Blender modelers out there, I think you will evaluate F2 as a brilliant tool that belongs in your workflow!</p>
<p>Additional information can be found on the <a title="F2 blender artists thread" href="http://blenderartists.org/forum/showthread.php?278787-F2">Blender Artists thread</a>.</p>
<p>MUSIC:  <a title="Music Credit" href="http://ccmixter.org/files/VJ_Memes/33703">&#8220;In Peace&#8221; by Jeris</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2013/03/19/tip-using-the-f2-add-on/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>Introduction to Hard Surface Modeling in Blender</title>
		<link>http://cgcookie.com/blender/cgc-series/introduction-hard-surface-modeling-blender/</link>
		<comments>http://cgcookie.com/blender/cgc-series/introduction-hard-surface-modeling-blender/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 16:07:58 +0000</pubDate>
		<dc:creator>Jonathan Williamson</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Citizen Tutorial]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[airplane]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[box modeling]]></category>
		<category><![CDATA[edge modeling]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[hard surface]]></category>
		<category><![CDATA[Jonathan Williamson]]></category>
		<category><![CDATA[mesh]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[plane]]></category>
		<category><![CDATA[subdivision surfaces]]></category>
		<category><![CDATA[subsurf]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?post_type=cgc_series&#038;p=46713</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/03/intro_hard-surface-modeling_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="intro_hard-surface-modeling_feature" /></div>Model hard-surface objects with smooth curves ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/03/intro_hard-surface-modeling_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="intro_hard-surface-modeling_feature" /></div><h2>Model hard-surface objects with smooth curves and sharp details in Blender</h2>
<p>Hello and welcome to this CG Cookie tutorial series on hard-surface modeling in Blender. Through this series I&#8217;ll be giving you a complete introduction to modeling <a title="See all of our hard-surface tutorials" href="http://cgcookie.com/blender/tag/hard-surface" target="_blank">hard-surface</a> objects with subdivision surfaces, allowing you to create anything from vehicles, to weapons, to environment props.</p>
</p>
<blockquote><p>Learn what you need to know to create all kinds of hard-surface objects by <a title="Join Citizen for just 10$/month" href="http://cgcookie.com/membership" target="_blank">joining Citizen</a>, unlocking the complete series.</p></blockquote>
<p>
<p>In this series I&#8217;ve chosen a small, stylized airplane as the subject matter, as it provides a great example of hard-surfaces that is fairly simple but also easy to learn. The plane design is based on artwork and modeling sheets created by <a title="View Tim's tutorials on Concept Cookie" href="http://cgcookie.com/concept/author/timvonrueden/" target="_blank">Tim Von Rueden</a> at <a title="Concept art tutorials and resources" href="http://cgcookie.com/concept" target="_blank">Concept Cookie</a>. I&#8217;ll be walking you through the complete modeling process of creating this plane, demonstrating a variety of techniques and tools along the way. Among other things, I&#8217;ll be showing you <a title="Box modeling tutorials" href="http://cgcookie.com/tag/blender/box-modeling/" target="_blank">box</a> and <a title="Edge modeling tutorials" href="http://cgcookie.com/tag/blender/edge-modeling" target="_blank">edge</a> modeling techniques, I&#8217;ll show you how to use various modifiers for non-destructive modeling, and I&#8217;ll take you through multiple techniques for creating sharp edges with optimal geometry. This series is presented in real-time, giving you a complete picture of of my modeling process.</p>
<h3>Extra add-ons and themes</h3>
<p>During this series I make frequent use of a custom add-on I developed that helps to speed up the workflow for common tasks. You can download the add-on, along with the custom them I use for Blender&#8217;s interface below:</p>
<p><strong>Jay Tools: </strong><a title="Download the Jay Tools add-on for Blender" href="http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/jaytools" target="_blank">http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/jaytools</a></p>
<p><strong>CG Cookie Theme: </strong><a title="Download the CG Cookie theme for Blender" href="https://github.com/CGCookie/script-bakery/blob/master/scripts/presets/interface_theme/cgcookie.xml" target="_blank">https://github.com/CGCookie/script-bakery/blob/master/scripts/presets/interface_theme/cgcookie.xml</a></p>
<p>Background Audio used: <a href="http://ccmixter.org/files/airtone/33469" target="_blank">http://ccmixter.org/files/airtone/33469</a> by Airtone</p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/cgc-series/introduction-hard-surface-modeling-blender/feed/</wfw:commentRss>
		<slash:comments>187</slash:comments>
		</item>
		<item>
		<title>Blender Basics &#8211; Introduction for Beginners</title>
		<link>http://cgcookie.com/blender/cgc-series/blender-basics-introduction-beginners/</link>
		<comments>http://cgcookie.com/blender/cgc-series/blender-basics-introduction-beginners/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 18:23:28 +0000</pubDate>
		<dc:creator>Jonathan Williamson</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Cycles]]></category>
		<category><![CDATA[Interface]]></category>
		<category><![CDATA[Lighting]]></category>
		<category><![CDATA[Materials and Shading]]></category>
		<category><![CDATA[Modeling]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[customization]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[shading]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?post_type=cgc_series&#038;p=46304</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/03/blender_intro-blender_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_intro-blender_feature" /></div>Get Started with the Basics of ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/03/blender_intro-blender_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_intro-blender_feature" /></div><h2>Get Started with the Basics of Blender</h2>
<p>If you&#8217;re new to <a title="Download Blender" href="http://blender.org" target="_blank">Blender</a> then you&#8217;re in the right place! Through this series I&#8217;m going to introduce you to the key basics of Blender, helping you get started with all the fundamentals that you need to begin working in Blender. This series is intended primarily for beginners that have a basic understanding of 3D.</p>
<p>I will be giving you a tour of the interface and navigation, modeling, animation, shading, lighting, and rendering with Cycles.</p>
<h2>Where to go next with Blender and tutorials?</h2>
<p>If you&#8217;ve completed this tutorial series and are eager for more training then here&#8217;s a few hand-picked tutorials just for you! To get the most value I encourage you to join our <a title="Invest in yourself by joining Citizen" href="http://cgcookie.com/membership" target="_blank">Citizen membership</a> to get access to our complete tutorial library, including many exclusive training series that goes more in depth and cover challenging topics, like <a title="Introduction to Interior Architectural Visualization" href="http://cgcookie.com/blender/cgc-series/interior-3d-architectural-visualization/" target="_blank">architectural visualization</a> and and <a title="Create low poly assets for the Unity game engine" href="http://cgcookie.com/blender/cgc-series/low-poly-game-asset-creation-fire-hydrant-blender-unity-3d/" target="_blank">low poly asset creation</a>.</p>
<p><strong>Modeling:</strong> <em><a title="Learn how to model a shipping container" href="http://cgcookie.com/blender/series/shipping-container-2/" target="_blank">Modeling a Shipping Container</a> </em>and <a title="Model a highly detailed assault rifle in Blender" href="http://cgcookie.com/blender/cgc-series/weapon-modeling-an-m4/" target="_blank"><em>Modeling an M4 Assault Rifle</em></a></p>
<p><strong>Animation: </strong><em><a title="Learn how to rig characters for animation" href="http://cgcookie.com/blender/2011/12/12/blender-introduction-to-character-rigging/" target="_blank">Intro to Character Rigging</a> </em>and <a title="Learn complete character animation in Blender" href="http://cgcookie.com/blender/cgc-series/character-course-animating-a-character/" target="_blank"><em>Baker Charactering Animation Series</em></a></p>
<p><strong>Physics and Dynamics: </strong><em><a title="Shatter a coffee cup and send fluids flying with simulations" href="http://cgcookie.com/blender/series/breaking-objects-with-the-cell-fracture-add-on/" target="_blank">Shattering a Coffee Cup</a> </em>and <a title="Simulate and render incredible fire in Blender" href="http://cgcookie.com/blender/coming-soon/fire-simulation-blender/" target="_blank"><em>Simulating and Rendering Fire</em></a></p>
<p><strong>Texturing:</strong> <em><a title="Texture a heavy-duty truck wheel and render it in Cycles" href="http://cgcookie.com/blender/2011/11/04/exclusive-rendering-a-semi-realistic-wheel-in-cycles/" target="_blank">Texturing a Truck Wheel and Rendering in Cycles</a> </em>and <em><a title="Learn the basics of using textures in Cycles" href="http://cgcookie.com/blender/2012/02/29/introduction-texturing-cycles-in-blender/" target="_blank">Introduction to Texturing in Cycles</a></em></p>
<p><strong>Shading, Lighting, and Rendering: </strong><em><a title="Render realistic headphones in Blender with Cycles " href="http://cgcookie.com/blender/2012/03/21/rendering-headphones-blender-cycles/" target="_blank">Rendering Realistic Headphones in Cycles</a> </em>and <a title="Create Stunning Long Hair Styles in Blender" href="http://cgcookie.com/blender/cgc-series/creating-long-hair-blender-cycles/" target="_blank"><em>Rendering Stunning Long Hair in Blender</em></a></p>
<p><strong>Compositing: </strong><em><a title="Learn the basics of compositing" href="http://cgcookie.com/blender/series/introduction-to-compositing/" target="_blank">Introduction to Compositing</a> </em>and <a title="Composite Cycle's render passes" href="http://cgcookie.com/blender/2012/12/10/compositing-cycles-render-passes-blender/" target="_blank"><i>Compositing Cycles Render Passes</i></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/cgc-series/blender-basics-introduction-beginners/feed/</wfw:commentRss>
		<slash:comments>117</slash:comments>
		</item>
		<item>
		<title>Introduction to OSL in Blender Cycles &#8211; part 03</title>
		<link>http://cgcookie.com/blender/2013/01/28/introduction-to-osl-in-blender-cycles-part-03/</link>
		<comments>http://cgcookie.com/blender/2013/01/28/introduction-to-osl-in-blender-cycles-part-03/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 17:00:23 +0000</pubDate>
		<dc:creator>Gottfried Hofmann</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Cycles]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[blender diplom]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[cycles]]></category>
		<category><![CDATA[gottfried hoffman]]></category>
		<category><![CDATA[open shading language]]></category>
		<category><![CDATA[osl]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[shader]]></category>
		<category><![CDATA[shader scripting]]></category>
		<category><![CDATA[shaders]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=43662</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/01/blender_cycles_osl-intro_03_feature-649x245.jpg" class="attachment-post-thumbnail wp-post-image" alt="blender_cycles_osl-intro_03_feature" /></div>Learn the basics of OSL scripting ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/01/blender_cycles_osl-intro_03_feature-649x245.jpg" class="attachment-post-thumbnail wp-post-image" alt="blender_cycles_osl-intro_03_feature" /></div><h3><strong>Learn the basics of OSL scripting in Blender to create your own Cycles shaders </strong></h3>
<p>One of the big new features of Blender 2.65 is the inclusion of the <a href="http://code.google.com/p/openshadinglanguage/" target="_blank">Open Shading Language</a> (OSL) for the Cycles render engine. OSL has been developed by <a href="http://www.imageworks.com/">Sony Pictures Imageworks</a> as a shading language for modern path-tracing render engines like Arnold or Cycles. The testbed for OSL, until now, has been a special version of the <a href="http://www.solidangle.com/" target="_blank">Arnold</a> render engine used on the films <em>The Amazing Spiderman</em>, <em>Men in Black 3</em>, and <em>Hotel Transylvania</em>.</p>
<p>With <a href="http://www.blender.org/development/release-logs/blender-265/" target="_blank">Blender 2.65</a>, Cycles has become the first publicly available render engine to <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/OSL" target="_blank">support OSL</a>.</p>
<p>&nbsp;</p>
<blockquote>
<h4>Like this tutorial and want more? Consider joining <a href="http://cgcookie.com/membership" target="_blank">Citizen</a> for just <a href="http://cgcookie.com/membership" target="_blank">$10 USD / month</a> to support the site and get a PDF version of this tutorial</h4>
</blockquote>
<h3></h3>
<h3><b>Introduction to OSL in Blender 2.65 &#8211; Part 3 &#8211; Integrating the Pie</b></h3>
<p>This third installment of the Blender Cookie OSL introduction explains the internals of the Pie texture and how to improve the integration into the Cycles node system.</p>
<p>Basically an OSL shader (just like GLSL shaders and Renderman shaders) evaluates a point on a surface. The point is defined by a ray hitting the surface. It then performs a mathematical calculation on a property, like in our case the color. Consider a simple plane with object coordinates:</p>
<p style="text-align: center;"><img class="aligncenter  wp-image-43663" alt="01_explanation" src="http://cgcookie.com/blender/files/2013/01/01_explanation.png" width="656" height="495" /></p>
<p>This is why you need texture coordinates to start a procedural texture. The shader needs to know relative to where to run the computation. The cool thing is that the shader is working like it&#8217;s doing the computations for all points simultaneously thus it works like some kind of 2D plotter. That essentially means you can use a large pool of mathematical functions to create patterns using OSL. A good tool to preview many of those functions is the Blender add-on <i>3D Function Surfaces</i>: <a href="http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Add_3d_Function_Surface">http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Add_3d_Function_Surface</a></p>
<p>But there is another implication. Remember how we left the turbulence-part out of the function for the final pattern? There was a good reason for this. We simply don&#8217;t need to calculate any kind of turbulence inside the shader when there is a vast variety of turbulence patterns right at our fingertips in Cycles. For example, the noise texture. If you use an external texture instead of a turbulence function from inside the shader for each point, the shader will look at the value of the external texture at that point and use it for the computation. So let&#8217;s remove one of the turbulence inputs, rename the other one to simply “Noise”. This way the user of the shader knows that they have to plug some kind of noise texture into that slot. Next, add the turb-part back to the output line:</p><pre class="crayon-plain-tag">#include "stdosl.h" 

shader node_Pie(

int Slices = 4,

float Hardness = 1,

float Angle = 0,

float Noise = 0,

point TextureVector = P,

output color Texture = 0

)

{

float angle_intern = 0;

    angle_intern = atan2(TextureVector[0],TextureVector[1]) + Angle*3.1415926/180.0;

    Texture = 0.5-0.5*sin(angle_intern * Slices - Noise - 0.5);

}</pre><p></p>
<p style="text-align: center;"><img class="aligncenter" alt="02_noise_normal" src="http://cgcookie.com/blender/files/2013/01/02_noise_normal.png" width="660" height="481" /></p>
<p>You can make the effect even stronger by adding a math node set to multiply:</p>
<p><img class="aligncenter" alt="03_noise_exaggerated" src="http://cgcookie.com/blender/files/2013/01/03_noise_exaggerated.png" width="660" height="490" /></p>
<p>Or change the appearance completely by using a different noise texture as input:</p>
<p><img class="aligncenter" alt="04_noise_voronoi" src="http://cgcookie.com/blender/files/2013/01/04_noise_voronoi.png" width="660" height="491" /></p>
<p>As you can see, OSL isn&#8217;t just making the writing of new shaders and textures easier, the fact that it is completely fit for data propagation through nodes is also making things a lot more versatile!</p>
<p>As a final brush-up, let&#8217;s remove the “Hardness” Input and the “– 0.5” at the end of the final line. The latter is simply rotating the pattern a little and not really needed:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_Pie(

int Slices = 4,

float Angle = 0,

float Noise = 0,

point TextureVector = P,

output color Texture = 0

)

{

float angle_intern = 0;

    angle_intern = atan2(TextureVector[0],TextureVector[1]) + Angle*3.1415926/180.0;

    Texture = 0.5-0.5*sin(angle_intern * Slices - Noise);

}</pre><p>&nbsp;</p>
<p>As a conclusion to this chapter for the Blender Cookie OSL Introduction here’s a comparison between the two textures in Blender Internal and OSL:</p>
<p><strong>Lines of code for Blender Internal</strong>: 98</p>
<p><strong>Lines of code for OSL</strong>: 15</p>
<p>&nbsp;</p>
<p>Because OSL makes writing shaders really easy, we can expect a wealth of new shaders ported to OSL in the near future. Great times ahead for the Blender community!</p>
<p>There are literally thousands of shaders out there written in different shading languages that are just waiting to be ported to OSL. If you have a GLSL shader at hand and want to port it to OSL I recommend this short video tutorial by Thomas Dinges: <a href="http://www.openshading.com/tutorial-2-glsl-to-osl/">http://www.openshading.com/tutorial-2-glsl-to-osl/</a></p>
<p>A nice resource of Renderman shaders that you can try to port to OSL can be found at <a href="http://www.renderman.org/RMR/RMRShaders.html">http://www.renderman.org/RMR/RMRShaders.html</a></p>
<h4></h4>
<h4>Additional OSL resources:</h4>
<ul>
<li>OSL Introduction: <a href="http://code.google.com/p/openshadinglanguage/wiki/OSL_Introduction">http://code.google.com/p/openshadinglanguage/wiki/OSL_Introduction</a></li>
<li>OSL Language Specification: <a href="https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf">https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf</a></li>
<li>Tutorials and Links to example Shaders: <a href="http://www.openshading.com/">http://www.openshading.com/</a></li>
<li>Siggraph 2012 OSL Workshop Slides: <a href="http://blog.selfshadow.com/publications/s2012-shading-course/">http://blog.selfshadow.com/publications/s2012-shading-course/</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2013/01/28/introduction-to-osl-in-blender-cycles-part-03/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<series:name><![CDATA[Introduction to OSL in Cycles]]></series:name>
	</item>
		<item>
		<title>Introduction to OSL in Blender Cycles &#8211; part 02</title>
		<link>http://cgcookie.com/blender/2013/01/03/introduction-osl-blender-cycles-part-02/</link>
		<comments>http://cgcookie.com/blender/2013/01/03/introduction-osl-blender-cycles-part-02/#comments</comments>
		<pubDate>Thu, 03 Jan 2013 20:49:13 +0000</pubDate>
		<dc:creator>Gottfried Hofmann</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Cycles]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[blender diplom]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[cycles]]></category>
		<category><![CDATA[gottfried hoffman]]></category>
		<category><![CDATA[open shading language]]></category>
		<category><![CDATA[osl]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[shader]]></category>
		<category><![CDATA[shader scripting]]></category>
		<category><![CDATA[shaders]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=41786</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/01/blender_cycles_osl-intro_02_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_cycles_osl-intro_02_feature" /></div>Learn the basics of OSL scripting ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2013/01/blender_cycles_osl-intro_02_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_cycles_osl-intro_02_feature" /></div><h3><strong>Learn the basics of OSL scripting in Blender to create your own Cycles shaders </strong></h3>
<p>One of the big new features of Blender 2.65 is the inclusion of the <a href="http://code.google.com/p/openshadinglanguage/" target="_blank">Open Shading Language</a> (OSL) for the Cycles render engine. OSL has been developed by <a href="http://www.imageworks.com/">Sony Pictures Imageworks</a> as a shading language for modern path-tracing render engines like Arnold or Cycles. The testbed for OSL, until now, has been a special version of the <a href="http://www.solidangle.com/" target="_blank">Arnold</a> render engine used on the films <em>The Amazing Spiderman</em>, <em>Men in Black 3</em>, and <em>Hotel Transylvania</em>.</p>
<p>With <a href="http://www.blender.org/development/release-logs/blender-265/" target="_blank">Blender 2.65</a>, Cycles has become the first publicly available render engine to <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/OSL" target="_blank">support OSL</a>. This has two implications:</p>
<ol>
<ol>
<li>There are not many code examples and ready-to-use shaders yet.</li>
<li>Easy sharing of shaders between different render engines is not working yet, but there are other render engines that plan to support OSL in the near future.</li>
</ol>
</ol>
<blockquote>
<h4>Like this tutorial and want more? Consider joining <a href="http://cgcookie.com/membership" target="_blank">Citizen</a> for just <a href="http://cgcookie.com/membership" target="_blank">$10 USD / month</a> to support the site and get a PDF version of this tutorial</h4>
</blockquote>
<h3></h3>
<h3><b>Introduction to OSL in Blender 2.65 &#8211; Part 2 &#8211; Procedural Textures</b></h3>
<p>This second installment of the Blender Cookie OSL introduction will focus on one aspect where OSL is really powerful – the creation of procedural textures!</p>
<p>Even though the Blender Internal renderer has a decent amount of procedural textures built-in, there still is a plugin system that allows programmers to write procedural textures for it. Yet, there are not very many available. A few of these can be found at <a href="http://www-users.cs.umn.edu/~mein/blender/plugins/texture.html">http://www-users.cs.umn.edu/~mein/blender/plugins/texture.html</a></p>
<p>Go there and take a look at the Pie texture plugin. The source for it can be found at <a href="http://www-users.cs.umn.edu/~mein/blender/plugins/texture/pie/pie.c">http://www-users.cs.umn.edu/~mein/blender/plugins/texture/pie/pie.c</a></p>
<p>Download it and open it with your favorite text editor. Don&#8217;t be scared by the amount of code – we&#8217;ll need only a fraction of it in order to port the texture to OSL.</p>
<p><strong> The following shows the important lines highlighted in <span style="color: #800000;">red</span> and <span style="color: #008000;">green</span>:</strong></p>
<p style="padding-left: 30px;">/* Copy lefted.</p>
<p style="padding-left: 30px;">* Blablabla for the lawyers</p>
<p style="padding-left: 30px;">* /</p>
<p style="padding-left: 30px;">#include &#8220;math.h&#8221;</p>
<p style="padding-left: 30px;">#include &#8220;plugin.h&#8221;</p>
<p style="padding-left: 30px;">#define NR_TYPES 1</p>
<p style="padding-left: 30px;">float result[8];</p>
<p style="padding-left: 30px;">float cfra;</p>
<p style="padding-left: 30px;">int do_reset = FALSE;</p>
<p style="padding-left: 30px;">extern float hnoise(float noisesize, float x, float y, float z);</p>
<p style="padding-left: 30px;">/* set up plugin menu */</p>
<p style="padding-left: 30px;">char name[]= &#8220;Pie&#8221;;</p>
<p style="padding-left: 30px;">char stnames[NR_TYPES][16]= {&#8220;Pie&#8221;};</p>
<p style="padding-left: 30px;">VarStruct varstr[]= {</p>
<p style="padding-left: 30px;">/* type, name, default,min,   max, tooltips */</p>
<p style="padding-left: 30px;">{ LABEL, &#8220;&#8221;, 0, 0, 0, &#8220;&#8221;},</p>
<p style="padding-left: 30px;"><span style="color: #800000;">{ NUM|INT, &#8220;divs &#8220;, 6.0, 2.0, 1000.0,</span></p>
<p style="padding-left: 30px;">&#8220;Pie plugin: Number of slices&#8221;},</p>
<p style="padding-left: 30px;">/* Number of slices */</p>
<p style="padding-left: 30px;"><span style="color: #800000;">{ NUM|FLO, &#8220;hardness &#8220;, 1.0, 0.0, 5.0,</span></p>
<p style="padding-left: 30px;">&#8220;Pie plugin: Falloff Hardness&#8221;},</p>
<p style="padding-left: 30px;">/* determins sharpnes of edge, could use some work */</p>
<p style="padding-left: 30px;"><span style="color: #800000;">{ NUM|FLO, &#8220;ang ofs &#8220;, 0.0, -180.0, 180.0,</span></p>
<p style="padding-left: 30px;">&#8220;Pie plugin: Angle offset &#8220;},</p>
<p style="padding-left: 30px;">/* phase angle */</p>
<p style="padding-left: 30px;"><span style="color: #800000;">{ NUM|FLO,    &#8220;turb dep &#8220;,0.0,    -5.0, 5.0,</span></p>
<p style="padding-left: 30px;">&#8220;Pie plugin: Turbulance depth&#8221;},</p>
<p style="padding-left: 30px;">/* Pos. Turb affects &#8216;white&#8217;, Neg. affects &#8216;black&#8217; */</p>
<p style="padding-left: 30px;"><span style="color: #800000;">{ NUM|FLO, &#8220;turb siz &#8220;,0.25, 0.0, 2.0,</span></p>
<p style="padding-left: 30px;">&#8220;Pie plugin: Turbulance size&#8221;}</p>
<p style="padding-left: 30px;">};</p>
<p style="padding-left: 30px;">typedef struct Cast {</p>
<p style="padding-left: 30px;">float dum1;</p>
<p style="padding-left: 30px;">int div;</p>
<p style="padding-left: 30px;">float hard;</p>
<p style="padding-left: 30px;">float ang;</p>
<p style="padding-left: 30px;">float turbd;</p>
<p style="padding-left: 30px;">float turbs;</p>
<p style="padding-left: 30px;">} Cast;</p>
<p style="padding-left: 30px;">/* ******************************************************************* */</p>
<p style="padding-left: 30px;">int plugin_tex_doit(int, Cast*, float*, float*, float*);</p>
<p style="padding-left: 30px;">int plugin_tex_getversion(void)</p>
<p style="padding-left: 30px;">{</p>
<p style="padding-left: 30px;">return B_PLUGIN_VERSION;</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">void plugin_but_changed(int but)</p>
<p style="padding-left: 30px;">{</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">void plugin_init(void)</p>
<p style="padding-left: 30px;">{</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">void plugin_getinfo(PluginInfo *info)</p>
<p style="padding-left: 30px;">{</p>
<p style="padding-left: 30px;">info-&gt;name= name;</p>
<p style="padding-left: 30px;">info-&gt;stypes= NR_TYPES;</p>
<p style="padding-left: 30px;">info-&gt;nvars= sizeof(varstr)/sizeof(VarStruct);</p>
<p style="padding-left: 30px;">info-&gt;snames= stnames[0];</p>
<p style="padding-left: 30px;">info-&gt;result= result;</p>
<p style="padding-left: 30px;">info-&gt;cfra= &amp;cfra;</p>
<p style="padding-left: 30px;">info-&gt;varstr= varstr;</p>
<p style="padding-left: 30px;">info-&gt;init= plugin_init;</p>
<p style="padding-left: 30px;">info-&gt;tex_doit=  (TexDoit) plugin_tex_doit;</p>
<p style="padding-left: 30px;">info-&gt;callback= plugin_but_changed;</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;"><span style="color: #008000;">int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt)</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">{</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">float angle, turb=0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">angle = atan2(texvec[0],texvec[1]) + cast-&gt;ang*3.1415926/180.0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">if ( cast-&gt;turbd !=0.0 )  {     /* save time if no turb */</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">turb = cast-&gt;turbd * hnoise(cast-&gt;turbs,texvec[0],texvec[1], texvec[2]);</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">/*printf(&#8220;turb: %f\n&#8221;,turb);*/</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">}</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">result[0]= 0.5 &#8211; 0.5*sin(angle * cast-&gt;div &#8211; turb &#8211; 0.5);</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">if (cast-&gt;hard !=1) result[0]= pow(result[0], cast-&gt;hard);  /*Very slow, better way?*/</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">if (result[0] &gt; 1) result[0] = 1.0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">else if (result[0]&lt;0) result[0]=0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">result[4]= 1.0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">return 0;</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">}</span></p>
<p> <span style="color: #800000;">Red</span> denotes input variables, <span style="color: #800000;">green</span> are the parts where the actual calculations take place. The rest is more or less stuff that is specific to Blender Internal that we will skip, since we’re using Cycles. We can also skip some of the highlighted stuff as it can be “outsourced” to other nodes in Cycles. So let&#8217;s start by creating a very simplified version of the above Pie plugin in OSL.</p>
<p>Let&#8217;s start by adding all the inputs to our OSL script, no matter if we use them later on or not. We can still remove or comment out inputs later on:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_Pie(

int Slices = 4,

float Hardness = 1,

float Angle = 0,

float TurbDepth = 0,

float TurbSize = 0.25,

output color Texture = 0

)

{

}</pre><p><a href="http://cgcookie.com/blender/files/2013/01/01_inputs.png"><img class="aligncenter size-full wp-image-41797" alt="01_inputs" src="http://cgcookie.com/blender/files/2013/01/01_inputs.png" width="636" height="230" /></a> <a href="http://cgcookie.com/blender/files/2013/01/02_angle.png"><br />
</a> <a href="http://cgcookie.com/blender/files/2013/01/03_interim.png"><br />
</a> <a href="http://cgcookie.com/blender/files/2013/01/04_setup.png"><br />
</a></p>
<p><b>Note</b>:<i> this part looks simpler in OSL because Blender does not support Metadata yet. In later versions we&#8217;ll be able to add tooltips and Min/Max-ranges to the inputs. For now all we can define are some sockets. But that is enough for our purpose.</i></p>
<p>Now let&#8217;s have a look where all those inputs in the original code are going to. Fortunately the author of the code has used meaningful variables, as you can see in the green part at the line starting with “if (cast-&gt;hard !=1)”.</p>
<p style="padding-left: 30px;"><span style="color: #008000;">if ( cast-&gt;turbd !=0.0 )  {     /* save time if no turb */</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">turb = cast-&gt;turbd * hnoise(cast-&gt;turbs,texvec[0],texvec[1], texvec[2]);</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;">/*printf(&#8220;turb: %f\n&#8221;,turb);*/</span></p>
<p style="padding-left: 30px;"><span style="color: #008000;"> </span></p>
<p>So you can already guess from the names which variable is which. The actual way the input variables are taking is through the struct<strong> {}</strong>, which maps the input variables to variables named slightly different. Then the struct is used to call the actual function that is denoted by “doit”. Fortunately we don&#8217;t need all of this in OSL, we can access the values of the input variables directly.</p>
<p>Let&#8217;s have another look at the first green line:</p>
<p style="padding-left: 30px;"><span style="color: #008000;">int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt)</span></p>
<p>&nbsp;</p>
<p>The function does not only get the inputs which are all combined in the &#8220;*cast&#8221; but also a texture vector. In Blender Internal this was set through the mapping of the texture, in Cycles it&#8217;s another input vector. So let&#8217;s complete the inputs by adding another line:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_Pie(

int Slices = 4,

float Hardness = 1,

float Angle = 0,

float TurbDepth = 0,

float TurbSize = 0.25,

point TextureVector = P,

output color Texture = 0

)

{

}</pre><p>Now for the first green line. It defines two variables that are used only in the computation but not as an input. Let&#8217;s start by adding the angle and not care about the turbulence at the moment. Since we already use a variable &#8216;Angle&#8217;, let&#8217;s call the one that is used only for computation purposes &#8216;angle_intern&#8217;:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_Pie(

int Slices = 4,

float Hardness = 1,

float Angle = 0,

float TurbDepth = 0,

float TurbSize = 0.25,

point TextureVector = P,

output color Texture = 0

)

{

float angle_intern = 0;

}</pre><p>Now for the first line of computation. This is a very important line because it is the only one where the texture vector is accessed, thus the only line where something is directly drawn. All the other lines are only manipulating what was drawn in the first line.</p>
<p>Translating it to our OSL version is simple. The variable &#8216;angle&#8217; in our case is called &#8216;angle_intern&#8217;. &#8216;Texvec&#8217; is called &#8216;TextureVector&#8217; (because it is nicer to read) and the &#8216;cast-&gt;ang&#8217; is simply our &#8216;Angle&#8217; input. The strange notation for the latter in the Blender Internal texture has to do with C and how certain kind of data is accessed there (pointers!). We don&#8217;t need to bother with that in OSL.</p>
<p>So add the following two lines to your script. The second line is just to output what was computed so we can see what&#8217;s going on in the viewport:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_Pie(

int Slices = 4,

float Hardness = 1,

float Angle = 0,

float TurbDepth = 0,

float TurbSize = 0.25,

point TextureVector = P,

output color Texture = 0

)

{

float angle_intern = 0;

    angle_intern = atan2(TextureVector[0],TextureVector[1]) + Angle*3.1415926/180.0;

    Texture = angle_intern;

}</pre><p></p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2013/01/02_angle.png"><img class="aligncenter" alt="02_angle" src="http://cgcookie.com/blender/files/2013/01/02_angle.png" width="664" height="413" /></a></p>
<p>If everything works correctly you will be able to manipulate the Angle-input and see the changes interactively.</p>
<p>Now let&#8217;s port just one(!) other line and we will have a texture that is already very versatile and fun to use. The next four lines are about adding noise distortion to the texture, so let&#8217;s skip that for now and see what the next line is doing. Some computations are done involving the number of slices and the noise that was create beforehand. If we remove the noise/turbulence from the computation we get:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_Pie(

int Slices = 4,

float Hardness = 1,

float Angle = 0,

float TurbDepth = 0,

float TurbSize = 0.25,

point TextureVector = P,

output color Texture = 0

)

{

float angle_intern = 0;

angle_intern = atan2(TextureVector[0],TextureVector[1]) + Angle*3.1415926/180.0;

    Texture = 0.5 - 0.5*sin(angle_intern * Slices - 0.5);

}</pre><p></p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2013/01/03_interim.png"><img class="aligncenter" alt="03_interim" src="http://cgcookie.com/blender/files/2013/01/03_interim.png" width="658" height="413" /></a></p>
<p>You can now change both the angle and the number of slices and change the texture coordinate input. If you want the texture to stick to the object use &#8216;Object&#8217; as input. You can then change the position of the center of the texture using a mapping node. To get sharper stripes you can use a color ramp node which of course can also be used to colorize the stripes:</p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2013/01/04_setup.png"><img class="aligncenter" alt="04_setup" src="http://cgcookie.com/blender/files/2013/01/04_setup.png" width="662" height="401" /></a></p>
<p>It looks like the hardness-setting is not needed at all. But what about the turbulence? The next part of the series will explain a little about the magic that is used to compute the texture and then based off this knowledge we are going to optimize the shader a little more towards usage in a Cycles node network.</p>
<p>Stay tuned for part 03!</p>
<h4>Links to OSL resources:</h4>
<ul>
<li>OSL Introduction: <a href="http://code.google.com/p/openshadinglanguage/wiki/OSL_Introduction">http://code.google.com/p/openshadinglanguage/wiki/OSL_Introduction</a></li>
<li>OSL Language Specification: <a href="https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf">https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf</a></li>
<li>Tutorials and Links to example Shaders: <a href="http://www.openshading.com/">http://www.openshading.com/</a></li>
<li>Siggraph 2012 OSL Workshop Slides: <a href="http://blog.selfshadow.com/publications/s2012-shading-course/">http://blog.selfshadow.com/publications/s2012-shading-course/</a></li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2013/01/03/introduction-osl-blender-cycles-part-02/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
	
		<series:name><![CDATA[Introduction to OSL in Cycles]]></series:name>
	</item>
		<item>
		<title>Introduction to OSL in Blender Cycles &#8211; part 01</title>
		<link>http://cgcookie.com/blender/2012/12/12/introduction-osl-blender-cycles-01/</link>
		<comments>http://cgcookie.com/blender/2012/12/12/introduction-osl-blender-cycles-01/#comments</comments>
		<pubDate>Wed, 12 Dec 2012 14:00:26 +0000</pubDate>
		<dc:creator>Gottfried Hofmann</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Cycles]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[blender diplom]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[cycles]]></category>
		<category><![CDATA[gottfried hoffman]]></category>
		<category><![CDATA[open shading language]]></category>
		<category><![CDATA[osl]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[shader]]></category>
		<category><![CDATA[shader scripting]]></category>
		<category><![CDATA[shaders]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=39980</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2012/12/blender_cycles_osl-intro_01_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_cycles_osl-intro_01_feature" /></div>Learn the basics of OSL scripting ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2012/12/blender_cycles_osl-intro_01_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="blender_cycles_osl-intro_01_feature" /></div><h3><strong>Learn the basics of OSL scripting in Blender to create your own Cycles shaders </strong></h3>
<p>One of the big new features of Blender 2.65 is the inclusion of the <a href="http://code.google.com/p/openshadinglanguage/" target="_blank">Open Shading Language</a> (OSL) for the Cycles render engine. OSL has been developed by <a href="http://www.imageworks.com/">Sony Pictures Imageworks</a> as a shading language for modern path-tracing render engines like Arnold or Cycles. The testbed for OSL, until now, has been a special version of the <a href="http://www.solidangle.com/" target="_blank">Arnold</a> render engine used on the films <em>The Amazing Spiderman</em>, <em>Men in Black 3</em>, and <em>Hotel Transylvania</em>.</p>
<p>With <a href="http://www.blender.org/development/release-logs/blender-265/" target="_blank">Blender 2.65</a>, Cycles has become the first publicly available render engine to <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/OSL" target="_blank">support OSL</a>. This has two implications:</p>
<ol>
<li>There are not many code examples and ready-to-use shaders yet.</li>
<li>Easy sharing of shaders between different render engines is not working yet, but there are other render engines that plan to support OSL in the near future.</li>
</ol>
<blockquote><p>To help support the site, and to receive a PDF version of this tutorial in the source files, consider joining <a href="http://cgcookie.com/membership" target="_blank">Citizen</a> for just $10 USD / month</p></blockquote>
<h4> <strong>So what&#8217;s OSL useful for, anyways?</strong></h4>
<p>If you are not interested in programming whatsoever, you might want to skip this article and just use OSL shaders others provide. But wait a little. If you have ever created a complex node setup in Cycles, you already did some programming. Visual programming, to be exact. With OSL, you can create the very same shaders you used node setups for, but in text form. Think of OSL as a different view on the Cycles node system that allows some additional operations.</p>
<h4><strong>Let&#8217;s start with the following example:</strong></h4>
<p>Consider you would like an Add Shader with factor inputs for both closures so you can tweak the result just like you can tweak the Add (Mix) Node in the Blender compositor.</p>
<p>Using the normal Cycles nodes, you would probably build something like this node-group:</p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2012/12/01_advancedadd_group.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-medium wp-image-39983" title="01_advancedadd_group" src="http://cgcookie.com/blender/files/2012/12/01_advancedadd_group-300x210.png" alt="A Cycles node group" width="300" height="210" /></a> <a href="http://cgcookie.com/blender/files/2012/12/02_advancedadd_group_exposed.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-medium wp-image-39984" title="02_advancedadd_group_exposed" src="http://cgcookie.com/blender/files/2012/12/02_advancedadd_group_exposed-300x111.png" alt="" width="300" height="111" /></a></p>
<p>Although this does what it is supposed to do, the setup is rather hackish. Instead, we may create a clean and simple implementation in OSL that will result in a single node, serving our purpose.</p>
<p>To use OSL in Cycles, you need to switch the Shading System to &#8216;Open Shading Language”. Beware that this will not run on the GPU but is CPU-only at the moment:<span style="text-align: center;"> </span></p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2012/12/03_shadingselect.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-full wp-image-39985" title="03_shadingselect" src="http://cgcookie.com/blender/files/2012/12/03_shadingselect.png" alt="" width="216" height="129" /></a></p>
<p>Now add a script node:<span style="text-align: center;"> </span></p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2012/12/04_script_script.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-full wp-image-39986" title="04_script_script" src="http://cgcookie.com/blender/files/2012/12/04_script_script.png" alt="" width="235" height="284" /></a></p>
<p>The script node has two buttons: Internal and external. By clicking on external you will be prompted to load a .OSL-file from disk. This is the way to go if you want to use script files provided by third parties. If you want to create OSL nodes from scratch then internal is the way to go. Internal allows you to select text blocks that are stored in the current .blend. To create a new text block simply open up the text editor in Blender and click on <strong>New</strong>. Give your text file a meaningful name, like <em>AdvancedAdd</em> and write or copy and paste the following lines:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_advancedAdd(

)

{

}</pre><p>Now you can select the text from the drop-down list of &#8216;Internal&#8217;. A message should appear &#8220;<em>OSL shader compilation succeeded</em>”. If it doesn&#8217;t, click on the refresh-icon.<span style="text-align: center;"> </span></p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2012/12/05_script_internal.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-medium wp-image-39987" title="05_script_internal" src="http://cgcookie.com/blender/files/2012/12/05_script_internal-300x142.png" alt="" width="300" height="142" /></a></p>
<p> Nothing has changed, but you successfully compiled your first OSL shader. What you have created is the foundation for every OSL shader, so it may be a good idea to save the file somewhere for later use.</p>
<p>The first line simply tells the shader to include a file called <em>stdosl.h</em> – which is included as an internal library file in Blender and is where most of the operations, closures and other stuff you might or might not be using is stored. In the future there might be other libraries you can include and use, but for now it&#8217;s only stdosl.h.</p>
<p>The next line actually defines the shader by giving it a name, followed by an open and closed bracket. Between these brackets is where you can define inputs and outputs. Let&#8217;s start by adding some inputs:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_advancedAdd(

float Fac1 = 0.5,

closure color Closure1 = 0,

float Fac2 = 0.5,

closure color Closure2 = 0

)

{

}</pre><p>Compiling this will leave you with four new inputs. Two of them are inputs for numbers and the other two are inputs for shaders. Notice that the names we gave them are reflected on the labels of the inputs.</p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2012/12/06_inputs.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-medium wp-image-39988" title="06_inputs" src="http://cgcookie.com/blender/files/2012/12/06_inputs-300x85.png" alt="" width="300" height="85" /></a></p>
<p>But this is still not of much use. To make this shader into something useful we need at least one output. Adding an output is as simple as putting the word &#8216;output&#8217; before the data type:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_advancedAdd(

float Fac1 = 0.5,

closure color Closure1 = 0,

float Fac2 = 0.5,

closure color Closure2 = 0,

output closure color Closure = 0

)

{

}</pre><p></p>
<p style="text-align: center;"> <a href="http://cgcookie.com/blender/files/2012/12/07_output.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-medium wp-image-39989" title="07_output" src="http://cgcookie.com/blender/files/2012/12/07_output-300x94.png" alt="" width="300" height="94" /></a></p>
<p>&nbsp;</p>
<p>Now we are finally ready to add the actual computation to the shader. It is a one-liner and consists of the name of the output variable/socket to which we assign the values of the two input shaders added together. Each individual input shader is also weighted with the value from the factor inputs:</p><pre class="crayon-plain-tag">#include "stdosl.h"

shader node_advancedAdd(

float Fac1 = 0.5,

closure color Closure1 = 0,

float Fac2 = 0.5,

closure color Closure2 = 0,

output closure color Closure = 0

)

{

Closure = Fac1*Closure1 + Fac2 * Closure2;

}</pre><p>That’s it! Your first OSL shader is complete. In the below image you can see the final result:</p>
<p style="text-align: center;"><a href="http://cgcookie.com/blender/files/2012/12/08_finished_shader.png" rel="prettyPhoto[OSL Intro]"><img class="aligncenter size-medium wp-image-39990" title="08_finished_shader" src="http://cgcookie.com/blender/files/2012/12/08_finished_shader-300x187.png" alt="" width="300" height="187" /></a></p>
<p>As you can see, the two setups are doing exactly the same, yet for a programmer the second version is just the way cleaner approach. In the next part of this series, you will learn how to create an equally simple shader that cannot be created with Cycles nodes at the moment (unless you are doing some other hackish things).</p>
<p>Until then, this list of useful OSL resources will really get you up and going:</p>
<h4>Links to OSL resources:</h4>
<ul>
<li>OSL Introduction: <a href="http://code.google.com/p/openshadinglanguage/wiki/OSL_Introduction">http://code.google.com/p/openshadinglanguage/wiki/OSL_Introduction</a></li>
<li>OSL Language Specification: <a href="https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf">https://github.com/imageworks/OpenShadingLanguage/blob/master/src/doc/osl-languagespec.pdf</a></li>
<li>Tutorials and Links to example Shaders: <a href="http://www.openshading.com/">http://www.openshading.com/</a></li>
<li>Siggraph 2012 OSL Workshop Slides: <a href="http://blog.selfshadow.com/publications/s2012-shading-course/">http://blog.selfshadow.com/publications/s2012-shading-course/</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2012/12/12/introduction-osl-blender-cycles-01/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
	
		<series:name><![CDATA[Introduction to OSL in Cycles]]></series:name>
	</item>
		<item>
		<title>Tip: Tweaking Blender&#8217;s Interface with Scripting</title>
		<link>http://cgcookie.com/blender/2012/09/30/blender-tweak-interface-scripting/</link>
		<comments>http://cgcookie.com/blender/2012/09/30/blender-tweak-interface-scripting/#comments</comments>
		<pubDate>Sun, 30 Sep 2012 05:29:41 +0000</pubDate>
		<dc:creator>Jonathan Williamson</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Interface]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[Jonathan Williamson]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[toolbar]]></category>

		<guid isPermaLink="false">http://cgcookie.com/blender/?p=35424</guid>
		<description><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2012/09/blender_interface_tweak_scripting_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="Customizing the Blender Toolbar with Python Scripting" /></div>Learn how to tweak Blender&#8217;s interface ]]></description>
				<content:encoded><![CDATA[<div><img width="649" height="245" src="http://cgcookie.com/blender/files/2012/09/blender_interface_tweak_scripting_feature-649x245.png" class="attachment-post-thumbnail wp-post-image" alt="Customizing the Blender Toolbar with Python Scripting" /></div><h3>Learn how to tweak <a href="http://blender.org" target="_blank">Blender&#8217;s</a> interface and customize the toolbar with simple <a href="http://cgcookie.com/blender/category/tutorials/scripting/">scripting</a>.</h3>
<p>In this Blender tutorial <a href="http://cgcookie.com/blender/author/jonathanwilliamson" target="_blank">Jonathan</a> will show you how to quickly add any tool to the toolbar for easy access. This is done by accessing the python scripts that generate the toolbar and the rest of the interface. Doing this is very fast, flexible, and requires very little effort and no previous scripting experience necessary.</p>
<p>One of the great things about Blender is that all interfaces, menus, toolbars, etc are generated through Python scripts. These Python scripts can be accessed by simply right-clicking on a button or menu entry and choosing &#8220;Edit Source.&#8221; This will allow you to modify the script from the text editor any way you choose. By following the existing code you can easily deduce what&#8217;s needed to add new tools to the toolbar or to any menu. No previous scripting  experience is needed to follow this tutorial.</p>
<p>If you enjoy the freedom scripting brings then you can also check out these awesome tutorials by <a href="http://cgcookie.com/blender/author/patrick-boelens/">Patrick Boelens</a>:</p>
<p><a href="http://cgcookie.com/blender/2011/09/30/exclusive-code-overview-for-the-baking-uv-textures-to-vertex-colors-add-on/">Introduction to Python Scripting in Blender</a></p>
<p><a href="http://cgcookie.com/blender/2011/07/25/scripting-a-custom-tool-menu/">Scripting a Custom Tool Menu</a></p>
<p><a href="http://cgcookie.com/blender/2011/09/30/exclusive-code-overview-for-the-baking-uv-textures-to-vertex-colors-add-on/">Code Overview for the Baking UV Textures to Vertex Colors Add-on</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cgcookie.com/blender/2012/09/30/blender-tweak-interface-scripting/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Object Caching 2169/2422 objects using apc

 Served from: cgcookie.com @ 2013-05-22 20:21:37 by W3 Total Cache -->