API

Type Alias IShaderPath

Defines the route to the shader code. The priority is as follows:

  • object: { vertexSource: "vertex shader code string", fragmentSource: "fragment shader code string" } for directly passing the shader code
  • object: { vertexElement: "vertexShaderCode", fragmentElement: "fragmentShaderCode" }, used with shader code in script tags
  • object: { vertex: "custom", fragment: "custom" }, used with Effect.ShadersStore["customVertexShader"] and Effect.ShadersStore["customFragmentShader"]
  • string: "./COMMON_NAME", used with external files COMMON_NAME.vertex.fx and COMMON_NAME.fragment.fx in index.html folder.
type IShaderPath = {
    fragment?: string;
    fragmentElement?: string;
    fragmentSource?: string;
    spectorName?: string;
    vertex?: string;
    vertexElement?: string;
    vertexSource?: string;
}
Index
fragment?: string

Used with Effect.ShadersStore. If the fragment is set to "custom, then Babylon.js will read from Effect.ShadersStore["customFragmentShader"]

fragmentElement?: string

Used with shader code in script tags

fragmentSource?: string

Directly pass the shader code

spectorName?: string

Defines the name appearing in spector when framgent/vertex...source are being used

vertex?: string

Used with Effect.ShadersStore. If the vertex is set to "custom, then Babylon.js will read from Effect.ShadersStore["customVertexShader"]

vertexElement?: string

Used with shader code in script tags

vertexSource?: string

Directly pass the shader code