Invitation

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

Monday, March 12, 2012

Bidirectional Path Tracing using Nvidia Optix , Part 3 (Simple Refractions)

Hello !

Today i managed to create the first simple refractions into my project.The refractions are far from finished yet but i think they are good enough to show them to you. As you can see i have also implemented spherical lights

The material has refractions only , without anything else and it is also simple ,without any tricks yet.

_____________________________________________________________________
SAMPLE CODE :


 //refraction coefficient


current_prd.countEmitted = true;
float ior = 0.0;
 if(!current_prd.inside)
ior=1.33;
 else
ior=1/1.33;

if(refract(current_prd.direction, ray.direction, ffnormal, ior))
{
if(current_prd.inside)
{
current_prd.cos1 = dot( -ffnormal, -ray.direction );
current_prd.cos2 = dot( ffnormal, current_prd.direction );
}
else
{
current_prd.cos1 = dot( ffnormal, -ray.direction );
current_prd.cos2 = dot( -ffnormal, current_prd.direction );
}

}
else//internal reflection
{
current_prd.direction = reflect(ray.direction,- ffnormal);

current_prd.cos1 = dot( -ffnormal, -ray.direction );
current_prd.cos2 = dot(- ffnormal, current_prd.direction );
}


current_prd.attenuation = diffuse_color*Kt;

if(current_prd.inside)
{
 //Compute Beer's law
current_prd.attenuation = current_prd.attenuation * powf( diffuse_color , t_hit);
}

current_prd.inside = !current_prd.inside;

current_prd.hitDistance =   length(ray.origin - hitpoint);
current_prd.ffnormal = ffnormal;

 _________________________________________

Please , i need your comments to make it better and find any mistakes that i make !

Render 2

4 comments:

  1. I have corrected the renders , tomorrow I will focus on some performance tweaks that i feel I have to implement.

    Now it is running at 13 fps (maxdepth = 5 and 512X512 pixels) If my calculations are right, after the tweaks, it will be double

    ReplyDelete
  2. For the record the initial fps of the first pictures was around 3-3.5

    Running on my pc , the original nvidia path tracer example achieves around 15 fps with Optix 2.5

    ReplyDelete
  3. Some of my result:

    http://www.kuaipan.cn/file/id_18461629159051044.html

    in Chinese...sorry. Just click the left most big blue button to download.

    ReplyDelete
  4. Hi, Constantinos. I'm Emre and I'm trying to implement a radar with optiX. I've read all the NVIDIA Programming Guide but still I' cant figure out how to use optiX in OpenGL or DirectX. Could you please help me ?

    Thank you in advance.

    ReplyDelete