Skip to content

Commit

Permalink
Implement sub-sampling in raytracing code
Browse files Browse the repository at this point in the history
  • Loading branch information
prybicki committed Apr 17, 2024
1 parent c1f0a38 commit 11b3583
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 123 deletions.
6 changes: 6 additions & 0 deletions include/rgl/api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ typedef enum : int32_t
RGL_FIELD_DYNAMIC_FORMAT = 13842,
} rgl_field_t;

typedef enum : int32_t
{
RGL_RETURN_TYPE_FIRST = 0,
RGL_RETURN_TYPE_LAST = 1,
} rgl_return_type_t;

/**
* Helper enum for axis selection
*/
Expand Down
28 changes: 28 additions & 0 deletions src/gpu/MultiReturn.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2024 Robotec.AI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <RGLFields.hpp>

#define MULTI_RETURN_BEAM_VERTICES 8
#define MULTI_RETURN_BEAM_CIRCLES 2
#define MULTI_RETURN_BEAM_SAMPLES (1 + (MULTI_RETURN_BEAM_VERTICES * MULTI_RETURN_BEAM_CIRCLES))

struct MultiReturnPointers
{
Field<IS_HIT_I32>::type* isHit;
Field<XYZ_VEC3_F32>::type* xyz;
Field<DISTANCE_F32>::type* distance;
};
7 changes: 6 additions & 1 deletion src/gpu/RaytraceRequestContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <optix.h>
#include <RGLFields.hpp>
#include <gpu/MultiReturn.hpp>

struct RaytraceRequestContext
{
Expand All @@ -38,7 +39,7 @@ struct RaytraceRequestContext
const int* ringIds;
size_t ringIdsCount;

const float* rayTimeOffsets;
const float* rayTimeOffsetsMs;
size_t rayTimeOffsetsCount;

OptixTraversableHandle scene;
Expand All @@ -61,5 +62,9 @@ struct RaytraceRequestContext
Field<ELEVATION_F32>::type* elevation;
Field<NORMAL_VEC3_F32>::type* normal;
Field<INCIDENT_ANGLE_F32>::type* incidentAngle;

// Multi-Return
float beamHalfDivergence;
MultiReturnPointers mrSamples;
};
static_assert(std::is_trivially_copyable<RaytraceRequestContext>::value);
Loading

0 comments on commit 11b3583

Please sign in to comment.