# demonstration program for creating spot shadow map # define the objects ObjectBegin 1 Sphere 1 -1 1 360 ObjectEnd ObjectBegin 2 Polygon "P" [-5 -5 0 5 -5 0 5 5 0 -5 5 0] ObjectEnd ObjectBegin 3 Cylinder .05 0 .75 360 ObjectEnd # create the depth "z" file from the location of the light # the commented out Display function allows you to see the # light source view to insure that you are looking the right # direction # # THIS FRAME RENDERS THE SHADOW FILE FOR THE SPOTLIGHT # PixelSamples 1 1 PixelFilter "box" 1 1 Display "spot.z" "zfile" "z" #Display "spot" "framebuffer" "rgb" ShadingRate 4 Format 1024 1024 1 Projection "perspective" "fov" [18] # move the camera to the light sourse position Translate 0 0 4 Rotate -190 0 1 0 #Rotate 0 0 0 1 WorldBegin #Sides 2 # catch both sides of surfaces # we don't actually use this light to create the shadow map TransformBegin #Rotate 0 0 0 1 Rotate 190 0 1 0 Translate 0 0 -4 LightSource "spotlight" 1 "intensity" 30.0 "lightcolor" [1 1 1] "from" [0 0 0] "to" [0 0 1] "coneangle" 10.0 "conedeltaangle" 0.0 "beamdistribution" 200.0 # "shadowname" "spot.shadow" TransformEnd LightSource "ambientlight" 2 "intensity" .8 Surface "plastic" "Ka" [0.3] "Kd" [0.4] "Ks" [0.3] # sphere AttributeBegin Color [1 0 0] Translate 0 0 0.2 Scale .2 .2 .2 ObjectInstance 1 AttributeEnd # bottom plane #AttributeBegin # Color [1 .8 .6] # Scale 1.0 1.0 1.0 # ObjectInstance 2 #AttributeEnd # cylinders AttributeBegin Color [.8 1 .6] #Translate .4 .1 -.1 Translate .4 .1 0.0 Scale 1 1 .5 ObjectInstance 3 Translate 0 .3 0 Color [.4 .7 1] ObjectInstance 3 AttributeEnd WorldEnd # # CONVERT DEPTH RENDER INTO SHADOW MAP FILE # # use: txmake -shadow spot.z spot.shadow