Skip to content
hunterh37Public

About

Procedural photoreal trees, rocks, props and scenes for RealityKit / visionOS

Resources

Code of conduct

Contributing

Stars

18 stars

Watchers

0 watching

Forks

Repository files navigation

RealityHD

Swift 6.2 Platforms SwiftPM License: MIT

Procedural, photoreal trees, rocks, ground, props and scenes for RealityKit, generated from code at load time. No mesh or texture files ship in your app: geometry is built on the CPU in milliseconds and every PBR texture is synthesized on the GPU.

RealityHDDemo running park-path in the Apple Vision Pro simulator

Contents

Features

  • 21 assets and 3 composed scenes: oak, birch, spruce, shrub, boulder, pebbles, terrain, grass, and 12 street and park props. Every asset is parameterized and seeded.
  • Trees with recursive branching, root flare, alpha-card foliage, crown-sphere normals, baked crown occlusion and three LODs built from one skeleton.
  • 29 GPU-synthesized PBR materials (albedo, normal, roughness, AO, metallic), all tileable, with coverage-preserving alpha mips for foliage.
  • ShaderGraph materials generated at runtime: vertex wind, leaf back-light translucency, aerial perspective fog, ground anti-tiling, triplanar rock projection, moss on upward faces.
  • Physically based sky (Rayleigh, Mie, ozone) used for image-based lighting and the skybox, with a matching shadow-casting sun.
  • MeshInstancesComponent instancing in spatial cells, distance LOD with hysteresis, head-tracked LOD on visionOS, quality presets.
  • Offscreen PNG rendering through RealityRenderer for previews, thumbnails and automated checks.

Requirements

Platform Minimum
visionOS 26.0
macOS 26.0
iOS 26.0
Xcode 26.0 (Swift 6.2 tools)

Metal is required for texture synthesis. ARKit world tracking (visionOS, ImmersiveSpace) is used only for head-tracked LOD.

Installation

Xcode

File > Add Package Dependencies, enter the repository URL, and add the RealityHD product to your app target.

https://github.com/hunterh37/RealityHD.git

Package.swift

dependencies: [
    .package(url: "https://github.com/hunterh37/RealityHD.git", branch: "main"),
],
targets: [
    .target(name: "MyApp", dependencies: [.product(name: "RealityHD", package: "RealityHD")]),
]

Quick start

A full forest in an immersive space:

import SwiftUI
import RealityKit
import RealKit
import RealLibrary

@main
struct ForestApp: App {
    init() { RealityHD.setup(.balanced) }

    var body: some Scene {
        ImmersiveSpace(id: "forest") {
            RealityView { content in
                let env = try! RealityHD.environment(.afternoon, skybox: true)
                let forest = try! await RealityHD.scene("forest-glade")
                env.illuminate(forest)
                content.add(env.root)
                content.add(forest)
            }
            .task { await RealViewerTracker.shared.start() }
        }
        .immersionStyle(selection: .constant(.full), in: .full)
    }
}

Photo to asset

A reference photo goes in, a procedural Swift asset comes out. Left: the photo. Right: the halogen-siphon-bar prop that the agent loop built from it (no mesh or texture files).

Reference photo and generated halogen-siphon-bar prop

Prompting Claude Code

Open Claude Code in this repo. The realityhd-prop skill runs brief, scaffold, build, lint, vision gate, sign-off, thumbnail and catalog. Example prompts:

With your own photo (attach it or give a path):

Add a prop from this photo: ~/Desktop/espresso-grinder.jpg. Match the size and materials.

/realityhd-prop make this lamp photoreal [image attached]

Without a photo (the agent searches for a matching reference image first):

Add a vintage rotary telephone prop. Find a reference photo and match it.

Model a cast iron skillet, 30 cm, find a product photo for proportions.

Scenes and materials:

Build a scene "bakery-counter" with the kitchen props, interior lighting, camera at the register.

