How can I make a renderer from Optix?

Dear m1,

Glad to hear that you have built it successfully. About the DLLs, there are somes lines describing these in CMakeList.txt of Optix. At the last part of CMakeList.txt of Optix, there is a paragraph says “This copies out dlls into the build directories, so that users no longer need to copy…”. These part of CMakeList.txt do the work of coping DLLs.

And I’m quite happy that you want to help me. Next time I come into a problem, I will post it on this forum too. I also think Detlef Roettger and other people I met on this forum are quite helpful and frinedly.

Actually I’m an employee of an electric power company in China. Power plant, transformer, transmission line, those kind of things. SIMENS of Germany is one of the best companies in this area.

I learnt Optix in my spare time now. Optix is the first CG program I know. When I was a student in university, I learnt power system. But my research involved in CUDA and parallel computing. So I know CUDA.
I did my project in RHEL(Red Hat Enterprise Linux). So I’m familiar with CMAKE, MAKEFILE, Nsight(Eclipse Edition. It’s quite a good IDE and profiler).

Hope my knowledge will help you.

Hello Detlef Roettger,
I read code these days in detail. And I have a question for refraction. In Optix 4.1.1, sample “optixTutorial”, there is a file whose name is tutorial10.cu. The glass_closest_hit_radiance() writes

// check for external or internal reflection
      float cos_theta = dot(i, n);
      if (cos_theta < 0.0f)
        cos_theta = -cos_theta;
      else
        cos_theta = dot(t, n);

When cos_theta>0.0f, cos_theta = dot(t, n). But what is reason for this step? I mean t is refraction ray. Why we use refraction ray to calculate the cos_theta?

Look a few lines further what happens with the cos_theta value. Maybe take a pencil and paper and draw the volume, rays, and normals and you’ll see that this case handles the Fresnel weighting of the incoming radiance along the refraction ray leaving the volume.
It’s a recursive Whitted renderer. Note that the remainder of the reflection amount (1.0f - reflection) is transported back along the initial ray direction in
result += (1.0f - reflection) * refraction_color * refr_prd.result;

Hello Detlef Roettger,

Thank you very much. It’s my mistake. I forget that the incident ray in ray tracing is actually from eye to mesh. In real scene, ray comes out from light source, not from eye.

Hello Detlef Roettger,
I read code these days in detail. And I have a question for the ray tracing phase of progressive photon mapping. In Optix 4.1.1, advances sample “optixProgressivePhotonMap”, there is a file whose name is ppm_rtpass.cu. In rtpass_closest_hit(), it seems that the ray_depth of hit_prd has no use. But in my mind, we should limit the max depth. Like

if (prd_radiance.depth < min(refraction_maxdepth, max_depth))
{
  do something
}

Do I make any mistakes?

Yes, that looks like it could bounce indefinitely between two specular surfaces and should limit the number of rtTrace() recursions.

Thank you Detlef Roettger,

I will modify this part in my code.

Hello Detlef Roettger,

I have a problem these days. Although I have solved it, I think I should report it to you. Maybe you have a better solution.
Several days ago, I added a module to my VS2017 community version by VS installer. And the installer update my whole VS2017 to 15.5.7. My previous version is installed in October, 2017. So it may be 15.4.1. After the update, I failed to compile my Optix projects. The compiler reported that "unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported! ". So I modified the related code in “host_config.h”.

#if _MSC_VER < 1600 || _MSC_VER > 2011

After the modification, new errors “expression must have a constant value” show up in the file type_trails.h. I’m quite confused on this error. And I even don’t know which part caused the problem.
After that, I used VS2015. And VS2015 worked fine, reported no error. I think it’s a stabler version.

I also checked Google. Google told me that there are other people having this problem.
https://devtalk.nvidia.com/default/topic/1027209/cuda-setup-and-installation/cuda-9-0-does-not-work-with-the-latest-vs-2017-update/
https://devtalk.nvidia.com/default/topic/1027299/cuda-setup-and-installation/cuda-9-failed-to-support-the-latest-visual-studio-2017-version-15-5/1
It seems that there is no cure in VS2017 for this problem. Most of people returned to VS2015, or used toolkit of VS2015 in VS2017 IDE. I report this to you to warn you be careful when updating VS2017.