Launch_index and Launch_dim

Hi,

I’m new to Optix. Can someone please help me in understanding the Launch_index and Launch_dim. What do they represent? and how are they used in ray generation? The API reference only talks about the data type to be assigned to rtLaunchIndex and rtLaunchDim.

Thank You

The launch dimension contains the rtContexLaunch call parameters width, height, and depth of your current launch call.
The launch index is the cell you’re currently working on in this program invocation.
Since there are thousands of threads running at the same time, each of them has a unique launch index.

The OptiX Programming Guide contains more information about this in Chapter 4. Programs.

Thanks for your reply.

I understand now. Another thing is I’m trying to understand the pinhole_camera.cu given in the SDK. I got stuck at understanding the line:

float2 d = make_float2(launch_index) / make_float2(launch_dim) * 2.f - 1.5f;

What I don’t understand is how can we divide one vector with another vector(launch_index and launch_dim both being 2 dimensional)? What is the output (ie. what is d? )?

Thanks in advance.

float2, float3, float4, and the like are built-in vector types in CUDA C which have operators defined for the usual math operations. Operations are per component. This is common use in all modern shading or compute languages.

If you have no experience with CUDA C which is used to build the OptiX programs, you should also read through the CUDA C Programming Guide you find inside the CUDA Toolkit installation’s doc/pdf folder.

CUDA 5.0 CUDA_C_Programming_Guide.pdf Appendix B. CUDA C Language Extensions explains this in B.3 Built-in Vector Types.

Yes, I should have done that. I feel dumb now.

Thanks for the help. Appreciate it :)