ilrLuaNode

The ilrLuaNode allows for custom shaders through the use of Lua scripts.

The Lua Node takes a script file written in the language Lua as input and executes it for each fragment. A reference on the programming language Lua can be found at http://www.lua.org.

It is possible to use a Lua node as an Output Shader. This is achieved by connecting a Lua node to the Output Shader in the Turtle Render Globals. An Output Shader backend node can then be connected to one of the Lua inputs. Example usage could be deferred shading or adjusting the levels of the output image. Please note that no implicit data such as lights or fragment information except for the inputs are available when the Lua node is not connected to a shader.

Note: Indexing of arrays and vectors starts from 1 in Lua.

LUA Attributes

Script File

This field specifies the source file of the Lua script. It can be prefixed by nn in order to make it project-relative. For example, nnturtlenscriptsnphong.lua specifies a script located in the turtle part of the project directory.

Input 1-5

These are color inputs that can be connected to other shading nodes. They are accessible from the Lua script.

output1

The result of the Lua script.

Turtle extensions to Lua

Data types:

  • vec3: A vector of three float values. It can be constructed with the function vec3(x,y,z).

Functions for retrieving implicit data:

Functions for lighting:

Functions for ray tracing:

Utility functions:

Operations on vec3: