Invitation

Whoever wants to contribute to this blog , posting his experiences on the same place, please send me a message !

Friday, April 27, 2012

Bidirectional Path Tracing using Nvidia Optix , Part 8 (Tile-based rendering)

As I have stated before , a problem with implementing BDPT using the Optix API was that it needed to have in memory two buffers sized WIDTH X HEIGHT X MAX_RT_DEPTH each , in order to store the paths from the eye and light respectively.

I had some technical difficulties at first but with the help and encouragement of Kyle Hayward 
I have overcome them.

To solve the problem i  cut the output buffer into several (user-defined number) tiles  , which are rendered one after another instead of the  output buffer as a whole.
____________________________________________________________________________

void PathTracerScene::trace( const RayGenCameraData& camera_data )
{
  _context["eye"]->setFloat( camera_data.eye );
  _context["U"]->setFloat( camera_data.U );
  _context["V"]->setFloat( camera_data.V );
  _context["W"]->setFloat( camera_data.W );

  Buffer buffer = _context["output_buffer"]->getBuffer();
  RTsize buffer_width, buffer_height;
  buffer->getSize( buffer_width, buffer_height );

  if( _camera_changed ) {
    _camera_changed = false;
    _frame = 1;
  }

  _context["frame_number"]->setUint( _frame++ );


  for(int i=0;i<NoOfTiles.x;i++)
  {  
for(int j=0;j<NoOfTiles.y;j++)
{
 
_context["NoOfTiles"]->setInt( i,j);
    _context->launch( 0,
                    static_cast<unsigned int>(launch_index_tileSize.x),
                    static_cast<unsigned int>(launch_index_tileSize.y)
                    );
}
  }

}
_________________________________________________________________________

This is a code snippet  of the Trace C++ - function that calls the optix launches for each tile(bold)


The  full results with multiple Optix Launches on a single GTX-560ti GPU rendering the Cornell scene are here 

And to be honest they are better than i expected.

One  example is this :

1024 X 1024 and maxdepth for each sub-path(light and eye) is 7


Number of tiles fps MB Vram
1 2,45 824
2 2,45 460
4 2,43 278
8 2,4 187


Pay attention to the great decrease in memory consumption.

One remark is also that the percentage of the GPU usage is falling (at least in my system) when i am using multiple GPUs . Using more GPUs (in my case one GTX560ti and one GTX460) didn't increase the performance in a linear way

This is a table for the Cornell Scene in 1024 X 1024 X (5+5) on two GPUs.

Tiles ||  GTX-560ti usage%  || GTX-460 usage% 
1      ||           96                   ||              87
4 ||           93                   ||              73
8 ||           83                   ||              62

I am sure if this is due to the overhead in optix or if the GPUs are different
I thought that the decrease in usage would be smaller.



No comments:

Post a Comment