c3d.shader
the shader module provides a bunch of tools for creating your own custom shaders and also the default shaders so they can be easily integrated
default | default versions of the shaders |
---|---|
frag | some useful fragment shaders |
vertex | some useful vertex shaders |
- defaultSource
default versions of the shaders
vertex(x, y, z, w, properties, scale, rot, pos, per, cam_transform, cam_position, cam_rotation) the default vertex shader frag(px_info) the default fragment shader geometry(triangle) the default geometry shader - vertex(x, y, z, w, properties, scale, rot, pos, per, cam_transform, cam_position, cam_rotation)Source
the default vertex shader
Parameters
- x number x of the vertex to be transformed by the shader
- y number y of the vertex to be transformed by the shader
- z number z of the vertex to be transformed by the shader
- w number w of the vertex to be transformed by the shader
- properties table properties of the object this vertex belongs to
- scale table the scale matrix of the object this vertex belongs to
- rot table the rotation matrix of the object this vertex belongs to
- pos table the translation matrix of the object this vertex belongs to
- per table the current perspective matrix present in the scene
- cam_transform table the generic transform of the current camera
- cam_position table the position transform of the current camera
- cam_rotation table the rotation transform of the current camera
Returns
- number x of the transformed vertex
- number y of the transformed vertex
- number z of the transformed vertex
- number w of the transformed vertex
- frag(px_info)Source
the default fragment shader
Parameters
- px_info table the pixels information given from the rasterizer
Returns
- number the color to set this pixel to
- boolean whether should this pixel be made transparent
- geometry(triangle)Source
the default geometry shader
Parameters
- triangle table the triangle inputed into the shader
Returns
- table the returned triangle from the shader
- fragSource
some useful fragment shaders
noise() white noise fragment shader - noise()Source
white noise fragment shader
Returns
- number random color (black/white)
- vertexSource
some useful vertex shaders
skybox(x, y, z, w, properties, scale, rot, pos, per, cam_transform, cam_position, cam_rotation) makes this object not be affected by its position and camera position. - skybox(x, y, z, w, properties, scale, rot, pos, per, cam_transform, cam_position, cam_rotation)Source
makes this object not be affected by its position and camera position. only rotation. ideal for skyboxes !
Parameters
- x number x of the vertex to be transformed by the shader
- y number y of the vertex to be transformed by the shader
- z number z of the vertex to be transformed by the shader
- w number w of the vertex to be transformed by the shader
- properties table properties of the object this vertex belongs to
- scale table the scale matrix of the object this vertex belongs to
- rot table the rotation matrix of the object this vertex belongs to
- pos table the translation matrix of the object this vertex belongs to
- per table the current perspective matrix present in the scene
- cam_transform table the generic transform of the current camera
- cam_position table the position transform of the current camera
- cam_rotation table the rotation transform of the current camera
Returns
- number x of the transformed vertex
- number y of the transformed vertex
- number z of the transformed vertex
- number w of the transformed vertex