google-3d-tiles-r3f
2
总安装量
2
周安装量
#64091
全站排名
安装命令
npx skills add https://github.com/liuchiawei/agent-skills --skill google-3d-tiles-r3f
Agent 安装分布
gemini-cli
2
opencode
2
codebuddy
2
github-copilot
2
codex
2
kimi-cli
2
Skill 文档
Google 3D Tiles with R3F and ENU Coordinates
When to Use This Skill
- Integrating Google Maps Photorealistic 3D Tiles or Google Earth 3D Tiles API into a web app
- Building a Three.js or React Three Fiber (R3F) scene that displays real-world 3D terrain/buildings
- Correcting 座æ¨ç³» (coordinate systems): converting ECEF (Earth-Centered, Earth-Fixed) to ENU (East-North-Up) so the map is flat and Y-up for gameplay, camera, or audio
- Placing objects (camera, vehicles, audio sources) in the same coordinate system as the tiles
Quick Overview
- Tiles: Google 3D Tiles are served in ECEF. Use
3d-tiles-rendererwithTilesRenderer(R3F) andGoogleCloudAuthPlugin(API key). - R3F: Render tiles inside a
<Canvas>; wrapTilesRendererin a transformer group that applies an ECEFâENU matrix so the scene is local and Y-up. - Consistency: Use a single origin (e.g. city center). Convert all lat/lng/alt to ENU with that origin so camera, physics, and tiles share the same 座æ¨ç³».
Stack and Packages
- three + @react-three/fiber (R3F)
- 3d-tiles-renderer (provides
TilesRenderer,TilesPlugin,WGS84_ELLIPSOID,GoogleCloudAuthPlugin,GLTFExtensionsPlugin) - Optional: three/examples/jsm/loaders/DRACOLoader for compressed tiles
Google Tiles root URL: https://tile.googleapis.com/v1/3dtiles/root.json. API key required (Google Cloud Maps API / 3D Tiles).
Coordinate Correction (ECEF â ENU)
- ECEF: Earth-centered, Cartesian. Tiles from Google are in ECEF.
- ENU: East-North-Up at a chosen origin. X=east, Y=north, Z=up (then remap to Three.js Y-up: X=east, Y=up, Z=-north so north is -Z).
Steps:
- Get ENUâECEF at origin (lat, lng) using WGS84 ellipsoid (e.g.
WGS84_ELLIPSOID.getEastNorthUpFramefrom3d-tiles-renderer/three), then invert to get ECEFâENU. - Apply a Y-up remap so Three.js convention is X=east, Y=up, Z=-north (geographic north = -Z).
- Set this matrix on the parent group of the tiles (e.g. the group that wraps
TilesRenderer), and setmatrixAutoUpdate = false.
All other scene objects (camera, entities) should use the same origin and the same ENUâlat/lng conversion (e.g. latLngAltToENU / enuToLatLngAlt) so positions align with the transformed tiles.
Checklist
- R3F
Canvaswith appropriate camera near/far and optionallogarithmicDepthBufferfor large scenes - Tiles:
TilesRendererwrapped in a group; apply ECEFâENU+Y-up matrix to that group once on mount - Auth:
TilesPluginwithGoogleCloudAuthPluginandapiToken(API key) - Optional:
GLTFExtensionsPlugin+ DRACOLoader for Draco tiles - Single origin (e.g.
ORIGIN_LAT,ORIGIN_LNG); all lat/lng/alt converted to ENU relative to that origin - Geo utils:
latLngAltToENUandenuToLatLngAltuse the same Y-up remap (Z = -north) as the tiles transform
Additional Resources
- reference.md â Concepts and 座æ¨ç³» summary; all code lives in examples/ so the skill is project-agnostic.
- examples/ â Copy-paste files: config, geo-utils, ECEFâENU matrix + TilesTransformer, TilesScene, page snippet. See examples/README.md for copy-to-path mapping.