Skip to content

Core Features

The @strata-game-library/core package provides a comprehensive set of procedural 3D graphics features for React Three Fiber. This section covers all the core capabilities.

FeatureDescriptionComponents
🏔️ TerrainProcedural terrain with biomesTerrain, TerrainChunk
🌊 WaterRealistic water renderingWater, AdvancedWater
🌿 VegetationGPU-instanced plantsGrassInstances, TreeInstances, RockInstances
☀️ SkyProcedural atmosphereProceduralSky
🌫️ VolumetricsFog and effectsVolumetricFogMesh, UnderwaterOverlay
🎮 CharactersAnimated charactersCharacter, IKChain
🎨 Ray MarchingSDF renderingRaymarching
🐕 Fur SystemShell-based furFurMesh, createFurSystem
🔬 MolecularScientific visualizationMoleculeRenderer
import {
// Terrain
Terrain,
// Water
Water,
AdvancedWater,
// Vegetation
GrassInstances,
TreeInstances,
RockInstances,
GPUInstancedMesh,
// Sky
ProceduralSky,
createTimeOfDay,
// Volumetrics
VolumetricEffects,
VolumetricFogMesh,
UnderwaterOverlay,
EnhancedFog,
// Characters
Character,
createWalkCycle,
// Ray Marching
Raymarching,
// Core Functions
marchingCubes,
noise3D,
fbm,
sdSphere,
sdBox,
opUnion,
opSmoothUnion,
// Materials
createWaterMaterial,
createSkyMaterial,
createRaymarchingMaterial,
} from '@strata-game-library/core';

Here’s how to combine all features into a complete scene:

import { Canvas } from '@react-three/fiber';
import { OrbitControls } from '@react-three/drei';
import {
ProceduralSky,
Water,
GrassInstances,
TreeInstances,
RockInstances,
VolumetricFogMesh
} from '@strata-game-library/core';
function CompleteScene() {
return (
<Canvas camera={{ position: [0, 30, 60], fov: 60 }} shadows>
{/* Lighting */}
<ambientLight intensity={0.4} />
<directionalLight
position={[50, 100, 50]}
intensity={1.2}
castShadow
shadow-mapSize={[2048, 2048]}
/>
{/* Background Layer */}
<ProceduralSky sunPosition={[100, 50, 100]} />
{/* Midground Layer */}
<Water size={300} depth={30} position={[0, -2, 0]} />
{/* Foreground Layer */}
<GrassInstances count={15000} spread={120} />
<TreeInstances count={800} spread={180} minHeight={4} maxHeight={12} />
<RockInstances count={300} spread={150} />
{/* Atmosphere */}
<VolumetricFogMesh density={0.01} color="#9ab" />
{/* Controls */}
<OrbitControls
maxPolarAngle={Math.PI / 2.1}
minDistance={15}
maxDistance={300}
/>
</Canvas>
);
}
QualityGrassTreesRocksTarget FPS
Mobile5,00020010030
Desktop15,00080030060
High-end50,0002,00050060+
QualityReflectionsCausticsFoamPerformance
LowFastest
MediumBalanced
HighBest visual
QualityDensityStepsPerformance
Low0.00516Fastest
Medium0.01532Balanced
High0.0364Best visual

Beyond components, Strata exposes core algorithms for advanced use cases:

import { sdSphere, sdBox, opSmoothUnion } from '@strata-game-library/core';
function customTerrain(point: [number, number, number]): number {
const sphere = sdSphere(point, [0, 0, 0], 10);
const box = sdBox(point, [5, 5, 5], [3, 3, 3]);
return opSmoothUnion(sphere, box, 0.5);
}
import { noise3D, fbm } from '@strata-game-library/core';
function generateHeight(x: number, z: number): number {
return fbm(x * 0.02, 0, z * 0.02, {
octaves: 6,
persistence: 0.5,
lacunarity: 2.0
}) * 50;
}
import { marchingCubes, createGeometryFromMarchingCubes } from '@strata-game-library/core';
const geometry = createGeometryFromMarchingCubes({
bounds: { min: [-50, -50, -50], max: [50, 50, 50] },
resolution: 64,
sdf: customTerrain
});

Dive deeper into each feature: