simvx.core.gpu_particles

GPU-accelerated particle emitter nodes (2D and 3D).

Scene-node wrappers for GPU compute-shader particle simulation. Particle state lives entirely on the GPU – positions, velocities, colours, and lifetimes are updated each frame by a compute dispatch, avoiding per-frame CPU-to-GPU uploads.

Both GPUParticles2D and GPUParticles3D expose Property descriptors so the editor inspector can tweak parameters at design time. At runtime the graphics backend reads emitter_config each frame and feeds it into the compute shader push constants.

Module Contents

Classes

GPUParticles2D

GPU-accelerated 2D particle emitter.

GPUParticles3D

GPU-accelerated 3D particle emitter.

Data

API

simvx.core.gpu_particles.log[source]

‘getLogger(…)’

simvx.core.gpu_particles.__all__

[‘GPUParticles2D’, ‘GPUParticles3D’]

class simvx.core.gpu_particles.GPUParticles2D(**kwargs)[source]

Bases: simvx.core.gpu_particles._GPUParticlesBase, simvx.core.nodes_2d.node2d.Node2D

GPU-accelerated 2D particle emitter.

Particle simulation runs entirely on the GPU via a compute shader. The node exposes editor-visible Property descriptors for all emitter parameters (amount, lifetime, speed, colours, etc.).

The graphics backend collects GPUParticles2D nodes during scene traversal, reads emitter_config, and dispatches the compute shader each frame.

Example::

particles = GPUParticles2D(
    amount=2048,
    lifetime=1.5,
    speed=8.0,
    start_colour=(1.0, 0.8, 0.2, 1.0),
    end_colour=(1.0, 0.0, 0.0, 0.0),
)
scene.add_child(particles)

Initialization

property world_position

Return 3D position for the compute shader (z=0 for 2D).

process(dt: float)[source]
amount

‘Property(…)’

lifetime

‘Property(…)’

emitting

‘Property(…)’

one_shot

‘Property(…)’

speed

‘Property(…)’

speed_variance

‘Property(…)’

direction

‘Property(…)’

spread

‘Property(…)’

gravity

‘Property(…)’

damping

‘Property(…)’

emission_shape

‘Property(…)’

emission_radius

‘Property(…)’

emission_box

‘Property(…)’

start_colour

‘Property(…)’

end_colour

‘Property(…)’

start_scale

‘Property(…)’

end_scale

‘Property(…)’

explosiveness

‘Property(…)’

randomness

‘Property(…)’

fixed_fps

‘Property(…)’

preprocess

‘Property(…)’

local_coords

‘Property(…)’

finished

‘Signal(…)’

property emitter_config: dict
restart()
z_index

‘Property(…)’

z_as_relative

‘Property(…)’

render_layer

‘Property(…)’

set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
property absolute_z_index: int
property position: simvx.core.math.types.Vec2
property rotation: float
property rotation_degrees: float
property scale: simvx.core.math.types.Vec2
property world_rotation: float
property world_scale: simvx.core.math.types.Vec2
property forward: simvx.core.math.types.Vec2
property right: simvx.core.math.types.Vec2
translate(offset: tuple[float, float] | numpy.ndarray)
rotate(radians: float)
rotate_deg(degrees: float)
look_at(target: tuple[float, float] | numpy.ndarray)
transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]
draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)
wrap_screen(margin: float = 20)
strict_errors: ClassVar[bool]

True

script_error_raised

‘Signal(…)’

classmethod __init_subclass__(**kwargs)
property name: str
property process_mode: simvx.core.descriptors.ProcessMode
reset_error() None
add_child(node: simvx.core.node.Node) simvx.core.node.Node
remove_child(node: simvx.core.node.Node)
reparent(new_parent: simvx.core.node.Node)
get_node(path: str) simvx.core.node.Node
find_child(name: str, recursive: bool = False) simvx.core.node.Node | None
find(node_type: type, recursive: bool = True) simvx.core.node.Node | None
find_all(node_type: type, recursive: bool = True) list
property path: str
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
ready() None
enter_tree() None
exit_tree() None
physics_process(dt: float) None
draw(renderer) None
input_event(event: simvx.core.events.InputEvent) None
input(event: simvx.core.events.TreeInputEvent) None
unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
clear_children()
destroy()
property app
property tree: simvx.core.scene_tree.SceneTree
get_tree() simvx.core.scene_tree.SceneTree
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()
class simvx.core.gpu_particles.GPUParticles3D(**kwargs)[source]

