On this page:
Pict3D:   Functional 3D Scenes
8.13.0.2

Pict3D: Functional 3D Scenes🔗ℹ

Neil Toronto <neil.toronto@gmail.com>

Pict3D is written in Typed Racket, but can be used in untyped Racket without significant performance loss.

 (require pict3d) package: pict3d

Pict3D provides a purely functional interface to rendering hardware, and is intended to be a performant, modern 3D engine. It’s getting there.

Pict3D draws on pict for inspiration, though some aspects of working in three dimensions make direct analogues impossible or very difficult. For example,
  • In a 3D scene, solid colors alone are insufficient to indicate the shapes of objects.

  • Unlike 2D scenes, 3D scenes must be projected onto two dimensions for display. The projection isn’t unique, so displaying a 3D scene requires additional information.

  • In 3D, it’s possible to create combiners that stack scenes vertically and horizontally. Unfortunately, there would be nine for each axis, to line up corners, edges, and centers, for a total of 27.

Pict3D’s solutions to these difficulties take more or less standard forms: lights, cameras, and affine transformations. But what is not standard is the overall design:
  • Pict3D makes no distinction between development and production/deployment. All functions for developing scenes are available during runtime, and vice-versa.

  • The procedures used to create and update scenes are purely functional.

Scenes are thus fully persistent, which offers many advantages. For example, when running pict3d/universe programs, the current scene can be dumped to DrRacket’s REPL for inspection at any time by pressing F12, without affecting the running program.

    1 Quick Start

    2 Constructors

    3 Shape Attributes

      3.1 Reflected Color Attributes

      3.2 Emitted Color Attributes

      3.3 Material Attributes

      3.4 Vertex Attributes

      3.5 Interval Arguments

      3.6 Arc Arguments

    4 Position and Direction Vectors

      4.1 Direction Vectors

      4.2 Position Vectors

    5 Combining Scenes

      5.1 Scene Combiners

    6 Transformation

      6.1 Basic Transformation Data Types

      6.2 Transformation Combiners and Constructors

    7 Deformation and Tessellation

      7.1 Basic Deformation Data Types

      7.2 Tessellation

      7.3 Deformation Constructors and Combiners

    8 Collision Detection

    9 Rendering

      9.1 Rendering Optimization

      9.2 Rendering Parameters

      9.3 Rendering Targets

    10 3D Universe