Add a material wood.walnut-oiled like wood.oak, darker and warmer.

Using a generated asset

Every asset in the catalog, including new ones, loads by id:

import RealKit; import RealLibrary

RealityHD.setup(.balanced)
let env = try RealityHD.environment(.afternoon, skybox: false)
let siphon = try await RealityHD.entity("halogen-siphon-bar", seed: 1)
env.illuminate(siphon)
content.add(env.root)
content.add(siphon)

By hand

swift run -q realityhd brief my-prop --theme Kitchen --name "My prop"   # fill briefs/my-prop.json
swift run -q realityhd new prop my-prop --brief briefs/my-prop.json      # write build(seed:)
swift run -q realityhd gate my-prop --ref photo.jpg                      # side-by-side + scores
swift run -q realityhd thumbs my-prop && swift run -q realityhd catalog

Demo app

Demo/ is a visionOS app that opens forest-glade and park-path as full ImmersiveSpaces. The menu window picks the scene, sky (morning, midday, afternoon, golden hour) and seed. The scene's camera hint is placed at the viewer's feet, and LOD follows head pose through RealViewerTracker.

forest-glade, afternoon forest-glade, golden hour
park-path, afternoon park-path, golden hour

Captured in the visionOS 26 simulator. The forest scene has 140 instanced trees, 7,000 grass clumps and camp props (picnic table, crates on a pallet, barrels, drum) along the edge of the glade.

brew install xcodegen
cd Demo && xcodegen generate && open RealityHDDemo.xcodeproj

Launch arguments open a scene without input, for captures and checks: -scene forest-glade|park-path, -sky morning|midday|afternoon|golden, -seed n, -yaw deg, -hideMenu YES. Scripts/frame.py frames a simulator screenshot for this README.

Usage

Single assets

let oak = try await RealityHD.entity("oak-tree", seed: 4)
let hydrant = try await RealityHD.entity("fire-hydrant")
content.add(oak)

Custom parameters

Assets are value types with stored parameters; edit them inline.

let drum  = try await RealityHD.entity(OilDrum().with { $0.color = 0x8C1F1F })
let birch = try await RealityHD.entity(Tree(.birch).with { $0.species.height = 9 }, seed: 2)
let rock  = try await RealityHD.entity(Boulder().with { $0.size = [3, 1.6, 2.4]; $0.facets = 12 })

Instanced fields

One draw per cell per LOD, however many instances.

let spots = Scatter.poisson(count: 400, outerRadius: 60, minSpacing: 4, seed: 1)
let transforms = spots.map { place($0.x, $0.y, yaw: .random(in: 0...360)).matrix }
let forest = try await RealityHD.field(SpruceTree(), transforms: transforms)

Lighting

let env = try RealityHD.environment(SunSky(elevation: 20, azimuth: 250, turbidity: 2.8), skybox: true)
env.illuminate(myContent)   // image-based light for every model under it
content.add(env.root)       // sun with cascaded shadows, IBL entity, optional skybox

Presets: .morning, .midday, .afternoon, .goldenHour. In mixed reality pass skybox: false, or skip the environment and let system lighting apply (set RealAtmosphere.fogDensity = 0 indoors).

Wind, fog and quality

RealWind.direction = [1, 0, 0.3]; RealWind.strength = 1.5      // before materials are created
RealAtmosphere.fogDensity = 0.002
RealityHD.setup(.performance)                                  // 512 px textures

Materials on your own meshes

var m = Model(name: "plinth")
m.add(Prim.roundedBox([1, 0.4, 1], radius: 0.03, material: "concrete.smooth"))
let entity = try await m.modelEntityAsync()

Material keys accept a hex tint: "metal.painted:1F4E8C". All keys are listed in CATALOG.md.

Gallery

Scenes

forest-glade park-path
forest-glade park-path
park-path, golden hour prop-yard
park-path golden hour prop-yard

Nature

Trees and rocks

Props

Props

