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.
ASSIGN OSL TEXTURE TO MATERIAL
You can do this in Octane very simply. 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 go to the "Code group" tab in the settings window on the right. As you can see here, you can do editing and partial creating operations. If you don't want to deal with writing code, you can use various scripted scripts in "Script Category". Right next to "Scrip Presets" section you can see scripts written for the relevant category. You can also change the script parameters under the same window of your selected script.
CREATING AND EDITING OSL TEXTURE
To do this, first press the "Editor" button as shown in the picture below.
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.
SAVING AND CATEGORISING YOUR OSL SCRIPT
You can save the scripts you wrote in the Editor window or create a new category. This process is quite simple, press the "Save" button. Win or Mac explorer window will pop up. By default, the plugin will take you to the folder where you will save the script. However, the place where you will save the scripts is "C:\Program Files\MAXON\ Cinema 4D R19\plugins\ c4doctane\ res\ osl_scripts" folder. Here you can also open a new folder and save your script into it. This creates a new category and you can see it in the OSL script window.
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.
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.
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.