You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/webgl/ShaderGenerator.js
+18-4Lines changed: 18 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1821,9 +1821,23 @@ if (typeof p5 !== 'undefined') {
1821
1821
/**
1822
1822
* @method getPixelInputs
1823
1823
* @description
1824
-
* Registers a callback to modify the properties of each fragment (pixel) before the final color is calculated in the fragment shader. This hook can be used inside <a href="#/p5/baseMaterialShader">baseMaterialShader()</a>.modify() and similar shader modify calls to change opacity or other per-pixel properties. The callback receives an object with the following properties:
1825
-
* - `opacity`: a number between 0 and 1 for the pixel's transparency
1826
-
* - (Other properties may be available depending on the shader.)
1824
+
* Registers a callback to modify per-fragment inputs before the final color is computed in the fragment shader. The available properties differ by shader:
1825
+
* - For baseMaterialShader():
1826
+
* - `normal` (vec3): surface normal
1827
+
* - `texCoord` (vec2): texture coordinates
1828
+
* - `ambientLight` (vec3): ambient light color
1829
+
* - `ambientMaterial` (vec3): ambient material color
1830
+
* - `specularMaterial` (vec3): specular material color
1831
+
* - `emissiveMaterial` (vec3): emissive material color
1832
+
* - `color` (vec4): base color (unpremultiplied)
1833
+
* - `shininess` (float)
1834
+
* - `metalness` (float)
1835
+
* - For baseStrokeShader():
1836
+
* - `color` (vec4): base color
1837
+
* - `tangent` (vec2): tangent direction
1838
+
* - `center` (vec2): stroke center for the current fragment
1839
+
* - `position` (vec2): fragment position in stroke space
1840
+
* - `strokeWeight` (float)
1827
1841
*
1828
1842
* Return the modified object to update the fragment.
1829
1843
*
@@ -1933,7 +1947,7 @@ if (typeof p5 !== 'undefined') {
0 commit comments