wooden-crate
wooden-crate
barrel
barrel
oil-drum
oil-drum
park-bench
park-bench
picnic-table
picnic-table
street-lamp
street-lamp
traffic-cone
traffic-cone
fire-hydrant
fire-hydrant
bollard
bollard
pallet
pallet
mailbox
mailbox
trash-can
trash-can

Photoreal props (3.0)

Built and signed off through the vision gate (docs/V3.md).

RealityHD 3 props

Interiors and articulated assets (4.0)

Office scenes lit by the sun through real openings plus an indoor probe, with baked scene AO and static batching. Doors, drawers, lids, chairs, lamps and screens have named states and animate live (docs/V4.md, docs/guides/articulation.md).

open-office in the Apple Vision Pro simulator open-office in the RealityHDDemo app, Apple Vision Pro simulator (visionOS 26.4): tilted window live, monitors showing the screen.ui display material, sun through the ribbon windows.

open-office
open-office
executive-office
executive-office
office-lobby
office-lobby
conference-room
conference-room
office-plaza
office-plaza
laptop on
laptop state on

Every state of every articulated asset, rendered through the live rig (realityhd states):

office-door states office-window states elevator-doors states glass-door states filing-cabinet states desk-pedestal states storage-cabinet states executive-desk states office-chair states laptop states desktop-monitor states hardcover-book states banker-lamp states pedal-bin states ceiling-light states

Static office props:

office-desk
office-desk
bookshelf
bookshelf
conference-table
conference-table
lobby-sofa
lobby-sofa
reception-desk
reception-desk
whiteboard
whiteboard
water-cooler
water-cooler
snake-plant
snake-plant
keyboard-mouse
keyboard-mouse
coffee-mug
coffee-mug
paper-stack
paper-stack
office-block
office-block
let cabinet = try await RealityHD.articulated("filing-cabinet")
cabinet.setArticulation("drawer2-open")          // eased animation
// tap a part to toggle it
.gesture(SpatialTapGesture().targetedToAnyEntity().onEnded { $0.entity.realToggle() })

Materials

Albedo channel of the GPU-generated texture sets.

Material swatches

Ballpark (4.1)

A regulation baseball field built from code: 90 ft base paths, a 10 in mound with the rubber at 60 ft 6 in, a 95 ft infield arc, chalked boxes and foul lines, checkerboard-mowed turf, a red warning track, padded walls, foul poles, a hooded backstop, block dugouts, aluminum bleachers and six light towers. The ballpark camera, and the Demo app viewer, stand in the right-handed batter's box.

ballpark from the batter's box

aerial
Aerial from behind first base
backstop
Home plate and the backstop from the infield
plate
Batter's boxes, catcher's box, home-plate
first base
base-bag at first, runner's lane
mound
Mound at golden hour
stands
Bleachers, backstop and dugout from foul ground

Structures: baseball-diamond, outfield-wall, foul-pole, backstop, dugout, bleachers, light-tower.

ballpark structures

Props, gated and signed off: home-plate, base-bag, baseball-bat, baseball, ball-bucket, batting-helmet.

ballpark props

New texture programs turf (mowing stripes or checkerboard), infieldClay (drag lines, conditioner granules, cleat prints) and chainLink (woven cutout mesh with a distance veil).

Hospital (5.0)

An emergency department built from code: a waiting and intake lobby, a treatment corridor, an ER treatment room and an operating room, furnished with 50 articulated medical assets. Instruments and handheld devices can be picked up by hand in the Demo app (ManipulationComponent), and every door, drawer, rail, lid, screen and lamp has named states. See docs/V5.md.

hospital corridor with the ER room and OR doors

er-room
er-room
operating-room
operating-room
hospital-lobby
hospital-lobby
intake
Intake desk, kiosks and treatment doors
back table
Back table: opened container and instrument set
ER counter
ER counter: stethoscope, BP set, otoscope, oximeter, glucometer
OR from the head
Anesthesia boom, workstation and the table
monitor
patient-monitor state alarm

