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

Saturday, April 28, 2012

No srgb support in HD graphics..

Through a problem that i encountered  I learned that in the config below HD graphics cannot show sRGB color mode so it is advisable , in order to have the same output with every card, to disable sRGB mode in your code :


in your main function.

( My  PC has the monitor connected to an Intel HD graphics iGPU and using two Geforces as  dedicated cuda devices)

Solution-Sponsor : Kyle Hayward

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.

Thursday, April 26, 2012

Bidirectional Path Tracing using Nvidia Optix , Part 7 (Scene Loader)

My next installment in the thesis project is a scene loader.

I used the free open source Pugi XML API which is very easy , magnitudes easier than anything else I tried. And i describe my scene using an xml -document. My code is simpler now and any changes can be made quickly.

An simple example of an XML file with the scene parameters and materials only (no geometry , to maintain simplicity ) is this.

I remind you that i haven't found a way to do the tile processing , the problem that i described in the latter post. So, any help is still welcome.

Sunday, April 22, 2012

Bidirectional Path Tracing using Nvidia Optix , Part 6 (Correct Refractions)

My last accomplishment on my way to create this renderer is the correction of the refractive materials.

In the following pictures, the material of the ball is totally refractive so it is not to be mistaken for real-world glass for example. In the last picture , the refractive material is exaggerated to highlight the appearance of colored caustics

At the moment I am creating an xml scene loader for easy scene parameter and geometry  loading.

Thursday, April 12, 2012

Bidirectional Path Tracing using Nvidia Optix , Part 5 (Better Reflections, organization,bugfixes)

After a bit lazy fortnight , I have made some slow but steady progress , it is not much but nevertheless...

The rendering results have not changed  much but i have made some improvements . 

Now in the case of reflections i have corrected the mistake which occurred when we had an eye-path that contained a point with reflective material. In that case , if the next hitpoint after the reflection was a point on the light then the light would not be seen (appeared to be black) . That happened because the possibility to hit the random light point of the light-path, was practically zero. So in that situation, i consider only  one path (eye-path +that point only the light) and not the all-by-all combinations , practicing path tracing.

I have also made some optimization concerning the memory consumption. Especially , with the usage of materials in the cuda code. I have also added the creation of .Obj objects but i have some problems with the materials on the rendered objects so proper objs will be shown on the next post.

Also added point lights into the mix

I have tried to use two cards for the rendering ,a GTX 560ti and a GTX 460 , totaling 722 cuda cores , with very nice results. The scaling is not perfect but in my code is good enough. 100% gpu usage for the main card ( GTX 560ti  ) and about 85%-92% for the secondary (GTX 460) 

560 on the left-460 on the right
Next steps are : 

a.To create a proper Scene Loader

        b.Materials on obj s  ,usage of more complicated material properties , material containing textures etc.
       c.Importance sampling for many lights.
       d.Correct refractions because the present code contains a load of small errors.

Point Light example

Correct (or so it seems) reflections 

See you next week!