Module: Gsplat::Backend::RubyRasterizeToPixels
- Defined in:
- lib/gsplat/backend/ruby/rasterize_to_pixels.rb
Overview
Tile-accelerated Numo rasterization forward pass.
Class Method Summary collapse
-
.forward(means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids) ⇒ Object
rubocop:disable Metrics/ParameterLists.
Class Method Details
.forward(means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids) ⇒ Object
rubocop:disable Metrics/ParameterLists
10 11 12 13 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 49 50 51 52 53 54 |
# File 'lib/gsplat/backend/ruby/rasterize_to_pixels.rb', line 10 def forward(means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids) # rubocop:enable Metrics/ParameterLists inputs = validate_inputs( means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids ) means2d, conics, colors, opacities, backgrounds, masks, isect_offsets, flatten_ids = inputs camera_count, gaussian_count = means2d.shape[0...2] channel_count = colors.shape[-1] tile_height, tile_width = isect_offsets.shape[-2..] render_colors = means2d.class.zeros(camera_count, height, width, channel_count) render_alphas = means2d.class.zeros(camera_count, height, width, 1) last_ids = Numo::Int32.zeros(camera_count, height, width) flattened_means = means2d.reshape(camera_count * gaussian_count, 2) flattened_conics = conics.reshape(camera_count * gaussian_count, 3) flattened_colors = colors.reshape(camera_count * gaussian_count, channel_count) flattened_opacities = opacities.reshape(camera_count * gaussian_count) camera_count.times do |camera_index| tile_height.times do |tile_y| tile_width.times do |tile_x| render_tile!( render_colors, render_alphas, last_ids, flattened_means, flattened_conics, flattened_colors, flattened_opacities, backgrounds, masks, isect_offsets, flatten_ids, camera_index, tile_x, tile_y, width, height, tile_size ) end end end [render_colors, render_alphas, last_ids] end |