OptiX 6.5 implementation of the ray tracing backend. More...
#include <OptiX6Backend.h>
Public Member Functions | |
| void | initialize () override |
| Initialize the ray tracing backend. | |
| void | shutdown () override |
| Shutdown the ray tracing backend. | |
| void | updateGeometry (const RayTracingGeometry &geometry) override |
| Update geometry data in the ray tracing backend. | |
| void | buildAccelerationStructure () override |
| Build or rebuild the acceleration structure. | |
| void | updateMaterials (const RayTracingMaterial &materials) override |
| Update material properties (reflectivity, transmissivity, specular) | |
| void | updateSources (const std::vector< RayTracingSource > &sources) override |
| Update radiation source definitions. | |
| void | updateDiffuseRadiation (const std::vector< float > &flux, const std::vector< float > &extinction, const std::vector< helios::vec3 > &peak_dir, const std::vector< float > &dist_norm, const std::vector< float > &sky_energy) override |
| Update diffuse (ambient) radiation parameters. | |
| void | updateSkyModel (const std::vector< helios::vec4 > &sky_radiance_params, const std::vector< float > &camera_sky_radiance, const helios::vec3 &sun_direction, const std::vector< float > &solar_disk_radiance, float solar_disk_cos_angle) override |
| Update sky radiance model parameters (for camera rendering) | |
| void | launchDirectRays (const RayTracingLaunchParams ¶ms) override |
| Launch direct (unscattered) rays to radiation sources. | |
| void | launchDiffuseRays (const RayTracingLaunchParams ¶ms) override |
| Launch diffuse (hemispherically-distributed) rays. | |
| void | launchCameraRays (const RayTracingLaunchParams ¶ms) override |
| Launch camera rays for image rendering. | |
| void | launchPixelLabelRays (const RayTracingLaunchParams ¶ms) override |
| Launch pixel labeling rays (for primitive identification in images) | |
| void | getRadiationResults (RayTracingResults &results) override |
| Get radiation simulation results. | |
| void | getCameraResults (std::vector< float > &pixel_data, std::vector< uint > &pixel_labels, std::vector< float > &pixel_depths, uint camera_id, const helios::int2 &resolution) override |
| Get camera rendering results. | |
| void | zeroRadiationBuffers (size_t launch_band_count) override |
| Zero all radiation result buffers (radiation_in, radiation_out, radiation_specular) | |
| void | zeroScatterBuffers () override |
| Zero scatter buffers (scatter_buff_top, scatter_buff_bottom) | |
| void | zeroCameraPixelBuffers (const helios::int2 &resolution) override |
| Zero camera pixel label and depth buffers. | |
| void | copyScatterToRadiation () override |
| Copy scatter buffer contents to radiation buffers. | |
| void | uploadRadiationOut (const std::vector< float > &radiation_out_top, const std::vector< float > &radiation_out_bottom) override |
| Upload radiation_out buffers directly (without launching rays) | |
| void | uploadCameraScatterBuffers (const std::vector< float > &scatter_top_cam, const std::vector< float > &scatter_bottom_cam) override |
| Upload camera scatter buffers. | |
| void | zeroCameraScatterBuffers (size_t launch_band_count) override |
| Zero camera scatter buffers (scatter_buff_top_cam, scatter_buff_bottom_cam) | |
| void | uploadSourceFluxes (const std::vector< float > &fluxes) override |
| Upload source flux values for launched bands. | |
| void | uploadSourceFluxesCam (const std::vector< float > &fluxes_cam) override |
| Upload camera-weighted source flux values for specular reflection. | |
| void | queryGPUMemory () const override |
| Query and report GPU memory usage. | |
| std::string | getBackendName () const override |
| Get the name of the backend implementation. | |
Static Public Member Functions | |
| static bool | probe () noexcept |
| Probe whether OptiX 6.5 can create a context. | |
Static Public Member Functions inherited from helios::RayTracingBackend | |
| static std::unique_ptr< RayTracingBackend > | create (const std::string &backend_type) |
| Create a ray tracing backend instance. | |
OptiX 6.5 implementation of the ray tracing backend.
This backend wraps the existing OptiX 6.5 code from RadiationModel, providing the same functionality through the RayTracingBackend interface.
Definition at line 56 of file OptiX6Backend.h.
| OptiX6Backend::OptiX6Backend | ( | ) |
Definition at line 26 of file OptiX6Backend.cpp.
|
override |
Definition at line 48 of file OptiX6Backend.cpp.
|
overridevirtual |
Build or rebuild the acceleration structure.
Constructs the BVH or other acceleration structure for efficient ray traversal. Should be called after updateGeometry() or when geometry changes.
Implements helios::RayTracingBackend.
Definition at line 504 of file OptiX6Backend.cpp.
|
overridevirtual |
Copy scatter buffer contents to radiation buffers.
Used for multi-bounce radiation: scattering iteration results are accumulated into the main radiation buffers.
Implements helios::RayTracingBackend.
Definition at line 895 of file OptiX6Backend.cpp.
|
overridevirtual |
Get the name of the backend implementation.
Implements helios::RayTracingBackend.
Definition at line 960 of file OptiX6Backend.cpp.
|
overridevirtual |
Get camera rendering results.
| [out] | pixel_data | Flattened pixel values [band][pixel_y][pixel_x] |
| [out] | pixel_labels | Primitive UUID for each pixel (0 if sky/miss) |
| [out] | pixel_depths | Depth value for each pixel |
| [in] | camera_id | Camera identifier |
| [in] | resolution | Camera resolution (width, height) |
Implements helios::RayTracingBackend.
Definition at line 790 of file OptiX6Backend.cpp.
|
overridevirtual |
Get radiation simulation results.
| [out] | results | Structure containing radiation_in, radiation_out, scatter buffers, etc. |
Retrieves absorbed and emitted radiation for all primitives and bands.
Implements helios::RayTracingBackend.
Definition at line 775 of file OptiX6Backend.cpp.
|
overridevirtual |
Initialize the ray tracing backend.
Creates the ray tracing context, allocates buffers, compiles/loads programs, and sets up the acceleration structure.
Implements helios::RayTracingBackend.
Definition at line 54 of file OptiX6Backend.cpp.
|
overridevirtual |
Launch camera rays for image rendering.
| [in] | params | Launch parameters including camera position, direction, FOV, etc. |
Implements helios::RayTracingBackend.
Definition at line 697 of file OptiX6Backend.cpp.
|
overridevirtual |
Launch diffuse (hemispherically-distributed) rays.
| [in] | params | Launch parameters including diffuse distribution parameters |
Implements helios::RayTracingBackend.
Definition at line 619 of file OptiX6Backend.cpp.
|
overridevirtual |
Launch direct (unscattered) rays to radiation sources.
| [in] | params | Launch parameters (dimensions, seed, band config, etc.) |
Implements helios::RayTracingBackend.
Definition at line 566 of file OptiX6Backend.cpp.
|
overridevirtual |
Launch pixel labeling rays (for primitive identification in images)
| [in] | params | Launch parameters with camera configuration |
Implements helios::RayTracingBackend.
Definition at line 749 of file OptiX6Backend.cpp.
|
staticnoexcept |
Probe whether OptiX 6.5 can create a context.
Creates and immediately destroys an RTcontext. This is the lightest possible check for OptiX 6.5 since there is no equivalent to optixInit().
Definition at line 30 of file OptiX6Backend.cpp.
|
overridevirtual |
Query and report GPU memory usage.
Implements helios::RayTracingBackend.
Definition at line 947 of file OptiX6Backend.cpp.
|
overridevirtual |
Shutdown the ray tracing backend.
Destroys the context, frees all buffers and resources.
Implements helios::RayTracingBackend.
Definition at line 458 of file OptiX6Backend.cpp.
|
overridevirtual |
Update diffuse (ambient) radiation parameters.
| [in] | flux | Diffuse flux per band |
| [in] | extinction | Extinction coefficient per band |
| [in] | peak_dir | Peak direction for diffuse distribution per band |
| [in] | dist_norm | Distribution normalization factor per band |
| [in] | sky_energy | Energy absorbed by sky per band |
Implements helios::RayTracingBackend.
Definition at line 548 of file OptiX6Backend.cpp.
|
overridevirtual |
Update geometry data in the ray tracing backend.
| [in] | geometry | Geometry data for all primitive types |
This uploads vertex data, transform matrices, UUIDs, texture masks, and all other geometry-related data to the GPU.
Implements helios::RayTracingBackend.
Definition at line 473 of file OptiX6Backend.cpp.
|
overridevirtual |
Update material properties (reflectivity, transmissivity, specular)
| [in] | materials | Material data for all primitives, sources, and bands |
Implements helios::RayTracingBackend.
Definition at line 520 of file OptiX6Backend.cpp.
|
overridevirtual |
Update sky radiance model parameters (for camera rendering)
| [in] | sky_radiance_params | Prague sky model parameters per band (vec4) |
| [in] | camera_sky_radiance | Sky radiance for cameras per band |
| [in] | sun_direction | Direction to the sun |
| [in] | solar_disk_radiance | Solar disk radiance per band |
| [in] | solar_disk_cos_angle | Cosine of solar disk angular radius |
Implements helios::RayTracingBackend.
Definition at line 557 of file OptiX6Backend.cpp.
|
overridevirtual |
Update radiation source definitions.
| [in] | sources | Vector of radiation sources (collimated, sphere, sun, rectangle, disk) |
Implements helios::RayTracingBackend.
Definition at line 536 of file OptiX6Backend.cpp.
|
overridevirtual |
Upload camera scatter buffers.
| [in] | scatter_top_cam | Scattered radiation for cameras (top surface) indexed by [primitive * Nbands_launch + band] |
| [in] | scatter_bottom_cam | Scattered radiation for cameras (bottom surface) |
Used to upload emission energy that cameras should see before scatter iterations.
Implements helios::RayTracingBackend.
Definition at line 918 of file OptiX6Backend.cpp.
|
overridevirtual |
Upload radiation_out buffers directly (without launching rays)
| [in] | radiation_out_top | Top-face outgoing radiation [Nprims * Nbands] |
| [in] | radiation_out_bottom | Bottom-face outgoing radiation [Nprims * Nbands] |
Used to set outgoing radiation for scattering iterations.
Implements helios::RayTracingBackend.
Definition at line 905 of file OptiX6Backend.cpp.
|
overridevirtual |
Upload source flux values for launched bands.
| [in] | fluxes | Source flux values indexed by [source * Nbands_launch + band] |
Used to set per-band source fluxes before direct ray launch.
Implements helios::RayTracingBackend.
Definition at line 931 of file OptiX6Backend.cpp.
|
overridevirtual |
Upload camera-weighted source flux values for specular reflection.
| [in] | fluxes_cam | Camera spectral response weights indexed by [source * Nbands_launch + band] |
Uploads per-camera spectral response weights used for specular reflection in camera rendering. The weights represent ∫(source_spectrum × camera_response) / ∫(source_spectrum) for each source/band combination. Called before each camera render with the current camera's weights.
Implements helios::RayTracingBackend.
Definition at line 941 of file OptiX6Backend.cpp.
|
overridevirtual |
Zero camera pixel label and depth buffers.
| [in] | resolution | Full camera resolution (width, height) |
Must be called before launching pixel label rays for multiple tiles. Each tile launch accumulates results without zeroing, so this must be called once before the tile loop to initialize the buffers.
Implements helios::RayTracingBackend.
Definition at line 882 of file OptiX6Backend.cpp.
|
overridevirtual |
Zero camera scatter buffers (scatter_buff_top_cam, scatter_buff_bottom_cam)
| [in] | launch_band_count | Number of bands being launched in current iteration |
Buffers are sized by launch_band_count to prevent double-counting when accumulating camera scatter across multiple ray launches.
Implements helios::RayTracingBackend.
Definition at line 862 of file OptiX6Backend.cpp.
|
overridevirtual |
Zero all radiation result buffers (radiation_in, radiation_out, radiation_specular)
| [in] | launch_band_count | Number of bands being launched in current iteration |
Camera scatter buffers are sized by launch_band_count (not global band count) to match per-launch accumulation semantics. All other buffers use the global band count.
Implements helios::RayTracingBackend.
Definition at line 802 of file OptiX6Backend.cpp.
|
overridevirtual |
Zero scatter buffers (scatter_buff_top, scatter_buff_bottom)
Implements helios::RayTracingBackend.
Definition at line 846 of file OptiX6Backend.cpp.