Datastructures for the Rayman hardware raytracer.

Registers

RAYTRACER_COMMAND
RAYTRACER_STATUS
SCENE_ADDRESS

Enums

RAYTRACER_COMMAND.command
RAYTRACER_STATUS.status

Descriptors

scene_descriptor
sphere_descriptor
material_descriptor

RAYTRACER_COMMAND

      ADDRESS: 0x00000000
      ACCESS : RW

The command register is used in order to give commands to the raytracer.

bits name reset_val usage
2:0 command COMMAND_NOP Command issued to the raytracer.
31:3 reserved 0 Reserved bits. Set to 0.

RAYTRACER_STATUS

      ADDRESS: 0x00000004
      ACCESS : RO

The status register is used in order to get information about the current status.

bits name reset_val usage
2:0 status STATUS_IDLE Status information.
7:3 reserved 0 Reserved bits. Set to 0.
15:8 progress 0 Indicates rendring progress. (0=just started, 255=complete)
31:16 reserved 0 Reserved bits. Set to 0.

SCENE_ADDRESS

      ADDRESS: 0x00000008
      ACCESS : RW

The command register is used in order to give commands to the raytracer.

bits name reset_val usage
31:0 address 0x80000000 Physical address of the scene_descriptor to render next.

RAYTRACER_COMMAND.command

Legal values for the command field of the RAYTRACER_COMMAND register.

encoding symbol usage
0 COMMAND_NOP COMMAND_NOP is the value returned when reading the register when the raytracer is idle
1 COMMAND_RUN Write COMMAND_RUN to the register and the raytracer will start rendering the scene. The scene descriptor for the scene is located in the SCENE_ADDRESS register. Subsequent writes of COMMAND_RUN to this register is ignored while the raytracer is busy rendring.
2 COMMAND_STOP Write COMMAND_STOP to the register while the raytracer is rendering in order to abort the current rendring gracefully. The command is ignored if the raytracer is already idle.
3 COMMAND_CLEAR_IRQ Write COMMAND_CLEAR_IRQ in order to force the interrupt signal to 0.
4-7 RESERVED Reserved encoding for future use.

RAYTRACER_STATUS.status

Legal values for the status field of the RAYTRACER_STATUS register.

encoding symbol usage
0 STATUS_IDLE STATUS_IDLE is the value returned when reading the register when the raytracer is idle.
1 STATUS_BUSY STATUS_BUSY is the value returned when the raytracer is busy rendring.
2-7 RESERVED Reserved encoding for future use.

scene_descriptor

The descriptor contains light and camera positions and the size of the screen. In addition to that it contains a pointer to the array of spheres and the material these consist of.

The scene descriptor will be stored in memory before the rendering is started and read into the ray tracer using the AXI bus. The position (i.e. address) of the descriptor in memory is given to the ray tracer by writing the address into the SCENE_ADDRESS register.

word bits name usage
0 31:0 light_x_position x coordinate (FP32) of the light position.
1 31:0 light_y_position y coordinate (FP32) of the light position.
2 31:0 light_z_position z coordinate (FP32) of the light position.
3 31:0 cam_pos_x x coordinate (FP32) of the camera position.
4 31:0 cam_pos_y y coordinate (FP32) of the camera position.
5 31:0 cam_pos_z z coordinate (FP32) of the camera position.
6 31:0 cam_point_x x coordinate (FP32) of the camera look_at_point.
7 31:0 cam_point_y y coordinate (FP32) of the camera look_at_point.
8 31:0 cam_point_z z coordinate (FP32) of the camera look_at_point.
9 31:0 cam_fov Field of view (FP32) of the camera in degrees.
10 15:0 screen_x_size Horizontal(x direction) size (UINT16) of the screen.
10 31:16 screen_y_size Vertical(y direction) size (UINT16) of the screen.
11 31:0 sphere_descriptor_array_pointer 32 bit address pointing at the first sphere_descriptor in the scene. It is assumed that all sphere_descriptors are placed after eachother in memory.
12 31:0 sphere_descriptor_array_size Number of (UINT32) sphere_descriptors in the sphere_descriptor_array.
13 31:0 material_descriptor_array_pointer 32 bit address pointing at the first material_descriptor in the scene. It is assumed that all instances of material_descriptor are placed after eachother in memory.
14 31:0 material_descriptor_array_size Number of (UINT32) material_descriptors in the material_descriptor_array.

sphere_descriptor

Sphere is a primitive type. It is specified by it's center coordinate and radius.

word bits name usage
0 31:0 sphere_pos_x The x coordinate (FP32) of the origin of the sphere.
1 31:0 sphere_pos_y The y coordinate (FP32) of the origin of the sphere.
2 31:0 sphere_pos_z The z coordinate (FP32) of the origin of the sphere.
3 31:0 sphere_rad_squared The radius squared (FP32) of the sphere.
4 31:0 sphere_rad_inverse The inverse radius (FP32) of the sphere.
5 2:0 material_id Index for selecting material type for the primitive.
5 31:3 reserved Reserved bits. These must be set to 0

material_descriptor

The primitives in the scene will have different colours, transparancy level and shininess. This is controlled by the material_descriptor.

word bits name usage
0 7:0 ambient_color_r The red component (FX1.7) of the ambient color. Valid range: [0,1.0].
0 15:8 ambient_color_g The green component (FX1.7) of the ambient color. Valid range: [0,1.0].
0 23:16 ambient_color_b The blue component (FX1.7) of the ambient color. Valid range: [0,1.0].
0 31:24 reserved Reserved bits. Set to 0.
1 7:0 diffuse_color_r The red component (FX1.7) of the diffuse color. Valid range: [0,1.0].
1 15:8 diffuse_color_g The green component (FX1.7) of the diffuse color. Valid range: [0,1.0].
1 23:16 diffuse_color_b The blue component (FX1.7) of the diffuse color. Valid range: [0,1.0].
1 31:24 reserved Reserved bits. Set to 0.
2 7:0 specular_color_r The red component (FX1.7) of the specular color. Valid range: [0,1.0].
2 15:8 specular_color_g The green component (FX1.7) of the specular color. Valid range: [0,1.0].
2 23:16 specular_color_b The blue component (FX1.7) of the specular color. Valid range: [0,1.0].
2 31:24 reserved Reserved bits. Set to 0.
3 7:0 k_refl Reflection coefficient (FX1.7). Valid range: [0,1.0]. A value of 1.0 indicates max reflection.
3 15:8 shininess Shininess (UINT8) used when computing the specular color.
3 31:16 reserved Reserved bits. Set to 0.