voxcity.visualizer.renderer_gpu.GPURendererΒΆ

class voxcity.visualizer.renderer_gpu.GPURenderer(width: int = 1920, height: int = 1080, samples_per_pixel: int = 64, max_depth: int = 6, arch: str = 'gpu')ΒΆ

High-level GPU renderer for VoxCity objects.

taichi_rendererΒΆ
width = 1920ΒΆ
height = 1080ΒΆ
render_city(city: voxcity.models.VoxCity, voxel_color_map: str | dict = 'default', camera_position: Tuple[float, float, float] | None = None, camera_look_at: Tuple[float, float, float] | None = None, camera_up: Tuple[float, float, float] = (0, 0, 1), fov: float = 25.0, floor_enabled: bool = True, floor_color: Tuple[float, float, float] = (0.3, 0.35, 0.3), light_direction: Tuple[float, float, float] | None = None, ambient: Tuple[float, float, float] = (0.15, 0.15, 0.18), output_path: str | None = None, show_progress: bool = True, building_sim_mesh=None, building_value_name: str = 'svf_values', building_colormap: str = 'viridis', building_vmin: float | None = None, building_vmax: float | None = None, building_nan_color: str = 'gray', building_emissive: float = 0.5, render_voxel_buildings: bool = False, ground_sim_grid: numpy.ndarray | None = None, ground_dem_grid: numpy.ndarray | None = None, ground_z_offset: float | None = None, ground_view_point_height: float | None = None, ground_colormap: str = 'viridis', ground_vmin: float | None = None, ground_vmax: float | None = None, ground_emissive: float = 0.5) numpy.ndarrayΒΆ

Render a VoxCity to an image using GPU ray tracing.

Parameters:
  • city (VoxCity) – The VoxCity object to render

  • voxel_color_map (str or dict) – Color map for voxel classes

  • camera_position (tuple, optional) – Camera position. Auto-computed if not specified.

  • camera_look_at (tuple, optional) – Camera look-at point. Auto-computed if not specified.

  • camera_up (tuple) – Camera up vector

  • fov (float) – Field of view in degrees

  • floor_enabled (bool) – Whether to render a floor plane that receives shadows

  • floor_color (Tuple[float, float, float]) – RGB color of the floor (0-1 range)

  • light_direction (tuple) – Light direction vector

  • ambient (tuple) – Ambient light color

  • output_path (str, optional) – If provided, save the rendered image to this path

  • show_progress (bool) – Whether to show rendering progress

  • building_sim_mesh (trimesh, optional) – Building mesh with simulation results in metadata

  • building_value_name (str) – Metadata key for building values (e.g., β€˜svf_values’, β€˜global’, β€˜direct’)

  • building_colormap (str) – Matplotlib colormap for building values

  • building_vmin (float, optional) – Minimum value for building color scale

  • building_vmax (float, optional) – Maximum value for building color scale

  • building_nan_color (str) – Color for NaN/invalid building values

  • building_emissive (float) – Emissive/luminous intensity for building simulation mesh (0=no emission, >0=glowing)

  • render_voxel_buildings (bool) – Whether to render voxel buildings when building_sim_mesh is provided

  • ground_sim_grid (np.ndarray, optional) – 2D array of ground-level simulation values (e.g., GVI, solar)

  • ground_dem_grid (np.ndarray, optional) – 2D DEM array for ground surface positioning

  • ground_z_offset (float, optional) – Height offset for ground surface above DEM

  • ground_view_point_height (float, optional) – Alternative height parameter for ground surface

  • ground_colormap (str) – Matplotlib colormap for ground values

  • ground_vmin (float, optional) – Minimum value for ground color scale

  • ground_vmax (float, optional) – Maximum value for ground color scale

  • ground_emissive (float) – Emissive/luminous intensity for ground simulation mesh (0=no emission, >0=glowing)

Returns:

Rendered image as (H, W, 3) RGB array

Return type:

np.ndarray

render_rotation(city: voxcity.models.VoxCity, voxel_color_map: str | dict = 'default', output_directory: str = 'output', file_prefix: str = 'city_rotation', num_frames: int = 240, camera_height_factor: float = 0.5, camera_distance_factor: float = 1.5, look_at_z_factor: float = -0.1, fov: float = 25.0, floor_enabled: bool = True, floor_color: Tuple[float, float, float] = (0.3, 0.35, 0.3), show_progress: bool = True, building_sim_mesh=None, building_value_name: str = 'svf_values', building_colormap: str = 'viridis', building_vmin: float | None = None, building_vmax: float | None = None, building_nan_color: str = 'gray', building_emissive: float = 0.5, render_voxel_buildings: bool = False, ground_sim_grid: numpy.ndarray | None = None, ground_dem_grid: numpy.ndarray | None = None, ground_z_offset: float | None = None, ground_view_point_height: float | None = None, ground_colormap: str = 'viridis', ground_vmin: float | None = None, ground_vmax: float | None = None, ground_emissive: float = 0.5) List[str]ΒΆ

