Porting APP from Optix 3.8 (32 bit) to Optix 6.5 (64 bit) : Need some help, please

Here an example (shadow off)

I finally solved ( sort of… )

The problem is the call “rtContextSetEntryPointCount(Self.FContextHandle,CAMERA_COUNT)”

In my program I use two cameras (“pinhole_camera.cu” and “radiosity_camera.cu”). The first is the standard Optix implementation the second is a “buffer based” implemetation that I use to calculate “per vertex” radiosity

If I call rtContextSetEntryPointCount(ctx,2) I get the error (red points)
If I call rtContextSetEntryPointCount(ctx,1) I get no error (no red points)



Since I get RT_EXCEPTION_PAYLOAD_ACCESS_OUT_OF_BOUNDS (added in Optix 6) in the shadow rays and I only get this exception if I enable two entry points in my program, the second entry point has different “call backs” (no shadows for example). How can I manage to define two entry points (two camera types) without catching the new exception?
Do I have to define the program “any_hadow_hit” also on the second entry point even if I don’t use the shadow calculation?
Of course I call only the first program in the example above (pin hole camera)

I have never experienced that error. I cannot say what’s going wrong in your case without having a minimal and complete reproducer project containing all required code.

Using multiple entry points should work. There is even an example inside the chapter 3.1.1 of the OptiX 6.5.0 programming guide showing how to set up two ray generation and two exception programs, one per entry point.

If you switch between them you’d need to make sure the recursion depth is set for the higher value of the two ray generation programs.

Looking over your structures in your provided header files, there is another bool inside the TRadianceRayData structure.
Did you replace that as well?

I would revisit the layout of these structures:
TRadianceRayData contains a bool sub_sample.
TShadowRayData contains a bool Shadowed.
TOptixEA3DTextureData contains an unsigned char MappingMode.
TOptixEA3DGlobalSettings is ending with 19 uchars.
struct_TOptixEA3DVertexData contains a float2
If that structure is shared between OpenGL and OptiX/CUDA vertex attributes, that happens to work because the float2 lies on an 8-byte offset.
Note that OpenGL has not the same alignment restrictions as CUDA. For example, a tightly packed interleaved array with { float3 position, float2 texcoord; } would crash with misaligned access errors on the float2 in CUDA because that is not 8-byte aligned.
For identical structures using CUDA vector types on the host and the device, the host compiler and the CUDA compiler will both pad the structure members according the CUDA alignment restrictions.
But to avoid any inadvertent padding and potential misaligned access violations, I usually place structure members according to their CUDA alignment restrictions from big to small, means float4 (16-byte aligned), then float2 (8-byte aligned) then float3 and float (both 4-byte aligned) then shorts (2-byte aligned) and chars (1-byte “aligned”).
When using these in arrays, I pad the structure size to the element with the maximum alignment restriction. The host and CUDA compiler should do that automatically though.

1 Like

Some progress…
Thanks again

More progress, ported ambient occlusion, anti-aliasing, better refractions, gamma correction, etc…
…Optix Rocks !!!


And if you’re still using custom triangle primitives with your own intersection routine, you haven’t tapped into the hardware ray-triangle intersection performance, yet. That requires the built-in triangle primitives and attribute programs to calculate the final vertex attributes deferred.

Also your scene hierarchy is deeper than two acceleration structures. For maximum BVH traversal performance, the recommendation would be to flatten the scene to an OptiX render graph representation with only two acceleration structures on the path from root to the geometry, means a single Group node at the top-level and the rest all in GeometryGroups (what OptiX 7 describes as IAS → GAS structure). That one instance transform is fully hardware accelerated by the BVH traversal on RTX boards.

I wanted to share with you my progress of integrating Optix 6.5 with our interior design program.

What’s going on with the inconsistent shadows of the couches and tables?

The program calculates both direct light (sun) and indirect global illumination with the sky texure (in HDR mode).
So some shadows come from the sun, others from the GI/Ambient occlusion

I made a version without GI, do you mean the things I marked in red? In fact you’re right, I have to check, good “eye” :-)

Exactly, the table nearest to the pool has a strong shadow from the sun while the other objects, which look to use the same materials, don’t.

I found the problem, some furniture had the “cast shadows” flag disabled by mistake, I corrected it.
Here is a quick render (10 seconds on my RTX 3060 mobile) with all shadows correctly enabled.
Thanks again.

1 Like