All 50 medical assets (43 props, 7 structures), gated and signed off:

medical assets

States through the live rig:

hospital-bed states operating-table states surgical-light states exam-table states anesthesia-machine states crash-cart states wheelchair states privacy-curtain states patient-monitor states laryngoscope states syringe states hemostat states

New texture programs sheetVinyl (chip sheet flooring with welded seams), nonwoven (SMS drapes and crepe exam paper), wallTile, vitalsUI (ECG, pleth, arterial and respiration traces with numerics) and medLabel (pharmacy and hazard labels with barcodes).

Kitchen and woodshop (5.1)

cooking-counter: a kitchen wall run with quartz tops, sink and faucet under a window, gas range with knob-linked flames, range hood and shaker cabinets (CookingCounterLayout). Cooking engine: plane slicing with capped cut faces, heat model (food, vessel, burner, oven), cook ShaderGraph layer, RealFoodComponent, RealFood/RealVessel/RealBlade. Cookware (skillets, saucepan, stock pot, knives, knife block, utensils, bowls, boards) and food (onion, garlic, tomato, pepper, carrot, potato, lemon, egg, chicken breast, butter, chocolate, strawberry, pancake, fried egg, cookie dough). See docs/guides/cooking.md.

woodshop: WoodshopLayout with a stations knob and 30 gated woodworking props: table and miter saw rigs, cordless drill, sander, jigsaw, circular saw, hand tools, workbench, lumber rack, pegboard, clamps, PPE. Lumber and PlywoodSheet with grain-continuous crosscut and rip. Texture programs tapeRule, pegboard.

Also: hand anatomy (RealHandAnatomy, x-ray graph, realityhd anatomy), rooftop-plank scene.

cooking-counter
cooking-counter
woodshop
woodshop

Backyard landscape (5.2)

backyard-landscape with 35 gated landscaping props: plants (boxwood, privet hedge, hydrangea, rose, lavender, hosta, ornamental grass, arborvitae, azalea, daylily), hardscape (herringbone paver patio, retaining wall, mulch and river rock beds, steel edging, fire pit, pergola, picket fence, raised bed, fountain) and yard props (path light, spotlight and umbrella rigs, birdbath, adirondack chair, hose reel, sprinkler, trellis, planters). Tag landscaping. Test props terracotta-pot, brass-candlestick.

backyard-landscape

Lineman

lineman-yard and lineman-district scenes with 25 gated power-line props for overhead distribution work: a framed distribution pole line, pole-top hardware, hot-line tools, PPE and an aerial bucket. Tools such as hot-stick are articulated (sliding hook head). Material library Lineman.

lineman-yard
lineman-yard
lineman-district
lineman-district

Tools and PPE:

hot-stick
hot-stick
lineman-pliers
lineman-pliers
cable-cutter
cable-cutter
hydraulic-crimper
hydraulic-crimper
wire-grip
wire-grip
wire-brush
wire-brush
voltage-detector
voltage-detector
grounding-set
grounding-set
rubber-gloves
rubber-gloves
leather-protectors
leather-protectors
insulating-blanket
insulating-blanket
hard-hat
hard-hat
fall-harness
fall-harness

Pole hardware:

distribution-pole
distribution-pole
pole-transformer
pole-transformer
fused-cutout
fused-cutout
fuse-link
fuse-link
lightning-arrester
lightning-arrester
pin-insulator
pin-insulator
polymer-deadend
polymer-deadend
hot-line-clamp
hot-line-clamp
automatic-splice
automatic-splice
conductor-coil
conductor-coil

Vehicle:

aerial-bucket
aerial-bucket
truck-cab-interior
truck-cab-interior

Architecture

city-block scene and a procedural building generator (BuildingGenerator, BuildingSpec, FloorPlan) with eight styles: georgian, federal, brownstone, italianate, haussmann, beaux-arts, art-deco, modernist. The generated-building asset wraps the generator. 68 gated pieces cover classical trim, facade openings and roofs, 12 m city grid tiles and street props. Material libraries Architecture, Facade, City. Tags architecture, facade, trim, city.

