figureone
    Preparing search index...

    Interface OBJ_FragmentShader

    Options used to compose fragment shader source code.

    Shader source code can be automatically composed for different coloring and lighting options.

    Composed source code uses specific uniform and varying names.

    Uniforms will be defined and updated by FigureOne based on the color and transform of the primitive, and the scene being used to draw the primitive. Thus, the uniform variables listed below for are for informational purposes only.

    Uniforms:

    • vec4 u_color: global color for all vertices used all times. When color = 'texture' or color = 'vertex', only the alpha channel of u_color is used.
    • sampler2D u_texture: texture used when color = 'texture'.
    • vec3 u_directionalLight: world space position of directional light source used when light = 'directional'
    • float u_ambientLight: ambient light used when light = 'directional' or light = 'point'.

    Varyings are passed from the vertex shader to the fragement shader. They are listed here in case the user wants to customize one shader, while relying on composition for the other.

    • vec2 v_texcoord: texture coordinates from vertex shader used when color = 'texture'
    • vec4 v_color: vertex specific color from vertex shader used when color = 'vertex'
    • vec3 v_normal: normals from vertex shader used when light = 'directional' or light = 'point'
    • vec3 v_vertexToLight: vector between point source light and vertex from vertex shader used when light = 'point'