| Raytraced shadows
| This tutorial shows what you need to do to have raytraced shadows. Before we start, you should know that in general, shadow mapped shadows are faster if generated correctly. The disadvantage of creating shadows with shadow mapping is the need for a separate shadow map generation. To make sure an object casts shadows, you need to set the visibility attribute: Attribute "visibility" "transmission" "opaque|Os|shader|transparent" The default value of this attribute is transparent. This means by default no object will cast any shadows. opaque means the object will cast a completely opaque shadow. Os means the shadow opacity will be determined from the opacity attribute and finally, shader means the surface shader will be executed to find the shadow opacity. Notice that shader is naturally slower than the other alternatives that don't require shader execution. In order to compute the amount of visibility between two points, you may use the transmission function, which returns the visibility between two points. You can also use the shadow function within illuminate or solar constructs with "raytrace" as the shadow map name to figure out the visibility of the query point using raytracing. The following RIB file demonstrates the raytraced shadows using the shadowdistant light source: shadow.rib Notice that shadowdistant uses the shadow call with "raytrace" as the shadow name. If you change: Attribute "visibility" "transmission" "opaque" Polygon "P" [-1 -1 0 1 -1 0 1 1 0 -1 1 0] to: Attribute "visibility" "transmission" "shade" Polygon "P" [-1 -1 0 1 -1 0 1 1 0 -1 1 0] "Os" [1 0 0 0 1 0 1 1 0 0 0 1] shadowShade.rib You should get the following picture: