Module: Gsplat::Backend::RubyEval3dRasterizer
- Defined in:
- lib/gsplat/backend/ruby/eval3d_rasterizer.rb
Overview
World-space Gaussian evaluator used by 3DGUT-style rendering.
Constant Summary collapse
- ALPHA_CLAMP =
0.99- ALPHA_SKIP =
1.0 / 255
- TRANSMITTANCE_STOP =
1e-4
Class Method Summary collapse
-
.forward(means, quats, scales, colors, opacities, backgrounds, viewmats:, intrinsics:, width:, height:, tile_size:, offsets:, flatten_ids:, camera_model:, use_hit_distance: false, return_normals: false) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/ParameterLists.
Class Method Details
.forward(means, quats, scales, colors, opacities, backgrounds, viewmats:, intrinsics:, width:, height:, tile_size:, offsets:, flatten_ids:, camera_model:, use_hit_distance: false, return_normals: false) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/ParameterLists
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gsplat/backend/ruby/eval3d_rasterizer.rb', line 14 def forward(means, quats, scales, colors, opacities, backgrounds, viewmats:, intrinsics:, width:, height:, tile_size:, offsets:, flatten_ids:, camera_model:, use_hit_distance: false, return_normals: false) # rubocop:enable Metrics/AbcSize, Metrics/ParameterLists values = validate_inputs( means, quats, scales, colors, opacities, backgrounds, viewmats, intrinsics, width, height, offsets, flatten_ids, camera_model ) means, quats, scales, colors, opacities, backgrounds, viewmats, intrinsics = values camera_count, gaussian_count, channels = colors.shape rendered = means.class.zeros(camera_count, height, width, channels) alphas = means.class.zeros(camera_count, height, width, 1) rendered_normals = means.class.zeros(camera_count, height, width, 3) rotations = Math::Quaternion.to_rotmat(quats) camera_count.times do |camera| frame = camera_frame(viewmats[camera, true, true]) height.times do |row| width.times do |column| tile_x = column / tile_size tile_y = row / tile_size range = intersection_range(offsets, flatten_ids, camera, tile_x, tile_y) ray = ray_for_pixel(frame, intrinsics[camera, true, true], column, row) pixel, transmittance, pixel_normal = composite_pixel( means, rotations, scales, colors, opacities, flatten_ids, range, camera, gaussian_count, ray, use_hit_distance, return_normals ) pixel += backgrounds[camera, true] * transmittance if backgrounds rendered[camera, row, column, true] = pixel alphas[camera, row, column, 0] = 1 - transmittance rendered_normals[camera, row, column, true] = pixel_normal end end end [rendered, alphas, rendered_normals] end |