city-block
city-block
generated-building
generated-building

Trim and ornament:

architrave-surround
architrave-surround
balustrade-run
balustrade-run
classical-pilaster
classical-pilaster
corinthian-column
corinthian-column
dentil-course
dentil-course
doric-column
doric-column
entablature
entablature
frieze-band
frieze-band
ionic-column
ionic-column
louvered-shutter-pair
louvered-shutter-pair
modillion-cornice
modillion-cornice
parapet-coping
parapet-coping
quoin-stack
quoin-stack
rusticated-base
rusticated-base
scroll-corbel
scroll-corbel
segmental-pediment
segmental-pediment
string-course
string-course
triangular-pediment
triangular-pediment
voussoir-arch
voussoir-arch
window-hood
window-hood

Facade and roof:

bay-window
bay-window
brick-chimney
brick-chimney
brownstone-double-door
brownstone-double-door
brownstone-stoop
brownstone-stoop
canvas-awning
canvas-awning
casement-window
casement-window
curtain-wall-panel
curtain-wall-panel
dormer-window
dormer-window
double-hung-window
double-hung-window
fire-escape-bay
fire-escape-bay
french-balcony-door
french-balcony-door
gable-roof-panel
gable-roof-panel
garage-door
garage-door
georgian-entry
georgian-entry
gutter-downspout
gutter-downspout
rooftop-hvac
rooftop-hvac
six-panel-door
six-panel-door
standing-seam-roof
standing-seam-roof
storefront-bay
storefront-bay
water-tower
water-tower
wrought-iron-balcony
wrought-iron-balcony

City tiles:

cobblestone-tile
cobblestone-tile
plaza-paving
plaza-paving
road-corner
road-corner
road-intersection
road-intersection
road-straight
road-straight
road-t-junction
road-t-junction
sidewalk-curb
sidewalk-curb

Street props:

bike-rack
bike-rack
bus-shelter
bus-shelter
cafe-table-set
cafe-table-set
concrete-planter
concrete-planter
drinking-fountain
drinking-fountain
manhole-cover
manhole-cover
newspaper-box
newspaper-box
ornamental-fence
ornamental-fence
parking-meter
parking-meter
pedestrian-signal
pedestrian-signal
plaza-fountain
plaza-fountain
police-call-box
police-call-box
stop-sign
stop-sign
storm-drain-grate
storm-drain-grate
street-clock
street-clock
street-name-sign
street-name-sign
traffic-signal
traffic-signal
tree-grate
tree-grate
utility-pole
utility-pole

BugHunt

Insects:

insect-bumblebee
insect-bumblebee
insect-caterpillar
insect-caterpillar
insect-centipede
insect-centipede
insect-cicada
insect-cicada
insect-cricket
insect-cricket
insect-damselfly
insect-damselfly
insect-dragonfly
insect-dragonfly
insect-dung-beetle
insect-dung-beetle
insect-firefly
insect-firefly
insect-garden-ant
insect-garden-ant
insect-grasshopper
insect-grasshopper
insect-honeybee
insect-honeybee
insect-jewel-beetle
insect-jewel-beetle
insect-katydid
insect-katydid
insect-ladybug
insect-ladybug
insect-luna-moth
insect-luna-moth
insect-mantis
insect-mantis
insect-monarch
insect-monarch
insect-morpho
insect-morpho
insect-pill-bug
insect-pill-bug
insect-rhino-beetle
insect-rhino-beetle
insect-stag-beetle
insect-stag-beetle
insect-stick-insect
insect-stick-insect
insect-swallowtail
insect-swallowtail

Props:

