home/ atoms/ processing-3d-renderers

Processing supports 3D via P3D and OPENGL renderers, specified as a third size() argument

By default, Processing renders only 2D shapes. Specifying P3D or OPENGL as a third parameter to size() activates a 3D renderer: size(600, 600, P3D). P3D is the built-in software renderer requiring no extra imports; OPENGL uses the graphics card and is faster for many polygons but requires import processing.opengl.*. In 3D, translate(), rotate(), and scale() work with a third axis (z). box() and sphere() draw 3D primitives. camera() positions the viewpoint. lights() adds basic illumination; directionalLight(), pointLight(), and spotLight() provide control over light type and position.

Examples

void setup() { size(400, 400, P3D); } void draw() { lights(); translate(width/2, height/2); rotateY(frameCount * 0.01); box(100); }

Assessment

Convert a 2D circle-orbit sketch to 3D by adding z-axis rotation; explain what extra information the camera() function requires vs the default view.

“Before drawing 3D form in Processing, it’s necessary to tell the software to draw with a 3D renderer.”
corpus · processing-handbook-no-login-mirror-pdf-reas-and-fry · chunk 108