ZenthVR SDK Documentation
High-performance, cross-platform framework for building immersive spatial experiences. Designed for scalability, real-time collaboration, and hardware-agnostic deployment.
ZenthVR SDK v3.2.0. Breaking changes from v2.x include the new ECS architecture, Vulkan/Metal backend unification, and the redesigned netcode layer.
Installation
Install the SDK via your preferred package manager. The SDK requires Node.js >= 18 and npm >= 9 or pnpm.
# Using npm
npm install @aevum-zenth/zenthvr-sdk
# Using pnpm
pnpm add @aevum-zenth/zenthvr-sdk
# Using yarn
yarn add @aevum-zenth/zenthvr-sdk
Quick Start
Initialize a new ZenthVR project and create your first spatial scene in under 60 seconds.
import { ZenthClient, Entity, Components } from '@aevum-zenth/zenthvr-sdk';
// Initialize the client
const client = new ZenthClient({
projectId: 'proj_aevum_demo_01',
environment: 'production',
debug: true
});
await client.connect();
console.log(`Connected to `, client.network.region);
// Create scene root
const scene = client.world.createScene('demo-environment');
// Add a spatial entity
const cube = scene.createEntity('interactive-cube', {
position: { x: 0, y: 1.5, z: -4 },
rotation: { x: 0, y: Math.PI / 4, z: 0 },
scale: { x: 0.8, y: 0.8, z: 0.8 }
});
cube.addComponent(Components.Mesh, {
geometry: 'box',
material: 'standard',
color: '#a29bfe',
emissiveIntensity: 0.3
});
cube.addComponent(Components.Collider, { type: 'trigger' });
cube.addComponent(Components.Audio, { spatial: true });
// Start simulation loop
client.startLoop();
Entities & Components
ZenthVR uses a data-driven Entity Component System (ECS). Entities are lightweight identifiers. Components attach behavior, rendering, physics, and networking properties.
Transform- Position, rotation, scale hierarchyMeshRenderer- Geometry, materials, LOD groupsCollider- Rigid bodies, triggers, raycast targetsAudioSource- Spatialized 3D audio with HRTF supportNetworkSync- State replication, interpolation, RPC handlers
scene.batchModify() for optimal garbage collection and frame pacing.
Rendering Pipeline
The SDK abstracts WebGL2, WebGPU, Vulkan, and Metal behind a unified shader compiler. Materials use a node-based graph that compiles to platform-specific bytecode at runtime.
const mat = new Material({
pipeline: 'pbr-forward',
shaders: {
vertex: 'assets/shaders/mesh.vert.zs',
fragment: 'assets/shaders/mesh.frag.zs'
},
uniforms: {
u_Time: { type: 'float', value: 0 },
u_Albedo: { type: 'vec3', value: [0.65, 0.73, 0.99] }
},
blending: 'alpha-blend'
});
client.renderer.setMaterial('custom-hologram', mat);
API Reference Preview
Full interactive API documentation is available via the docs.zenthvr.dev portal. Below are core interfaces:
interface IZenthClient {
connect(config?: ConnectionConfig): Promise<void>;
disconnect(code?: number, reason?: string): void;
world: World;
network: NetworkManager;
renderer: Renderer;
input: InputSystem;
audio: AudioEngine;
startLoop(targetFPS?: number): void;
on<T extends ZEvent>(event: T, handler: (data) => void): Subscription;
}