anthill
anthill
bark-slab
bark-slab
bug-net
bug-net
capture-net-pod
capture-net-pod
field-journal
field-journal
flower-bush
flower-bush
liftable-stone
liftable-stone
milkweed
milkweed
specimen-jar
specimen-jar
wrist-launcher
wrist-launcher

Performance

Release build on an M2 Pro (swift run -c release realityhd bench).

Measure Result
Oak / birch / spruce generation, 3 LODs 12 / 17 / 13 ms
Prop generation 0.2 to 2 ms
1024² PBR texture set on the GPU 7 to 20 ms
forest-glade build + upload 0.3 s + 0.9 s, 7,555 instances in 422 instanced draws
park-path build + upload 0.08 s + 0.16 s, 22,120 instances
Tree LOD0 / LOD1 / LOD2 ~20k / ~8k / ~2.5k triangles
Texture memory, .balanced ~11 MB per material

Instancing by spatial cell, LOD every 0.2 s with hysteresis, no shadow casting for grass and LOD2, foliage twigs implied by cards, shared per-key textures, RG8 normal maps and quality presets keep scenes at frame rate on Vision Pro.

Command-line tool

swift run -q realityhd list                      # assets and scenes
swift run -q realityhd stats oak-tree            # triangles per LOD, materials, generation time
swift run -q realityhd render park-bench         # out/park-bench.png via RealityRenderer
swift run -q realityhd render forest-glade --sky golden --w 1920 --h 1080
swift run -q realityhd thumbs --missing          # docs/assets/<id>.png, docs/scenes/<id>.png
swift run -q realityhd textures bark.oak         # dump albedo/normal/roughness PNGs
swift run -q realityhd shaders                   # load every ShaderGraph variant
swift run -q realityhd catalog                   # regenerate CATALOG.md
swift run -q realityhd new prop wheelbarrow --theme Construction   # scaffold + register
swift run -c release realityhd bench

# 3.0 agent loop
swift run -q realityhd context prop              # API, materials, props, loop in one print
swift run -q realityhd brief copper-kettle --theme Kitchen --name "Hammered copper kettle"
swift run -q realityhd new prop copper-kettle --brief briefs/copper-kettle.json
swift run -q realityhd lint copper-kettle        # budget, grounding, texel scale, size vs brief
swift run -q realityhd gate copper-kettle --ref photo.jpg    # sheet, compare, report, verdict template
swift run -q realityhd gate copper-kettle --verdict out/gate/copper-kettle/verdict.json --signoff
python3 Scripts/vision_judge.py copper-kettle    # headless verdict via the Claude API

Coding agents: .claude/skills/realityhd-prop runs the loop end to end; realityhd-gate holds the rubric and scoring.

Package structure

Target Contents
RealCore Surfaces, models, LODs, primitives, tree generator, noise, scatter. No RealityKit.
RealMaterials MaterialSpec, material library by family (Library/), Metal texture programs (Shaders/), sky.
RealKit LowLevelMesh upload, material cache, ShaderGraph emitter, environment, LOD, instancing, preview.
RealLibrary RealAsset and registries (Core/), building helpers, Nature/, Props/<Theme>/, Structures/, Scenes/, RealityHD entry points.
realityhd Command-line tool.

One asset per file. The full tree and conventions are in AGENTS.md; design notes in DESIGN.md.

Contributing

Assets, scenes and materials are welcome, one per pull request. Start with CONTRIBUTING.md, pick a theme pack from docs/IDEAS.md, and follow the guides for assets, scenes and materials.

swift run -q realityhd new prop wheelbarrow --theme Construction --author your-handle
# write build(seed:), then:
swift test && swift run -q realityhd render wheelbarrow
swift run -q realityhd thumbs wheelbarrow && swift run -q realityhd catalog

Coding agents read AGENTS.md; IDEAS.md ends with prompts to paste into one.

License

RealityHD is available under the MIT license. See LICENSE.

About

Procedural photoreal trees, rocks, props and scenes for RealityKit / visionOS

Resources

Code of conduct

Contributing

Stars

18 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages