Graphics Reference
In-Depth Information
void gammaton_entry_program ()
{ // initialize payload
Ray ray ; GammaPayload prd ;
prd . ray_index = launch_index + g_SourceRayIndexOffset ;
prd . ray_depth =0; // counts recursions
// get gammaton data (ping pong)
GammaHitShared & hitshared_i = HitShared_In [ prd . ray_index ];
GammaHitShared & hitshared_o = HitShared_Out [ prd . ray_index ];
// if gammaton is alive , continue the ray
if ( IS_ALIVE ( hitshared_i . flags ))
{ // continue from last position
ray . origin = HitOptix [ prd . ray_index ]. position ;
ray . direction = normalize ( hitshared_i . velocity );
prd . speed = length ( hitshared_i . velocity );
hitshared_o . carriedMaterial = hitshared_i . carriedMaterial ;
} else // else emit a new ray
{ ray . origin = generateRandomPosition () ;
ray . direction = generateRandomDirection ()
prd . speed = g_InitialVelocity ;
hitshared_o . carriedMaterial = g_StartMaterial ;
}
SET_ALIVE ( hitshared_o . flags ) // set alive
SET_BOUNCE ( hitshared_o . flags ) // flying freely
hitshared_o . randomSeed = hitshared_i . randomSeed ; // pass seed
float maxDist = prd . speed ￿ g_IntegrationStepSize ;
optixTraceGammaton ( ray , prd , maxDist );
// launch ray
}
Listing 3.2. OptiX/CUDA entry program for gammaton emission and continue.
1 st emitter
2 nd emitter
Consecutive
buffer
123
n 1
23
m
Offset = 0
Offset = n
Figure 3.6. All gammaton emitters share an output gammaton stream. For each emitter
a contiguous memory block is reserved to store the respective particles (here, n and m ).
Each gammaton keeps its address, even when inactive.
the estimated surface normal (see Section 3.3.5), and the outgoing direction is
randomized by Phong lobe sampling for spreading material. For floating particles
the resulting velocity vector is projected back into the tangent plane.
Search WWH ::




Custom Search