DirectTrace  0.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
More on the conventions and things to know.

Ray Buffers

Ray buffers are here to help with management of rays. They store data related to the rays. This include:

  • Positions and Directions, stored internally as 4 floats, with (x,y,z + ?) for positions, and x,y,z,t for directions, where t is initially a large value, and represents the t (or z) value for the intersection point after running the intersector. Using shaders will make this quite explicit.
  • The primitive type (Triangles, Quads, some splines).
  • Whether rays are active or not, which is more or less opaque to the user. One can however query the number of active rays inside a ray buffer at any time. This may be useful for instance when one needs to know whether a given task (e.g., shader execution) will be processed efficiently or not.
  • Some information about the primitives and materials intersected, which will be automatically used by shaders to point to materials and create normals&uv coordinates at the intersection locations.

By precising tasks for sets of rays instead of a single ray, parallelism can be optimized inside the engine.

Other Points

  • There is currently low tolerance against wrongly formulated intructions that do not respect specifications. Work step by step to move from a safe state to another safe state and query GetLastError whenever possible (not all errors are currently returned).
  • Ray buffers should be seen as a way of storing points and directions in a 3D space.
  • Positions and directions are stored internally as 4 floats, with (x,y,z + ?) for positions, and (x,y,z,t) for directions, where t is initially a large value, and represents the t (or z) for the intersection point after a call to the Intersector() function. Using shaders will make this quite explicit.
  • The state of each ray buffer should be kept in mind when programming. (Already intersected, etc).
  • Large jobs should be performed to be efficient. Try to have as many rays as possible in you pipeline.
  • Ray buffers will contain inactive rays.
  • Try to avoid large buffers of rays having a low percentage of active rays.