I’am trying to use Optix 5.1, and I set the fov to 30 and the max trace time to one to to simulate Lidar behavior,however there are some points that shouldn’t be in the final output.
Here is my Ray Generation program
RT_PROGRAM void pinhole_camera()
{
size_t2 screen = output_buffer.size();
unsigned int seed = tea<16>(screen.x*launch_index.y+launch_index.x, frame);
float2 d = (make_float2(launch_index)) / make_float2(screen) * 2.f - 1.f;
float3 ray_origin = eye;
float3 ray_direction = normalize(d.x*U + d.y*V + W);
PerRayData_radiance prd;
prd.depth = 0;
prd.seed = seed;
prd.done = false;
prd.pdf = 0.0f;
prd.specularBounce = false;
// These represent the current shading state and will be set by the closest-hit or miss program
// attenuation (<= 1) from surface interaction.
prd.throughput = make_float3( 1.0f );
// light from a light source or miss program
prd.radiance = make_float3( 0.0f );
// next ray to be traced
prd.origin = make_float3( 0.0f );
prd.direction = make_float3( 0.0f );
float3 result = make_float3( 0.0f );
// Main render loop. This is not recursive, and for high ray depths
// will generally perform better than tracing radiance rays recursively
// in closest hit programs.
for(;;) {
optix::Ray ray(ray_origin, ray_direction, /*ray type*/ 0, scene_epsilon );
rtTrace(top_object, ray, prd);
if ( prd.done || prd.depth >= max_depth)
break;
prd.depth++;
// Update ray data for the next path segment
ray_origin = prd.origin;
ray_direction = prd.direction;
}
result = prd.radiance;
float4 acc_val = accum_buffer[launch_index];
if( frame > 0 ) {
acc_val = lerp( acc_val, make_float4( result, 0.f ), 1.0f / static_cast<float>( frame+1 ) );
} else {
acc_val = make_float4( result, 0.f );
}
float4 val = LinearToSrgb(ToneMap(acc_val, 1.5));
//float4 val = LinearToSrgb(acc_val);
output_buffer[launch_index] = make_color(make_float3(val));
accum_buffer[launch_index] = acc_val;
Here is what I see in the Optix
And there is the point cloud output
Thanks a lot.