Texture coordinates error in path tracing


I’m working in Optix 4.0.0 PathTracer SDK sample. I added textures to the path tracer and works absolutely fine with the parallelogram geometry. I added a sphere geometry and it was working fine until I tried to add textures. I’m getting this error as follows.

OptiX Error: ‘Invalid context (Details: Function “_rtContextValidate” caught exception: Validation error: Attribute “_attribute_texcoord” is referenced in a hit program but is not produced in attached intersection program, file:C:\u\workspace\rel4.0-win64-build-Release\sw\wsapps\raytracing\rtsdk\rel4.0\src\Context\ValidationManager.cpp, line: 103)’

I have declared texcoord and assigned value similar to as it is in the parallelogram intersection routine, but for some reason the error says it is not produced in intersection program. The other common attributes like shading normal and geometry normal works the same way without any issues. I also tried separately compiling the sphere cuda file using nvcc.exe but to no good. Please let me know what could be causing this.

Thanks in advance.

Alright. I have figured out the issue myself that I have to compile sphere.cu separately and update in the lib/ptx folder(I was updating in the wrong folder).

Now my question is what change should I make in project properties or build properties to compile my sphere.cu in the same way the pathtracer.cu and parallelogram.cu are automatically compiled into the right location. I’m using MS Visual Studio 2013.

I want the sphere.cu to compile with the project rather than doing it separately using nvcc.exe to generate ptx and putting it in the right folder.

The samples do this by listing the .cu input files in CMakeLists.txt, then re-running cmake-gui to regenerate the VS solution. I’m pasting a snippet below.

OPTIX_add_sample_executable( optixPathTracer 

        ## add sphere.cu and other files here, one per line, as above

Most build-related things like this are defined by CMake files, so it’s a good idea to grep those first. If you don’t want to use CMake, there are ways to generate PTX directly in VS.