Skip to content

Instantly share code, notes, and snippets.

@jac18281828
Last active October 18, 2026 15:06
Show Gist options
  • Select an option

  • Save jac18281828/9ee7d3e371d254340d00dee9045eacda to your computer and use it in GitHub Desktop.

Select an option

Save jac18281828/9ee7d3e371d254340d00dee9045eacda to your computer and use it in GitHub Desktop.
A Cornell box for gman 1.0's radiosity pass
# A Cornell box for gman 1.0: a red wall, a green wall, two spheres and a
# bulb hanging under a cone shade. The two Option lines name the radiosity
# pass and its patch size; render it with
# gman -r gmanraytracer box.rib
Display "box.png" "file" "rgba"
Option "render" "string indirect" ["radiosity"]
Option "radiosity" "float elementsize" [0.15]
Format 450 450 1
PixelSamples 3 3
Exposure 1.05 2.2
Projection "perspective" "fov" [39]
Clipping 0.5 50
Translate 0 0 3.8
WorldBegin
Surface "matte" "Ka" [1] "Kd" [1]
# The bulb's light: a spotlight just under the bulb, lighting the half-space
# below the shade's rim and nothing above it.
LightSource "spotlight" 1 "intensity" [1.36] "lightcolor" [1 0.92 0.8] "from" [0 0.80 0.1] "to" [0 -1 0.1] "coneangle" [1.5708] "conedeltaangle" [0.35] "beamdistribution" [1]
Sides 2
Color [0.725 0.725 0.725]
Polygon "P" [-1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1]
Polygon "P" [-1 1 -1 1.001 1 -1 1.001 1 1 -1 1 1]
Polygon "P" [-1 -1 1 1 -1 1 1 1 1 -1 1 1]
Color [0.63 0.065 0.05]
Polygon "P" [-1 -1 -1 -1 -1 1 -1 1 1 -1 1 -1]
Color [0.14 0.45 0.091]
Polygon "P" [1 -1 -1 1 -1 1 1 1 1 1 1 -1]
Color [0.725 0.725 0.725]
AttributeBegin
Translate -0.4 -0.6 0.3
Sphere 0.4 -0.4 0.4 360
AttributeEnd
AttributeBegin
Translate 0.45 -0.7 -0.2
Sphere 0.3 -0.3 0.3 360
AttributeEnd
# The cord and socket, faintly self-lit so they show against a black ceiling.
AttributeBegin
LightSource "ambientlight" 2 "intensity" [0.5]
Surface "matte" "Ka" [1] "Kd" [1]
Color [0.08 0.07 0.06]
Translate 0 1 0.1
Rotate 90 1 0 0
Cylinder 0.005 0 0.122 360
Cylinder 0.016 0.122 0.147 360
AttributeEnd
# The shade: a green enamel cone, rim 0.06 above the light, faintly self-lit.
AttributeBegin
LightSource "ambientlight" 3 "intensity" [0.4]
Surface "matte" "Ka" [1] "Kd" [1]
Color [0.12 0.2 0.16]
Translate 0 0.86 0.1
Rotate -90 1 0 0
Cone 0.09 0.1 360
AttributeEnd
# The bulb glows by its own ambient light and sits just above the spotlight,
# outside its downward beam, so it casts no shadow.
AttributeBegin
LightSource "ambientlight" 4 "intensity" [1] "lightcolor" [1 0.92 0.8]
Surface "matte" "Ka" [1] "Kd" [0]
Color [1 1 1]
Translate 0 0.844 0.1
Sphere 0.04 -0.04 0.04 360
AttributeEnd
WorldEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment