레퍼런스 combineColors

combineColors

이 API는 실험적입니다

향후 p5.js 버전에서 동작이 변경될 수 있습니다.

A shader hook block that modifies how color components are combined in the fragment shader. This hook can be used inside buildMaterialShader() and similar shader modify() calls to control the final color output of a material. Modifications happen between the .begin() and .end() methods of the hook.

combineColors has the following properties:

  • baseColor: a three-component vector representing the base color (red, green, blue).
  • diffuse: a single number representing the diffuse reflection.
  • ambientColor: a three-component vector representing the ambient color.
  • ambient: a single number representing the ambient reflection.
  • specularColor: a three-component vector representing the specular color.
  • specular: a single number representing the specular reflection.
  • emissive: a three-component vector representing the emissive color.
  • opacity: a single number representing the opacity.

Call .set() on the hook with a vector with four components (red, green, blue, alpha) for the final color.

This hook is available in:

예제

Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!

관련 레퍼런스