OSL shaders: ChSinus
====================

This shader is for use with the OSL node in Redshift. It was developed in Cinema 4D, but should work in Redshift on other platforms, though there is no guarantee that it will.

Parameters
----------

Redshift has not implemented the 'help' metadata for OSL scripts so there is no indication of what a parameter does. Experimentation and trial-and-error are sometimes needed, and you can always look at the code to see what a parameter does. Again, in most cases it isn't difficult to figure out what the parameters do.

The shader generates a pattern based on a sinusoidal function.

Inputs:

Vector: the surface point affected, by default the OSL 'P' value. You can link other coordinates to this input, such as the UVW coords from a State node.
Type: values are 1, 2, or 3; changes the X and Y values obtained from the Vector input. A value of 0 (or greater than 3) has no effect on these values.
Scale: the pattern scale, if you don't see a pattern try changing this value - significant change may be needed.
Shift: this is added to the same X and Y values, changing the pattern. Negative values are also possible.

Outputs:

Intensity: the arithmetical mean of X and Y.
X/Y: the calculated X and Y values.

These values can be used directly to generate a greyscale colour, or more usually, linked to something such as a Ramp node with a suitable colour gradient.

Copyright and licensing
-----------------------

This and most other shaders on the Microbion site were found all over the internet then converted by me (where necessary) for use in Redshift, sometimes with additional features and/or an improved interface. Some were written from scratch by me and if so are released under the Apache software licence.

I make no claim to copyright for any of these shaders except where expressly stated when the shader was written by me. In all other cases copyright remains with the original authors. Occasionally it has not been possible to identify the author of the original script but whoever it was still has copyright over it.

With regards to licensing, many of the shaders either contain no licensing information or were released under the terms of one of the various open-source license models (such as GNU, BSD, Apache, etc.). This is not true of all of them, however. Therefore, before using any of these shaders, especially commercially, it is your responsibility to check the licensing status: details, if any, of this will be found in the .osl file.

Usage
-----

Each shader is in its own .zip file, which contains:

* The shader itself, file extension .osl, which is a plain-text file.
* A render showing what the shader can do (sometimes using the default settings, sometimes with settings altered and additional nodes added).
* A sample scene file saved in Cinema 4D R2024. This in turn contains a shaderball object, a simple light setup, and an OSL material.
* This readme.txt file.

If you load any of the sample files, you may find that Redshift can be particularly bad at keeping links to the .osl file when using relative file paths. All the scene files use relative paths as an absolute path saved on my PC would certainly fail on yours. You will know if the link has broken because Redshift will display a message saying that the OSL file does not exist. All you need to do is navigate to the file on your machine and it will work again, but you will need to reconnect the ports from the OSL node to others in the node tree. In each case therefore I have added a Note to the node tree indicating which ports to connect. In most cases it's pretty obvious anyway.

Finally, please note that OSL on Redshift can be a little flaky and sometimes perfectly good scripts will fail, causing Redshift to develop a hissy fit and shut down. You will need to restart Cinema if that happens. So make sure you save a scene file before creating an OSL material so you don't lose any work if Redshift objects to it. I cannot accept responsibility if you lose work when trying to use any of these shaders.

Steve Pedler
https://www.microbion.co.uk
