Description
Currently 3d shapes drawn using beginShape/vertex/endShape have all vertexes assigned a normal of (0, 0, 1)
. When drawing custom geometry with these functions it should be possible to specify the normal vector for each vertex.
How would this new feature help [increase access]
Individuals learning the fundamentals of 3d computer graphics for the first time would benefit from being able to use vertex normals when drawing custom geometry using beginShape/vertex/endShape. I think this is more accessible to users who are new to 3d graphics then jumping straight to loading 3d model files, or creating custom p5.Geometry objects. It also presents an opportunity to introduce vector math concepts such as cross product, addition, and normalization.
Most appropriate sub-area of p5.js?
- Accessibility (Web Accessibility)
- Build tools and processes
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Friendly error system
- Image
- IO (Input/Output)
- Localization
- Math
- Unit Testing
- Typography
- Utilities
- WebGL
- Other (specify if possible)
New feature details:
I propose adding a function vertexNormal
that sets the normal vector to be used in subsequent calls to vertex
. This vector would default to (0, 0, 1)
thereby preserving the current behavior by default. This value would be stored/restored as part of push/pop operations. As far as I know this would only be relevant for drawing using the WebGL renderer, and would have no effect when using other renderers.