Skip to content

Commit f0ce4bf

Browse files
authored
Implement sub-sampling in raytracing code (#277)
* Implement sub-sampling in raytracing code * Review fixes
1 parent f3ab7c8 commit f0ce4bf

File tree

8 files changed

+286
-126
lines changed

8 files changed

+286
-126
lines changed

include/rgl/api/core.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,15 @@ typedef enum : int32_t
382382
RGL_FIELD_DYNAMIC_FORMAT = 13842,
383383
} rgl_field_t;
384384

385+
/**
386+
* Kinds of return type for multi-return LiDAR output.
387+
*/
388+
typedef enum : int32_t
389+
{
390+
RGL_RETURN_TYPE_FIRST = 0,
391+
RGL_RETURN_TYPE_LAST = 1,
392+
} rgl_return_type_t;
393+
385394
/**
386395
* Helper enum for axis selection
387396
*/

src/gpu/MultiReturn.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2024 Robotec.AI
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#pragma once
16+
17+
#include <RGLFields.hpp>
18+
19+
#define MULTI_RETURN_BEAM_VERTICES 8
20+
#define MULTI_RETURN_BEAM_CIRCLES 2
21+
#define MULTI_RETURN_BEAM_SAMPLES (1 + (MULTI_RETURN_BEAM_VERTICES * MULTI_RETURN_BEAM_CIRCLES))
22+
23+
struct MultiReturnPointers
24+
{
25+
Field<IS_HIT_I32>::type* isHit;
26+
Field<XYZ_VEC3_F32>::type* xyz;
27+
Field<DISTANCE_F32>::type* distance;
28+
};

src/gpu/RaytraceRequestContext.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <optix.h>
1818
#include <RGLFields.hpp>
19+
#include <gpu/MultiReturn.hpp>
1920

2021
struct RaytraceRequestContext
2122
{
@@ -38,7 +39,7 @@ struct RaytraceRequestContext
3839
const int* ringIds;
3940
size_t ringIdsCount;
4041

41-
const float* rayTimeOffsets;
42+
const float* rayTimeOffsetsMs;
4243
size_t rayTimeOffsetsCount;
4344

4445
OptixTraversableHandle scene;
@@ -61,5 +62,9 @@ struct RaytraceRequestContext
6162
Field<ELEVATION_F32>::type* elevation;
6263
Field<NORMAL_VEC3_F32>::type* normal;
6364
Field<INCIDENT_ANGLE_F32>::type* incidentAngle;
65+
66+
// Multi-Return
67+
float beamHalfDivergence;
68+
MultiReturnPointers mrSamples;
6469
};
6570
static_assert(std::is_trivially_copyable<RaytraceRequestContext>::value);

0 commit comments

Comments
 (0)