OSL

 

Table Of Contents

 

Introduction

OSL stands for Open Shading Language and allows to write your own shader descriptions, that can be shared between other renderers that also offer OSL support. OSL scripts can be loaded as files or written directly inside the shader dialog.

You can find out more about OSL on this website: https://github.com/AcademySoftwareFoundation/OpenShadingLanguage and some Redshift compatible OSL shaders here:

https://github.com/redshift3d/RedshiftOSLShaders


OSL

Here you can load an OSL definition or write your own OSL script into the Code field.


Source

Choose the source of your OSL code:


Path

Only available in File mode.

Load an OSL file here.


Edit

Only available in File mode.

Open a text editor to edit the content of the currently loaded file.


Code

Only available in Text mode.

Enter OSL code directly into this field.


Load

Only available in Text mode.

Open an OSL file and copy its content to the Code field.


Messages

This area gives you feedback about the OSL code, such as compiler messages.


Parameters

You can define variables in your OSL code which are then displayed in this tab.

You can for example add additional input variables for a float and a vector value at the preset code like this:

shader OSLShader(
color inColor=color(1, 1, 1),
float myValue=0.0,
point myVector=vector(0),
output color outColor=0
)
{
outColor = inColor;
}