The launch index [0, 0] in OptiX examples is normally starting at the lower left corner of the rendered image.
That’s matching what OpenGL glTex(Sub)Image2D() calls expect, means the texel data can be uploaded straight from an OptiX output buffer becuase it has the same linear memory layout.
Please have a look at page 18 of this GTC 2018 presentation which shows a picture of the usual pinhole camera layout in OptiX examples: OptiX Introduction
Do you mean you want to have a parallel projection of the rays?
But using the original pinhole camera origin and U,V,W vector description?
In that case you would need to change the routine inside optixTriangle
static __forceinline__ __device__ void computeRay( uint3 idx, uint3 dim, float3& origin, float3& direction )
const float3 U = params.cam_u;
const float3 V = params.cam_v;
const float3 W = params.cam_w;
const float2 d = 2.0f * make_float2(
// Mind that this is the lower left corner of each pixel
// This should better be (static_cast<float>( idx.x ) + 0.5f) and (static_cast<float>( idx.y ) + 0.5f) to shoot through the pixel center.
static_cast<float>( idx.x ) / static_cast<float>( dim.x ),
static_cast<float>( idx.y ) / static_cast<float>( dim.y )
) - 1.0f;
origin = params.cam_eye; // All rays start at the camera position
direction = normalize( d.x * U + d.y * V + W ); // The direction of each ray per launch index goes through the center of the pixel (when changing "d" it as I said above.)
to something like this:
origin = params.cam_eye + d.x * U + d.y * V; // Shift the origin parallel to the pinhole camera projection plane.
direction = normalize( W ); // Shoot parallel rays in view direction.
Note that the U,V,W vectors are not normalizes and not necessarily orthogonal.
That pinhole camera representation would allow sheared views as well, but that is normally not used inside the OptiX examples.