Skip to content

An attempt to recreate the nodes in blender using OSL

License

Notifications You must be signed in to change notification settings

ppmpreetham/OSL-Shaders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

OSL-Shaders

An attempt to recreate the nodes in blender using OSL

Mix nodes

This is pretty similar to linearly mixing any two different things with a mix factor. For an example, in math, if we want to mix two functions $f(x)$ and $g(x)$, we usually do it by taking a mix factor $t$, and the output is going to be a new function $h(x) = tf(x)+(1-t)g(x)$. Here, $0\lt t\lt 1$.

2 functions

Texture Coordinate Node

The Texture coordinate node provides the:

  • Object
  • Normal
  • UV
  • Incident
  • Reflection

Reflection Node

We can use this formula to derive the reflection node using the incident node.

$\mathbf{r} = \mathbf{i} - 2 \mathbf{n}(\mathbf{n} \cdot \mathbf{i})$

RGB to BW Node

Took the cofiguration of the OpenColorIO on the luma line in https://git.blender.org/gitweb/gitweb.cgi/blender.git/blob_plain/HEAD:/release/datafiles/colormanagement/config.ocio.

This is the same as taking the dot product between R,G,B and 0.2126,0.7152,0.0722. This would yield us a result in a greyscale mode in which all the R,G,B channels are given the color $0.2126R + 0.7152G + 0.0722*B$.

Blackbody Shader

This doesn't look like the Blender's Blackbody node but produces quite similar results.

According to the Stefan-Boltzmann law, hotter objects emit more high-frequency radiation compared to cooler objects. As blue light has a higher frequency than red light, hot objects tend to emit bluish light, warm objects emit white light (a combination of blue and red), and cool objects emit red light.

Used the algorithm by Tanner Helland

About

An attempt to recreate the nodes in blender using OSL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published