5.58. Sphere (media-object)

<sphere> ‐ A sphere or a sky sphere

5.58.1. Attributes

NameTypeDefaults
idIDNone (required)
radiusFLOAT1.0
sky_sphereBOOLEANfalse
segmentsINTEGERNB_ITERATIONS_BEZIER (100)

5.58.2. Description

This element defines a sphere centered around the origin: (0.0, 0.0, 0.0).

The float value of the radius attribute is the radius of the sphere. If the boolean value of the sky_sphere attribute is true, it indicates that the sphere will be used as a sky sphere for POVray rendering. A sky sphere is a sphere such that the distance to the sky sphere is much larger than the distances between visible objects. The integer value of the segments attribute is the number of steps that will be used to build the mesh of the sphere when rendering it.

The element sphere can have elements in its scope that define the properties of the sphere: color, material, materialRaytrace, shader, texture, or video.

If this element sphere defines a sky sphere for POVray, its color (a texture in POVray terminology) is either a gradient color (a pigment in POVray terminology) or a bozo 3D procedural texture (a pattern in POVray terminology).

If it is a gradient, it can have four elements in its scope that define the color map: colorSky1, colorSky2, colorSky3, and colorSky4. Each element has an integer attribute size. It defines the number of float values in its scope that define the color (3 or 4). The elements colorSky2 and colorSky4 have a float attribute bounding. Their values bounding2 and bounding4 define the two intervals of the gradient color map: [colorSky1,colorSky2] in [0.0,bounding2] and [colorSky3,colorSky4] in [bounding2,bounding4].

If it is a bozo 3D procedural texture, it must have four additional elements in its scope that define the bozo color map in addition to the gradient color map: colorBozo1, colorBozo2, colorBozo3, and colorBozo4. Each element has an integer attribute size. It defines the number of float values in its scope that define the color (3 or 4). The elements colorBozo2 and colorBozo3 have a float attribute bounding. Their values bounding2 and bounding3 define the three intervals of the bozo color map: [colorBozo1,colorBozo2] in [0.0,bounding2], [colorBozo2,colorBozo3] in [bounding2,bounding3], and [colorBozo3,colorBozo4] in [bounding3,1.0].

5.58.3. Expected children

The following elements can occur in spheres: color, material, materialRaytrace, shader, texture, or video.

The following elements must occur in sky spheres: colorSky1 and colorSky3 with size attribute, colorSky2 and colorSky4 with size and bounding attributes. If the sky sphere has a bozo 3D procedural texture, the following additional elements must occur: colorBozo1 and colorBozo4 with size attribute, colorBozo2 and colorBozo3 with size and bounding attributes.

Figure 5-21. Sphere Parameter

5.58.4. Example

The example below defines a sky sphere that is rendered as a textured sphere of radius 500.0 in OpenGL. In POVray, the color of the sky sphere gradually changes from red to light blue and its bozo texture is made of grey to white clouds.

<node id="node_landscape_sphere">
  <sphere id="sphere_#1" radius="500.0" sky_sphere="true" segments="100">
    <colorSky1 size="3">
             1.0 0.2 0.0
    </colorSky1>
    <colorSky2 size="3" bounding="0.002">
             1.0 0.2 0.0
    </colorSky2>
    <colorSky3 size="3">
             0.8 0.1 0.0
    </colorSky3>
    <colorSky4 size="3" bounding="0.200">
             0.2 0.2 0.3
    </colorSky4>
    <colorBozo1 size="3">
             0.85 0.85 0.85
    </colorBozo1>
    <colorBozo2 size="3" bounding="0.1">
             0.75 0.75 0.75
    </colorBozo2>
    <colorBozo3 size="3" bounding="0.5">
             1 1 1
    </colorBozo3>
    <colorBozo4 size="3">
             1 1 1
    </colorBozo4>

    <texture encoding="jpeg" xlink:href="textures/garden_deepsea.jpg" id="sky-sea"/>
  </sphere>
</node>