A shader hook block that modifies the properties of each pixel before the final color is calculated. This hook can be used inside buildMaterialShader() and similar shader modify() calls to adjust per-pixel data before lighting is applied. Modifications happen between the .begin() and .end() methods of the hook.
The properties of pixelInputs depend on the shader:
normal: a three-component vector representing the surface normal.texCoord: a two-component vector representing the texture coordinates (u, v).ambientLight: a three-component vector representing the ambient light color.ambientMaterial: a three-component vector representing the material's ambient color.specularMaterial: a three-component vector representing the material's specular color.emissiveMaterial: a three-component vector representing the material's emissive color.color: a four-component vector representing the base color (red, green, blue, alpha).shininess: a number controlling specular highlights.metalness: a number controlling the metalness factor.
color: a four-component vector representing the stroke color (red, green, blue, alpha).tangent: a two-component vector representing the stroke tangent.center: a two-component vector representing the cap/join center.position: a two-component vector representing the current fragment position.strokeWeight: a number representing the stroke weight in pixels.
This hook is available in:
Ejemplos
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!
Referencias Relacionadas
baseColorShader
Returns the default shader used for fills when no lights or textures are activate.
baseFilterShader
Returns the base shader used for filters.
baseMaterialShader
Returns the default shader used for fills when lights or textures are used.
baseNormalShader
Returns the default shader used for fills when normalMaterial() is activated.