Bases: simvx.core.gpu_particles._GPUParticlesBase, simvx.core.nodes_3d.node3d.Node3D

GPU-accelerated 3D particle emitter.

Particle simulation runs entirely on the GPU via a compute shader. The node exposes editor-visible Property descriptors for all emitter parameters (amount, lifetime, speed, colours, etc.).

The graphics backend collects GPUParticles3D nodes during scene traversal, reads emitter_config, and dispatches the compute shader each frame.

Example::

particles = GPUParticles3D(
    amount=4096,
    lifetime=2.0,
    speed=10.0,
    gravity=(0.0, -9.8, 0.0),
    start_colour=(0.2, 0.6, 1.0, 1.0),
    end_colour=(0.0, 0.2, 0.8, 0.0),
)
scene.add_child(particles)

Initialization

process(dt: float)[source]
amount

‘Property(…)’

lifetime

‘Property(…)’

emitting

‘Property(…)’

one_shot

‘Property(…)’

speed

‘Property(…)’

speed_variance

‘Property(…)’

direction

‘Property(…)’

spread

‘Property(…)’

gravity

‘Property(…)’

damping

‘Property(…)’

emission_shape

‘Property(…)’

emission_radius

‘Property(…)’

emission_box

‘Property(…)’

start_colour

‘Property(…)’

end_colour

‘Property(…)’

start_scale

‘Property(…)’

end_scale

‘Property(…)’

explosiveness

‘Property(…)’

randomness

‘Property(…)’

fixed_fps

‘Property(…)’

preprocess

‘Property(…)’

local_coords

‘Property(…)’

finished

‘Signal(…)’

property emitter_config: dict
restart()
render_layer

‘Property(…)’

property position
property rotation: simvx.core.math.types.Quat
property scale
property rotation_degrees: simvx.core.math.types.Vec3
property world_position: simvx.core.math.types.Vec3
property world_rotation: simvx.core.math.types.Quat
property world_scale: simvx.core.math.types.Vec3
property forward: simvx.core.math.types.Vec3
property right: simvx.core.math.types.Vec3
property up: simvx.core.math.types.Vec3
translate(offset: tuple[float, float, float] | numpy.ndarray)
translate_global(offset: tuple[float, float, float] | numpy.ndarray)
rotate(axis: tuple[float, float, float] | numpy.ndarray, angle: float)
rotate_x(angle: float)
rotate_y(angle: float)
rotate_z(angle: float)
look_at(target: tuple[float, float, float] | numpy.ndarray, up=None)
set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
wrap_bounds(bounds: tuple[float, float, float] | numpy.ndarray, margin: float = 1.0)
strict_errors: ClassVar[bool]

True

script_error_raised

‘Signal(…)’

classmethod __init_subclass__(**kwargs)
property name: str
property process_mode: simvx.core.descriptors.ProcessMode
reset_error() None
add_child(node: simvx.core.node.Node) simvx.core.node.Node
remove_child(node: simvx.core.node.Node)
reparent(new_parent: simvx.core.node.Node)
get_node(path: str) simvx.core.node.Node
find_child(name: str, recursive: bool = False) simvx.core.node.Node | None
find(node_type: type, recursive: bool = True) simvx.core.node.Node | None
find_all(node_type: type, recursive: bool = True) list
property path: str
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
ready() None
enter_tree() None
exit_tree() None
physics_process(dt: float) None
draw(renderer) None
input_event(event: simvx.core.events.InputEvent) None
input(event: simvx.core.events.TreeInputEvent) None
unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
clear_children()
destroy()
property app
property tree: simvx.core.scene_tree.SceneTree
get_tree() simvx.core.scene_tree.SceneTree
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()