11#include <Eigen/Geometry>
14#include <unordered_map>
15#include <unordered_set>
28namespace visualization {
31class FilamentResourceManager;
42 Eigen::Vector2i
tile_size = Eigen::Vector2i(16, 16);
77 Camera::ProjectionMatrix::Identity();
79 Camera::Transform::Identity();
166 std::vector<std::uint16_t>& out,
181 std::vector<float>& out,
196 std::vector<std::uint16_t>& out) {
211 const std::unordered_set<const FilamentView*>& live_views);
257 std::vector<std::uint16_t>& out,
264 std::vector<float>& out,
272 std::vector<std::uint16_t>& out);
288 OutputTargets& PrepareOutputTargets(
FilamentView& view);
289 void ResetOutputTargets(OutputTargets& targets);
290 ViewRenderData ExtractViewRenderData(
const FilamentView& view)
const;
291 bool UpdateViewRenderData(OutputTargets& targets,
const FilamentView& view);
292 bool ValidateRenderConfig(
const RenderConfig& config)
const;
294 filament::Engine& engine_;
296 std::unordered_map<ViewKey, OutputTargets> outputs_;
297 RenderConfig render_config_;
298 std::unique_ptr<Backend> backend_;
299 bool enabled_ =
false;
Eigen::Transform< float, 3, Eigen::Projective > ProjectionMatrix
Definition Camera.h:26
Eigen::Transform< float, 3, Eigen::Affine > Transform
Definition Camera.h:25
Definition FilamentResourceManager.h:50
Definition FilamentScene.h:70
Definition FilamentView.h:33
GPU backend for geometry and composite compute.
Definition GaussianSplatRenderer.h:131
virtual bool PrepareOutputTextures(FilamentView &view, FilamentResourceManager &resource_mgr, std::uint32_t width, std::uint32_t height, OutputTargets &targets)=0
virtual bool IsAvailable() const
Definition GaussianSplatRenderer.h:136
virtual void ReleaseOutputTextures(FilamentResourceManager &resource_mgr, OutputTargets &targets)=0
virtual bool ReadCompositeDepthToFloatCpu(const FilamentView &view, std::vector< float > &out, std::uint32_t width, std::uint32_t height)
Definition GaussianSplatRenderer.h:180
virtual void ForgetView(const FilamentView &view)=0
virtual bool ReadColorToRGBA16FCpu(const OutputTargets &targets, std::vector< std::uint16_t > &out)
Definition GaussianSplatRenderer.h:195
virtual bool ReadMergedDepthToUint16Cpu(const FilamentView &view, std::vector< std::uint16_t > &out, std::uint32_t width, std::uint32_t height)
Definition GaussianSplatRenderer.h:165
virtual const char * GetName() const =0
virtual bool RenderCompositeStage(const FilamentView &view, const ViewRenderData &render_data, OutputTargets &targets)=0
virtual bool RenderGeometryStage(const FilamentView &view, const FilamentScene &scene, const ViewRenderData &render_data, OutputTargets &targets)=0
virtual ~Backend()=default
Definition GaussianSplatRenderer.h:38
bool RenderCompositeStage(FilamentView &view)
Returns true if the composite pass ran and the backend reported success.
Definition GaussianSplatRenderer.cpp:254
void RequestRedrawForView(const FilamentView &view)
Definition GaussianSplatRenderer.cpp:279
bool ReadColorToRGBA16FCpu(const FilamentView &view, std::vector< std::uint16_t > &out)
Definition GaussianSplatRenderer.cpp:435
void SetRenderConfig(const RenderConfig &config)
Definition GaussianSplatRenderer.cpp:377
const ViewRenderData * GetViewRenderData(const FilamentView &view) const
Definition GaussianSplatRenderer.cpp:364
void RequestDepthReadbackForView(const FilamentView &view, bool wanted=true)
Definition GaussianSplatRenderer.cpp:445
bool ReadCompositeDepthToFloatCpu(const FilamentView &view, std::vector< float > &out, std::uint32_t width, std::uint32_t height)
Definition GaussianSplatRenderer.cpp:424
TextureHandle GetDepthTexture(const FilamentView &view) const
Definition GaussianSplatRenderer.cpp:400
void RequestCompositeForView(const FilamentView &view)
Definition GaussianSplatRenderer.cpp:288
bool ReadMergedDepthToUint16Cpu(const FilamentView &view, std::vector< std::uint16_t > &out, std::uint32_t width, std::uint32_t height)
Definition GaussianSplatRenderer.cpp:413
void RenderGeometryStage(FilamentView &view, const FilamentScene &scene)
Definition GaussianSplatRenderer.cpp:209
~GaussianSplatRenderer()
Definition GaussianSplatRenderer.cpp:202
bool ConsumeOutputReadyRedrawRequest(const FilamentView &view)
Definition GaussianSplatRenderer.cpp:295
const char * GetBackendName() const
Definition GaussianSplatRenderer.cpp:453
void PruneOutputs(const std::unordered_set< const FilamentView * > &live_views)
Definition GaussianSplatRenderer.cpp:335
bool HasOutput(const FilamentView &view) const
Definition GaussianSplatRenderer.cpp:356
RenderTargetHandle GetColorReadbackRT(const FilamentView &view) const
Definition GaussianSplatRenderer.cpp:406
void SetEnabled(bool enabled)
Definition GaussianSplatRenderer.cpp:354
bool HasUsableBackend() const
Returns whether the selected backend can render Gaussian splats.
Definition GaussianSplatRenderer.cpp:317
void InvalidateOutputForView(FilamentView &view)
Definition GaussianSplatRenderer.cpp:321
bool ConsumeFollowupSceneRenderRequest(const FilamentView &view)
Definition GaussianSplatRenderer.cpp:306
TextureHandle GetColorTexture(const FilamentView &view) const
Definition GaussianSplatRenderer.cpp:394
bool IsEnabled() const
Definition GaussianSplatRenderer.cpp:352
const RenderConfig & GetRenderConfig() const
Definition GaussianSplatRenderer.cpp:373
Definition FilamentEngine.h:15
Definition PinholeCameraIntrinsic.cpp:16
Definition GaussianSplatRenderer.h:89
bool has_render_data
Definition GaussianSplatRenderer.h:117
std::uintptr_t color_vk_image
Definition GaussianSplatRenderer.h:104
bool needs_followup_scene_render
Definition GaussianSplatRenderer.h:122
std::uintptr_t scene_depth_mtl_texture
Definition GaussianSplatRenderer.h:111
bool wants_depth_readback
Definition GaussianSplatRenderer.h:126
std::uint32_t width
Definition GaussianSplatRenderer.h:93
RenderTargetHandle gs_readback_rt
Definition GaussianSplatRenderer.h:116
std::uint32_t height
Definition GaussianSplatRenderer.h:94
bool needs_composite_render
Definition GaussianSplatRenderer.h:120
TextureHandle depth
Definition GaussianSplatRenderer.h:91
bool needs_geometry_render
Definition GaussianSplatRenderer.h:119
std::uint64_t last_scene_change_id
Definition GaussianSplatRenderer.h:127
std::uintptr_t color_vk_memory
Definition GaussianSplatRenderer.h:105
bool has_valid_output
Definition GaussianSplatRenderer.h:118
std::uintptr_t gs_color_mtl_texture
Definition GaussianSplatRenderer.h:112
bool needs_output_ready_redraw
Definition GaussianSplatRenderer.h:121
std::uintptr_t depth_vk_memory
Definition GaussianSplatRenderer.h:107
ViewRenderData render_data
Definition GaussianSplatRenderer.h:113
RenderTargetHandle render_target
Definition GaussianSplatRenderer.h:92
TextureHandle color
Definition GaussianSplatRenderer.h:90
bool uses_vulkan_interop
Definition GaussianSplatRenderer.h:99
std::uintptr_t depth_vk_image
Definition GaussianSplatRenderer.h:106
Tunable knobs for the compute pipeline, set once at construction.
Definition GaussianSplatRenderer.h:41
std::uint32_t avg_tiles_per_splat
Definition GaussianSplatRenderer.h:54
std::uint32_t max_tiles_per_splat
Definition GaussianSplatRenderer.h:50
Eigen::Vector2i composite_group_size
Definition GaussianSplatRenderer.h:44
int projection_group_size
Definition GaussianSplatRenderer.h:43
int max_sh_degree
Definition GaussianSplatRenderer.h:45
bool antialias
Definition GaussianSplatRenderer.h:65
std::uint32_t max_tile_entries_total
Definition GaussianSplatRenderer.h:58
Eigen::Vector2i tile_size
Definition GaussianSplatRenderer.h:42
Camera and viewport state extracted per-view each geometry pass.
Definition GaussianSplatRenderer.h:69
bool screen_y_down
Definition GaussianSplatRenderer.h:73
Camera::Transform model_matrix
Definition GaussianSplatRenderer.h:74
Eigen::Vector2i viewport_origin
Definition GaussianSplatRenderer.h:70
Camera::Transform culling_projection_matrix
Definition GaussianSplatRenderer.h:78
Camera::Transform view_matrix
Definition GaussianSplatRenderer.h:75
double far_plane
Definition GaussianSplatRenderer.h:82
Camera::ProjectionMatrix projection_matrix
Definition GaussianSplatRenderer.h:76
double near_plane
Definition GaussianSplatRenderer.h:81
Camera::ProjectionInfo projection
Definition GaussianSplatRenderer.h:80
Eigen::Vector2i viewport_size
Definition GaussianSplatRenderer.h:71
Eigen::Vector3f camera_position
Definition GaussianSplatRenderer.h:72