ambient

emissiveclj

shininess

specular

ambient

Arguments
[gray][r g b]
Docstring

Sets the ambient reflectance for shapes drawn to the screen. This is combined with the ambient light component of environment. The color components set through the parameters define the reflectance. For example in the default color-mode, setting r=255, g=126, b=0, would cause all the red light to reflect and half of the green light to reflect. Used in combination with emissive, specular, and shininess in setting the material properties of shapes.

Works only inside sketch functions?
Yes
Original Processing method
ambient()
Original p5js method
ambientMaterial()
Example
(q/background 0)
(q/camera 150 150 150 0 0 0 0 0 -1)
; set light to kinda pink
(q/ambient-light 255 127 127)
; first box has full reflectance
(q/ambient 255)
(q/translate 0 -50 0)
(q/box 50)
; second box has abmient material with blue-only component
(q/translate 0 75 0)
(q/ambient 0 0 255)
(q/box 50)
; third box has gray ambient material
(q/translate 0 75 0)
(q/ambient 127)
(q/box 50)
try example

emissiveclj

Arguments
[gray][r g b]
Docstring

Sets the emissive color of the material used for drawing shapes drawn to the screen. Used in combination with ambient, specular, and shininess in setting the material properties of shapes.

If passed one arg it is assumed to be an int (i.e. a color), multiple args are converted to floats.

Works only inside sketch functions?
Yes
Original Processing method
emissive()
Original p5js method
None.
Example
clojure specific
  • (q/background 0)
    (q/camera 150 150 150 0 0 0 0 0 -1)
    (q/ambient-light 255 127 127)
    (q/emissive 0 0 255)
    (q/box 100)
    (q/translate 0 100 0)
    (q/emissive (q/color 0 127 0))
    (q/sphere 40)

shininess

Arguments
[shine]
Docstring

Sets the amount of gloss in the surface of shapes. Used in combination with ambient, specular, and emissive in setting the material properties of shapes.

Works only inside sketch functions?
Yes
Original Processing method
shininess()
Original p5js method
None.
Example
clojure specific
  • (q/background 0)
    (q/camera 150 150 150 0 25 0 0 0 -1)
    (q/fill 127 0 255)
    (q/no-stroke)
    (q/light-specular 204 204 204)
    (q/directional-light 102 102 102 -1 -1 -1)
    (q/specular 255 255 255)
    ; draw two spheres with different shininess
    (q/shininess 2)
    (q/sphere 50)
    (q/translate 0 100 0)
    (q/shininess 10)
    (q/sphere 40)
clojurescript specific
  • (q/background 0)
    (q/camera 150 150 150 0 25 0 0 0 -1)
    (q/fill 127 0 255)
    (q/no-stroke)
    (q/directional-light 102 102 102 -1 -1 -1)
    (q/specular 255 255 255)
    ; draw two spheres with different shininess
    (q/shininess 2)
    (q/sphere 50)
    (q/translate 0 100 0)
    (q/shininess 10)
    (q/sphere 40)
    try example

specular

Arguments
[gray][x y z]
Docstring

Sets the specular color of the materials used for shapes drawn to the screen, which sets the color of highlights. Specular refers to light which bounces off a surface in a preferred direction (rather than bouncing in all directions like a diffuse light). Used in combination with emissive, ambient, and shininess in setting the material properties of shapes.

Works only inside sketch functions?
Yes
Original Processing method
specular()
Original p5js method
specularMaterial()
Example
clojure specific
  • (q/fill 255)
    (q/background 0)
    (q/camera 150 150 150 0 25 0 0 0 -1)
    (q/ambient-light 60 60 60)
    (q/no-stroke)
    (q/fill 0 51 102)
    (q/light-specular 255 255 255)
    (q/directional-light 255 255 255 0 0 -1)
    (q/specular 255)
    (q/sphere 50)
    (q/translate 0 100 0)
    (q/specular 204 0 0)
    (q/sphere 40)
clojurescript specific
  • (q/fill 255)
    (q/background 0)
    (q/camera 150 150 150 0 25 0 0 0 -1)
    (q/ambient-light 60 60 60)
    (q/no-stroke)
    (q/point-light 25 255 255 150 150 150)
    (q/specular 255)
    (q/sphere 50)
    (q/translate 0 100 0)
    (q/specular 204 0 0)
    (q/sphere 40)
    try example