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]]