Render a rotating view of the city.

Parameters:
  • city (VoxCity) – The VoxCity to render

  • voxel_color_map (str or dict) – Color map for voxel classes

  • output_directory (str) – Directory to save frames

  • file_prefix (str) – Prefix for frame filenames

  • num_frames (int) – Number of frames in rotation

  • camera_height_factor (float) – Camera height relative to scene diagonal

  • camera_distance_factor (float) – Camera distance relative to scene diagonal

  • look_at_z_factor (float) – Look-at Z offset as fraction of diagonal (negative = object appears higher)

  • fov (float) – Field of view

  • floor_enabled (bool) – Whether to render a floor plane that receives shadows

  • floor_color (Tuple[float, float, float]) – RGB color of the floor (0-1 range)

  • show_progress (bool) – Whether to show progress

  • building_sim_mesh (trimesh, optional) – Building mesh with simulation results in metadata

  • building_value_name (str) – Metadata key for building values

  • building_colormap (str) – Matplotlib colormap for building values

  • building_vmin (float, optional) – Value range for building color scale

  • building_vmax (float, optional) – Value range for building color scale

  • building_nan_color (str) – Color for NaN values

  • render_voxel_buildings (bool) – Whether to render voxel buildings with sim mesh

  • ground_sim_grid (np.ndarray, optional) – 2D array of ground simulation values

  • ground_dem_grid (np.ndarray, optional) – 2D DEM array

  • ground_z_offset (float, optional) – Height offset for ground surface

  • ground_view_point_height (float, optional) – Height offset for ground surface

  • ground_colormap (str) – Matplotlib colormap for ground values

  • ground_vmin (float, optional) – Value range for ground color scale

  • ground_vmax (float, optional) – Value range for ground color scale

Returns:

Paths to rendered frame files

Return type:

List[str]

render_multi_view(city: voxcity.models.VoxCity, voxel_color_map: str | dict = 'default', output_directory: str = 'output', file_prefix: str = 'city_view', camera_height_factor: float = 0.5, camera_distance_factor: float = 1.5, look_at_z_factor: float = -0.1, fov: float = 25.0, floor_enabled: bool = True, floor_color: Tuple[float, float, float] = (0.3, 0.35, 0.3), show_progress: bool = True, views: List[str] | None = None, building_sim_mesh=None, building_value_name: str = 'svf_values', building_colormap: str = 'viridis', building_vmin: float | None = None, building_vmax: float | None = None, building_nan_color: str = 'gray', building_emissive: float = 0.5, render_voxel_buildings: bool = False, ground_sim_grid: numpy.ndarray | None = None, ground_dem_grid: numpy.ndarray | None = None, ground_z_offset: float | None = None, ground_view_point_height: float | None = None, ground_colormap: str = 'viridis', ground_vmin: float | None = None, ground_vmax: float | None = None, ground_emissive: float = 0.5) List[Tuple[str, str]]ΒΆ

Render multiple standard views of the city.

Parameters:
  • city (VoxCity) – The VoxCity to render

  • voxel_color_map (str or dict) – Color map for voxel classes

  • output_directory (str) – Directory to save images

  • file_prefix (str) – Prefix for image filenames

  • camera_height_factor (float) – Camera height relative to scene diagonal

  • camera_distance_factor (float) – Camera distance relative to scene diagonal

  • look_at_z_factor (float) – Look-at Z offset as fraction of diagonal (negative = object appears higher)

  • fov (float) – Field of view in degrees

  • floor_enabled (bool) – Whether to render a floor plane that receives shadows

  • floor_color (Tuple[float, float, float]) – RGB color of the floor (0-1 range)

  • show_progress (bool) – Whether to show progress

  • views (List[str], optional) – List of view names to render. If None, renders all standard views. Available views: - Isometric: β€˜iso_front_right’, β€˜iso_front_left’, β€˜iso_back_right’, β€˜iso_back_left’ - Orthographic: β€˜xy_top’, β€˜yz_right’, β€˜xz_front’, β€˜yz_left’, β€˜xz_back’

  • building_sim_mesh

  • building_value_name

  • building_colormap

  • building_vmin

:param : :param building_vmax: Building overlay parameters (same as render_rotation) :param building_nan_color: Building overlay parameters (same as render_rotation) :param render_voxel_buildings: Building overlay parameters (same as render_rotation) :param ground_sim_grid: :param ground_dem_grid: :param ground_z_offset: :param ground_view_point_height: :param : :param ground_colormap: Ground overlay parameters (same as render_rotation) :param ground_vmin: Ground overlay parameters (same as render_rotation) :param ground_vmax: Ground overlay parameters (same as render_rotation)

Returns:

List of (view_name, filepath) tuples

Return type:

List[Tuple[str, str]]