Scene description language

From HandWiki
Short description: Programming language used to describe a scene to a 3D graphics renderer


A scene description language is any description language used to describe a scene to a 3D renderer, such as a ray tracer. The scene is written in a text editor (which may include syntax highlighting), as opposed to being modeled in a graphical way, but a 3D modelling program may allow for a scene to be exported to a specified scene description language.

Some scene description languages may include variables, constants, conditional statements, and while and for loops.

For example, 3DMLW and X3D are XML-based scene description languages; YafaRay also employs an XML-based language. Tao Presentations uses XL as a dynamic document description language. POV-Ray has its own Turing-complete language.

Examples

POV-Ray

POV-Ray image output based on the script
#declare the_angle = 0;

 #while (the_angle < 360)
 	box {   <-0.5, -0.5, -0.5>
 		<0.5, 0.5, 0.5>
                texture { pigment { color Red }
                          finish  { specular 0.6 }
                          normal  { agate 0.25 scale 1/2 } }
 		rotate the_angle }
 	#declare the_angle = the_angle + 45;
 #end

3DMLW

<?xml version="1.0" standalone="no"?>
<document>
  <content2d>
    <area width="200" height="100" color="#C0C0C0FF" texture="flower.png" />
  </content2d>
  <content3d id="content" camera="{#cam}">
    <camera id="cam" class="cam_rotation" y="10" z="40" viewy="10"/>
    <box name="ground" width="100" height="2" depth="100" color="green" class="ground" />
    <box name="dynamic" y="20" width="10" height="10" depth="10" color="blue" />
  </content3d>
</document>

X3D

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "http://www.web3d.org/specifications/x3d-3.2.dtd">

<X3D profile="Interchange" version="3.2" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation=" http://www.web3d.org/specifications/x3d-3.2.xsd ">
<Scene>
  <Shape>
    <IndexedFaceSet coordIndex="0 1 2">
      <Coordinate point="0 0 0 1 0 0 0.5 1 0"/>
    </IndexedFaceSet>
  </Shape>
</Scene>
</X3D>
Real-time 3D rendering of a scene described using Tao Presentations document description language

Tao Presentations

clear_color 0, 0, 0, 1
light 0
light_position 1000, 1000, 1000
draw_sphere with 1..50

rotatey 0.05 * mouse_x
text_box 0, 0, 800, 600,
    extrude_depth 25
    extrude_radius 5
    align_center
    vertical_align_center
    font "Arial", 300
    color "white"
    text "3D"
    line_break
    font_size 80
    text zero hours & ":" & zero minutes & ":" & zero seconds

draw_sphere N ->
    locally
        color_hsv 20 * N, 0.3, 1
        translate 300*cos(N*0.1+time), 300*sin(N*0.17+time), 500*sin(N*0.23+time)
        sphere 50

zero N -> if N < 10 then "0" & text N else text N

See also

  • List of 3D graphics file formats
  • VRML
  • X3D