Optix Prime, Loading meshes, Building sbvh or trbvh, Using watertight option,

Greetings,

First of all I am completely new to OptiX and OptiX Prime, so if these are trivial questions please do forgive me. I am yet to go over the programming guide and api documentation. Even if you cannot give complete answers, I would greatly appreciate if you can point me in the right direction.

I am involved in an application which maps aerial quadcopter images to digital elevation maps. So primeInstancing project in Optix SDK samples seemed as a great point to start. The elevation data is defined completely on a regular grid (every 1m along x and y axes on the ground). This regular mesh is completely opaque.

  1. How can I import the above mentioned regular mesh to my program? I have checked PrimeMesh class in primeCommon.h and Mesh struct in Mesh.h itself but I am not sure how tri_indices and mat_indices are defined. Let us assume I have such a grid, do I need to define indices as in:

(I am currently trying to create .obj files of my regular grid mesh, but this cannot be a long term solution)

  1. In order to make things faster I do wish to use a BVH structure (sBVH or TrBVH). Does OptiX Prime handle this by itself (for instance when I define a Model Object) or do I need to define this? If so, how?

  2. If I can construct these BVHs, is there a mechanism to serialize BVHs? Even though the portion of the elevation data at an instance I need to plan is small, total area to cover is not and loading precomputed BVHs from disk to ram to device memory in a predictive manner may be desirable.

  3. When I use RTP_BUFFER_FORMAT_HIT_T_TRIID_U_V, how can I determine which corner of the triangle correspond to u, which one to v and which one to w=1-u-v?

  4. I wanted to make sure that ray intersection operations to be watertight and I have come across RTP_QUERY_HINT_WATERTIGHT, but it says the following in its enumeration “Use watertight ray-triangle intersection, but only if the RTP_BUILDER_PARAM_USE_CALLER_TRIANGLES builder parameter is also set”. Could you please explain this a little bit more?

  5. I do wish to use u and v values of the intersection to compute actual physical coordinates and I do wish to do this with another CUDA kernel. Is there anything I need to consider while accessing, RTP_BUFFER_TYPE_CUDA_LINEAR type buffer.

Thank you very much and sorry for the barrage of questions

Hi there,

The OptiX programming guide is covering quite a few of these topics, I recommend starting there, but I’ll make some notes here just to quick-start you.

1- You give OptiX a buffer of vertices. Indices are optional. If your verts come in triplets that define triangles in order, then you don’t need indices. Otherwise, you can give a buffer of indices into the vertex array that define your triangles. This is pretty standard, similar to obj and gltf and other formats as well as most mesh APIs. https://raytracing-docs.nvidia.com/optix_6_0/guide_6_0/index.html#prime#triangle-models

2- BVHs are created and traversed for you.

3- It’s faster to build a BVH from scratch than serialize, so we do not provide a way to serialize.

4- Your UVs will correspond to the vertex order of your triangle.

5- The link above on triangle models describes what RTP_BUILDER_PARAM_USE_CALLER_TRIANGLES does.

6- RTP_BUFFER_TYPE_CUDA_LINEAR means your buffer is a block of CUDA memory on your GPU. There’s nothing else to consider, you can run a separate kernel on it to compute hit points after your OptiX prime launch is complete.


David.