This API is experimental
Its behavior may change in a future version of p5.js.
Get the shader used by normalMaterial()
.
You can call baseNormalShader().modify()
and change any of the following hooks:
Hook | Description |
---|---|
void beforeVertex | Called at the start of the vertex shader. |
vec3 getLocalPosition | Update the position of vertices before transforms are applied. It takes in vec3 position and must return a modified version. |
vec3 getWorldPosition | Update the position of vertices after transforms are applied. It takes in vec3 position and pust return a modified version. |
vec3 getLocalNormal | Update the normal before transforms are applied. It takes in vec3 normal and must return a modified version. |
vec3 getWorldNormal | Update the normal after transforms are applied. It takes in vec3 normal and must return a modified version. |
vec2 getUV | Update the texture coordinates. It takes in vec2 uv and must return a modified version. |
vec4 getVertexColor | Update the color of each vertex. It takes in a vec4 color and must return a modified version. |
void afterVertex | Called at the end of the vertex shader. |
void beforeFragment | Called at the start of the fragment shader. |
vec4 getFinalColor | Update the final color after mixing. It takes in a vec4 color and must return a modified version. |
void afterFragment | Called at the end of the fragment shader. |
Most of the time, you will need to write your hooks in GLSL ES version 300. If you are using WebGL 1 instead of 2, write your hooks in GLSL ES 100 instead.
Call baseNormalShader().inspectHooks()
to see all the possible hooks and their default implementations.
Ejemplos
Returns
Referencias Relacionadas
copyToContext
Copia el shader de un contexto de dibujo a otro.
setUniform
Establece los valores de las variables uniformes (globales) del shader.
ambientMaterial
Establece el color ambiental del material de la superficie de las formas.
createFilterShader
Crea un objeto p5.Shader para ser utilizado con la función filter().