   [scene & paths]
   (update-in scene [:includes :partials] (fnil into []) paths))
 
+(defn- material-common
+  [{:keys [interior exterior]}]
+  {:__interior interior
+   :__exterior exterior})
+
 (defn material-null
   [scene id]
   (append scene :materials (name id) {:type [:string "null"]} true))
 
 (defn material-matte
-  [scene id & {:keys [diffuse sigma] :or {diffuse [1.0 1.0 1.0] sigma 0}}]
+  [scene id & {:keys [diffuse sigma] :or {diffuse [1.0 1.0 1.0] sigma 0} :as opts}]
   (append
    scene :materials (name id)
-   {:type [:string "matte"]
-    :Kd [:color diffuse]
-    :sigma [:float sigma]}))
+   (merge
+    (material-common opts)
+    {:type [:string "matte"]
+     :Kd [:color diffuse]
+     :sigma [:float sigma]})))
 
 (defn material-matte-translucent
   [scene id & {:keys [reflect transmit sigma conserve?]
-               :or {reflect [0.3 0.3 0.3] transmit [0.65 0.65 0.65] sigma 0 conserve? true}}]
+               :or {reflect [0.3 0.3 0.3] transmit [0.65 0.65 0.65] sigma 0 conserve? true}
+               :as opts}]
   (append
    scene :materials (name id)
-   {:type [:string "mattetranslucent"]
-    :Kr [:color reflect]
-    :Kt [:color transmit]
-    :sigma [:float sigma]
-    :energyconserving [:bool conserve?]}))
+   (merge
+    (material-common opts)
+    {:type [:string "mattetranslucent"]
+     :Kr [:color reflect]
+     :Kt [:color transmit]
+     :sigma [:float sigma]
+     :energyconserving [:bool conserve?]})))
 
 (defn volume
   [scene id & {:keys [type fresnel absorb abs-scale abs-depth]

  (def lxs (-> (lux-scene)
               (camera :eye [10 -2 10] :target [0 0 0] :up [0 0 1])
               (film :width 640 :height 360 :display-interval 5 :halt-spp 50)
               (area-light "left" :p [0 0 5] :size 1 :gain 1 :tx {:translate [-5 0 0] :ry -20})
               (area-light "top" :p [0 0 7] :size 6 :gain 0.5 :tx {:translate [0 4 0] :rx -45})
               (area-light "right" :p [0 0 5] :size 1 :gain 1 :tx {:translate [5 0 0] :ry 20})
               (shape-disk "floor" :radius 20 :material "white")
               ;;(shape-disk "d1" :radius 3 :inner-radius 2 :material "red" :tx {:rx -30})
               ;;(shape-disk "d2" :radius 3 :inner-radius 2 :material "orange" :tx {:rx 30})
               (stl-mesh "map" :material "orange" :tx {:scale [5 3 1] :translate [0 0 1]} :mesh (g/extrude (r/rect -1 -1 2 2) {:depth 1 :scale 0.8}))
               (material-matte "white" :diffuse [0.8 0.8 0.8])
               (material-matte "red" :diffuse [1.0 0 0])
               (material-matte "orange" :diffuse [1.0 0.3 0])
               (serialize-scene "foo" false)
               ))
  )


(def ^:dynamic *indent* 2)

(def ^:dynamic *float-format* "%1.8f")

(def ^:const mesh-types {:inline :trimesh :ply :plymesh :stl :stlmesh})

(def ^:dynamic *degrees* true)
