Graphics Reference
In-Depth Information
//Informationagammatoncarries duringtracing
struct GammaPayload
{ uint ray_index ;
// index in the hit buffers
uint ray_depth ;
// number of ray indirections
float speed ;
// speed (multiplied with direction)
}
;
//HitbufferdatathatisusedbyOptiXonly.
struct GammaHitOptix
{ float3 position ;
// position of the gammaton
} ;
// Hit buffer data that is shared between DirectX and OptiX
struct GammaHitShared
{ float3 velocity ; // velocity vector
int flags ; // midair ( yes/no) , active ( yes/no)
float2 texcoord ; // atlas coord at last hit surface
uint2 carriedMaterial ;
// 8 bytes = 8 material slots
int randomSeed ;
// seed for random number generation
} ;
Listing 3.1. Data stored for the gammatons.
Recursive ray tracing. The CUDA entry program that launches the gammatons
is shown in Listing 3.2 and works as follows: If a gammaton is active, i.e., it is
currently midair or received a new direction in response to a collision, we continue
the tracing from its last known position. Otherwise a gammaton is not active,
i.e., it left the simulation domain, came to a halt on a nearly horizontal surface,
or was absorbed. In that case, a new gammaton is emitted. This entry program
is executed for each gammaton source in turn, using customizable emission pa-
rameters, e.g., position, direction, speed, and distribution. For the subsequent
parallel processing of all gammatons, we assign each source an exclusive range of
memory of a shared gammaton stream. Therefore, we set for each source a start
offset g_SourceRayIndexOffset , as shown in Figure 3.6. The gammaton trajectory
is traced as a recursive series of linear steps, each reporting a hit or miss. In Op-
tiX, kernels are called for the respective events, as shown in Listings 3.3 and 3.4.
In each step, we add gravity according to the traveled distance, which results in
parabolic trajectories. For floating particles, gravity is acting tangentially. We
trace a fixed number of linear steps per iteration until either a surface got hit,
the gammaton left the domain, or the maximum recurrence depth is reached. In
the latter case, we mark the gammaton as midair (flag). The material transport
that is issued on impact of a gammaton is described later in Section 3.3.3. The
collision response is selected by Russian Roulette on the events bouncing, float-
ing, and absorbing (see Figure 3.3), according to their associated probabilities.
Bouncing and floating particles are reflected by the tangent plane orthogonal to
Search WWH ::




Custom Search