#VRML V2.0 utf8  

Viewpoint {
   position 0 0 10
   orientation 0 0 1 0
   fieldOfView 0.785398
   description "ViewPoint"
}
 
NAME neutral PhBXYZSpectrum { xyz 1 1 1 }
                                             
NAME light PhBHomogeneousSurface {
   edf PhBEDF {
      intensity 10000.
      spectrum USE neutral
      emitter PhBDiffuseEmitter {}
   }
}

PROTO WardSurface [
 exposedField SFFloat rho_d 1. ,
 exposedField SFNode  spectrum_d NULL,
 exposedField SFFloat rho_s 0. ,
 exposedField SFNode  spectrum_s NULL,
 exposedField SFFloat alpha_x 0.1 ,
 exposedField SFFloat alpha_y 0.1
] {
   PhBHomogeneousSurface {
      bsdf [ PhBSimpleBSDF {
	 intensity IS rho_d
	 spectrum IS spectrum_d
	 scatterer PhBDiffuseReflector {}
      }
	     , PhBSimpleBSDF {
	 intensity IS rho_s
	 spectrum IS spectrum_s
	 scatterer PhBWardReflector {
	    standardDeviationX IS alpha_x
	    standardDeviationY IS alpha_y
	 }
      }
     ]
   }
}

PROTO PhongSurface [
 exposedField SFFloat rho_d 1. ,
 exposedField SFNode  spectrum_d NULL,
 exposedField SFFloat rho_s 0. ,
 exposedField SFNode  spectrum_s NULL,
 exposedField SFFloat sharpness 0 ,
] {
   PhBHomogeneousSurface {
      bsdf [
	PhBSimpleBSDF {
	 intensity IS rho_d
	 spectrum IS spectrum_d
	 scatterer PhBDiffuseReflector {}
	},
	PhBSimpleBSDF {
	 intensity IS rho_s
	 spectrum IS spectrum_s
	 scatterer PhBPhongReflector { sharpness IS sharpness }
	}
     ]
   }
}

NAME rolledbrass WardSurface {
   rho_d 0.10
   rho_s 0.33
   alpha_x 0.050
   alpha_y 0.16
}

NAME rolledbrass2 PhongSurface {
   rho_d 0.10
   rho_s 0.33
   sharpness 25
}

NAME varnished_plywood WardSurface {
   rho_d 0.33
   rho_s 0.025
   alpha_x 0.04
   alpha_y 0.11
}

PROTO QuadFace [
 exposedField MFVec3f points [ ]
] {
   IndexedFaceSet {
      coord Coordinate {
         point IS points
      }
      coordIndex [ 0 1 2 3 ]
      colorPerVertex FALSE
      normalPerVertex FALSE
      solid FALSE
   }
}

Group {
   children [
      Shape {
	 geometry Sphere { radius 5 }
	 appearance PhBAppearance { surface USE rolledbrass }
      },
      Shape {
	 geometry Box { size -24 -24 -24 }
	 appearance PhBAppearance { 
	    surface PhBHomogeneousSurface {
	       bsdf PhBSimpleBSDF {
		  intensity 0.5
		  spectrum USE neutral
		  scatterer PhBDiffuseReflector {}
	       }
	    }
	 }
      },
      Transform {
	 translation 0 0 10
	 children [
	    Shape {
	       geometry QuadFace { 
		  points [  0.2  0.2 0 ,
			    0.2 -0.2 0 ,
			   -0.2 -0.2 0 ,
			   -0.2  0.2 0 ]
	       }
	       appearance PhBAppearance { surface USE light }
	    }
	 ]
      }
   ]
}
