texture osl (OPEN SHADING LANGUAGE)

Open Shading Language is the programmable shading for describing materials, textures, camera and pattern generation. OSL was originally developed by Sony Pictures Imageworks for use in its in-house renderer used for feature film animation and visual effects, released as open source so it could be used by other visual effects and animation studios and rendering software vendors. It is a proven programming language used in many films.

With Octane V3.08 you can now create highly detailed textures using Open Shading Language. If you only have a little patience and can bear the "learning curve", you have a very advanced tool for creating textures. If you are interested in programming or if you are a programmer, you can produce almost endless variety of textures using OSL. Moreover, do not think of it as only texture creation, there are also Camera and Projection options. Briefly, it's like a treasure; discovering can take some time and it is worth spending time to learn OSL.

We will not explain OSL in detail in this section. Since this is a very broad subject, you can go to this link and start learning about Octane OSL. There are very detailed explanations there.

You can also find tutorials and examples from the web because OSL is an open source programming language.



HOW to USE: APPLY OSL TEXTURE

Now we will tell you step by step how to use OSL texture in Octane very simply. In this example, we will mention how to apply OSL texture to Diffuse material by using Node Editor.

First create an Octane Diffuse material and open the Node editor. Drag and drop the diffuse material you created into the Node editor. Then select "OSL texture" from the "Image Textures" group on the left in the Node editor and drag and drop it into the editor area. Connect this OSL node to the "diffuse" channel of the diffuse material.



2- Select the OSL texture node. Once you have selected the "Code group" tab in the settings window on the right, click on the "Editor" button.



3- The editor that opens is the heart of OSL texture creation. You will write, compile and complete your code here. As we mentioned at the beginning, you can learn how to write OSL using the link we gave. Or you can find articles and tutorials on the Web. We will use ready-made scripts for now. To do this, go to section "2" of the Premade scripts and select "Flakes.osl" from the drop down menu.



4- When you select "Flake.osl" script, you will get the following image. When you return to the Code Group window again, you can also play with the flakes texture settings in the "parameters" section under the script lines. As you can see, you can create an infinite variety of textures simply by writing the code.




Things to be aware of when using OSL

When using OSL, you may need to pay attention to some things. Now let's briefly explain them:

Features and limitations

First of all you need to know the limits or what features to support or not support for writing OSL shader in Octane. We recommend that you read the "Features and Limitations" topic from this link.


crash sItuaTIONS

There are some crash situations, for example if an unsupported feature or a global variable (eg time parameter) is used in the script, Octane can crash. The only way to prevent this for now is you should be careful for writing the code.


compIle matters

You may need to press "compile" when a predefined preset script is selected or modified. Especially if a render is not active in the live viewer.


when you want to use external osl scrIpts

When researching on the web, you will find some examples of OSL shaders. You can use these examples, but you may have to change some (or even most). Some of the lines of code or commands may not work in Octane, since these OSL instances are implemented according to the core features of the respective software. For example, some of the code you see in the picture below is found on the web. When we try to use this code in the Octane OSL editor, we encounter an "Output" error because Octane OSL does not allow to use of multiple outputs at the moment. Only one output is available. So it's better to know the limits for writing OSL in Octane. In the future, we expect these limits are off.



Another example is what you see in the picture below. Here, the use of "col.x" to read the first component of the "col" parameter fails. The correct use is shown on the right. Adapting external sources to the Octane OSL will not be a problem as your experience with writing OSL increases.