Photo Sphere Viewer logo

Photo Sphere Viewer

Community
znlgis
photo-sphere-viewer

Use when displaying 360-degree panoramic images (equirectangular/cubemap/dual-fisheye) in web applications, building virtual tours with markers and transitions, embedding interactive panoramas in Vue/React/vanilla JS, or creating 360-degree video players with gyroscope VR support. Photo-Sphere-Viewer v5: JavaScript panorama viewer based on Three.js. Covers Viewer class, 6 adapters, 14 plugins, and markers system.

Overview

Publisherznlgis
Repositoryopengis-skills
Skill namephoto-sphere-viewer
Stars
76
Forks
12
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by znlgis on GitHub. Read the source before you install it.

Installation

Install the Photo Sphere Viewer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/znlgis/opengis-skills/tree/main/3d/photo-sphere-viewer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/znlgis/opengis-skills.git /tmp/opengis-skills
mkdir -p .claude/skills
cp -r /tmp/opengis-skills/3d/photo-sphere-viewer .claude/skills/photo-sphere-viewer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Photo Sphere Viewer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Photo Sphere Viewer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Photo Sphere Viewer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

项目地址: https://github.com/mistic100/Photo-Sphere-Viewer

文档: https://photo-sphere-viewer.js.org

演示: https://photo-sphere-viewer.js.org/demos/

API 参考: https://photo-sphere-viewer.js.org/api/

Playground: https://photo-sphere-viewer.js.org/playground.html

许可证: MIT

最新版本: v5.15.1(npm @photo-sphere-viewer/core,截至 2026-10)

概述

Photo-Sphere-Viewer (PSV) 是一个基于 Three.js 的纯 JavaScript 库,用于在 Web 浏览器中显示 360° 全景照片/球体图像。支持从简单的照片球体到复杂的带标记、导航、陀螺仪和 VR 的虚拟导览。

特性说明
全景格式等距柱状图、立方体贴图(6面/条纹/展开图)、双鱼眼原始格式
分块加载大图分块(Equirectangular/Cubemap Tiles Adapter)
360° 视频等距柱状图 + 立方体贴图视频支持
标记系统图片/HTML/视频/SVG/多边形/折线标记,含提示框和动态缩放
VR 支持移动端陀螺仪 + 立体视差模式(需 GyroscopePlugin + StereoPlugin)
虚拟导览多全景场景链接,支持平滑过渡与双向箭头指示
插件生态14 个官方插件(Markers、Gallery、VirtualTour、Autorotate、Map 等)
框架集成原生 ES 模块,React wrapper 可用

唯一运行时依赖: Three.js(^0.185.1)。所有适配器和插件作为 @photo-sphere-viewer/* 独立 NPM 包发布。

注意: 旧的无作用域包 photo-sphere-viewer 已标记 deprecated(停在 4.8.1),v5 一律用 @photo-sphere-viewer/core,不要装旧包。


环境准备与安装

安装核心包

bash
npm install @photo-sphere-viewer/core

安装适配器和插件(按需)

bash
# 适配器
npm install @photo-sphere-viewer/cubemap-adapter          # 立方体贴图
npm install @photo-sphere-viewer/equirectangular-video-adapter  # 360° 视频
npm install @photo-sphere-viewer/equirectangular-tiles-adapter  # 分块加载大图
npm install @photo-sphere-viewer/dual-fisheye-adapter     # 双鱼眼(Ricoh Theta 等)

# 常用插件
npm install @photo-sphere-viewer/markers-plugin           # 标记系统
npm install @photo-sphere-viewer/gallery-plugin           # 底部画廊
npm install @photo-sphere-viewer/virtual-tour-plugin      # 虚拟导览
npm install @photo-sphere-viewer/gyroscope-plugin         # 陀螺仪
npm install @photo-sphere-viewer/stereo-plugin            # 立体/VR
npm install @photo-sphere-viewer/autorotate-plugin        # 自动旋转
npm install @photo-sphere-viewer/video-plugin             # 视频控制条
npm install @photo-sphere-viewer/compass-plugin           # 罗盘
npm install @photo-sphere-viewer/map-plugin               # 地图集成

直接 HTML 引入

html
<div id="viewer" style="width: 100%; height: 100vh;"></div>

<script type="module">
  import { Viewer } from '@photo-sphere-viewer/core';
  import '@photo-sphere-viewer/core/index.css';

  const viewer = new Viewer({
    container: '#viewer',
    panorama: 'pano.jpg',
  });
</script>

注意: 需要 WebGL 支持(现代浏览器均支持)。移动端陀螺仪和立体 VR 功能需 HTTPS。


快速上手

基础全景查看器

ts
import { Viewer } from '@photo-sphere-viewer/core';
import '@photo-sphere-viewer/core/index.css';

const viewer = new Viewer({
  container: document.querySelector('#viewer'),
  panorama: 'https://example.com/panorama.jpg',
  caption: '山顶全景',
  description: '拍摄于 2026 年 7 月',
  defaultYaw: '45deg',
  defaultPitch: '10deg',
  defaultZoomLvl: 50,
  navbar: ['zoom', 'fullscreen', 'caption'],
  loadingTxt: '加载中...',
  lang: {
    zoom: '缩放',
    fullscreen: '全屏',
  },
});

带标记和画廊

ts
import { Viewer } from '@photo-sphere-viewer/core';
import { MarkersPlugin } from '@photo-sphere-viewer/markers-plugin';
import { GalleryPlugin } from '@photo-sphere-viewer/gallery-plugin';
import '@photo-sphere-viewer/markers-plugin/index.css';

const viewer = new Viewer({
  container: '#viewer',
  panorama: 'room1.jpg',
  navbar: ['zoom', 'fullscreen', 'markers', 'gallery'],
  plugins: [
    MarkersPlugin.withConfig({
      markers: [
        {
          id: 'door',
          position: { yaw: '30deg', pitch: 0 },
          image: 'pin.png',
          size: { width: 40, height: 40 },
          tooltip: '入口',
          content: '<h3>入口大门</h3><p>由此进入主展厅</p>',
        },
        {
          id: 'window',
          position: { yaw: '-90deg', pitch: '5deg' },
          html: '<div class="hotspot">窗</div>',
          tooltip: '落地窗 - 点击查看详情',
        },
      ],
    }),
    GalleryPlugin.withConfig({
      items: [
        { id: '1', name: '客厅', panorama: 'room1.jpg', thumbnail: 'thumb1.jpg' },
        { id: '2', name: '餐厅', panorama: 'room2.jpg', thumbnail: 'thumb2.jpg' },
        { id: '3', name: '卧室', panorama: 'room3.jpg', thumbnail: 'thumb3.jpg' },
      ],
      visibleOnLoad: true,
      hideOnClick: false,
    }),
  ],
});

viewer.addEventListener('ready', () => {
  console.log('全景加载完成');
});

立方体贴图

ts
import { Viewer } from '@photo-sphere-viewer/core';
import { CubemapAdapter } from '@photo-sphere-viewer/cubemap-adapter';

const viewer = new Viewer({
  container: '#viewer',
  adapter: CubemapAdapter,
  panorama: {
    left: 'cubemap/left.jpg',
    front: 'cubemap/front.jpg',
    right: 'cubemap/right.jpg',
    back: 'cubemap/back.jpg',
    top: 'cubemap/top.jpg',
    bottom: 'cubemap/bottom.jpg',
  },
});

核心 API

Viewer 类

new Viewer(config: ViewerConfig) — 创建查看器实例,返回已初始化的 Viewer。

关键配置项:

配置项类型默认值说明
containerHTMLElement | string必填容器元素
panoramastring | object必填全景源(URL 或适配器对象)
adapterAdapterConstructorEquirectangularAdapter适配器类
pluginsPluginDefinition[][]插件数组
defaultYawnumber | string0默认水平角
defaultPitchnumber | string0默认俯仰角
defaultZoomLvlnumber50默认缩放 (0-100)
minFov / maxFovnumber30 / 90视场角范围(度)
fisheyeboolean | numberfalse鱼眼效果(0-1 或 true)
moveSpeednumber1拖拽灵敏度
zoomSpeednumber1滚轮缩放灵敏度
moveInertiaboolean | number0.8惯性移动(false 关闭)
navbarNavbarConfig—导航栏按钮配置
keyboardboolean | string'fullscreen'键盘控制
canvasBackgroundstring'#000'画布背景色
langobject—国际化覆盖(覆盖默认英文)

主要方法:

方法返回值说明
animate(options)Animation平滑旋转/缩放(yaw, pitch, zoom, speed)
rotate(position)—立即旋转到指定视角
setPanorama(url, options?)Promise切换全景图(支持过渡动画)
zoom(level) / zoomIn(step?) / zoomOut(step?)—缩放控制
getPosition(){ yaw, pitch }获取当前视角
getZoomLevel()number获取当前缩放 (0-100)
getPlugin(PluginClass)PluginInstance获取插件实例
setOption(key, value)—更新单个选项
setOptions(obj)—批量更新选项
destroy()—销毁查看器,释放 Three.js 资源

主要事件:

事件回调参数触发时机
ready—全景加载完成,首次渲染就绪
click{ rightclick, data: { yaw, pitch, ... } }点击全景
position-updated{ position: { yaw, pitch } }视角变化
zoom-updated{ zoomLevel }缩放变化
panorama-loaded{ data }新全景加载完成
load-progress{ progress }加载进度 (0-100)
fullscreen-updated{ fullscreen }全屏状态变化

适配器(全景格式)

适配器NPM 包适用场景配置要点
EquirectangularAdapter@photo-sphere-viewer/core(内置)标准 2:1 全景图默认即用,自动读取 XMP 元数据
CubemapAdapter@photo-sphere-viewer/cubemap-adapter立方体贴图(6 面/条纹/展开图)panorama: { left, front, ... }
EquirectangularTilesAdapter@photo-sphere-viewer/equirectangular-tiles-adapter大图分块加载配置多级 tiles 尺寸
CubemapTilesAdapter@photo-sphere-viewer/cubemap-tiles-adapter立方体贴图分块类似上者,六面分块
EquirectangularVideoAdapter@photo-sphere-viewer/equirectangular-video-adapter360° 视频(等距柱状)panorama: { source: 'video.mp4' }
CubemapVideoAdapter@photo-sphere-viewer/cubemap-video-adapter360° 视频(立方体贴图)需配合 VideoPlugin
DualFisheyeAdapter@photo-sphere-viewer/dual-fisheye-adapter双鱼眼原始格式(Ricoh Theta Z1 等)v5.15+ 含 DualFisheyeVideoAdapter

适配器的全景数据配置(PanoData)

ts
const viewer = new Viewer({
  adapter: EquirectangularAdapter,
  panorama: 'crop.jpg',
  panoData: {
    fullWidth: 4096,   // 源图像完整宽度
    fullHeight: 2048,   // 源图像完整高度
    croppedWidth: 2048, // 裁剪后宽度
    croppedHeight: 1024,// 裁剪后高度
    croppedX: 1024,     // 裁剪 X 偏移
    croppedY: 512,      // 裁剪 Y 偏移
  },
});

等距柱状图适配器默认使用 useXmpData: true 自动读取图像 XMP 元数据获取裁剪信息。v5.14.2+ 新增 shader 选项(默认 false,可设为 true 用像素着色器消除极点扭曲)。


插件系统、MarkersPlugin 与虚拟导览(VirtualTourPlugin)的完整用法见 reference/plugins.md

常见问题

问题解决
全景图加载不出来多为 CORS:给图片源配 Access-Control-Allow-Origin,本地调试用同源或 dev server 代理
移动端陀螺仪 / 立体 VR 无效这些能力需要 HTTPS 环境(+ gyroscope-plugin / stereo-plugin)
切图后标记丢了setPanorama() 会重置标记;跨场景管理交给 VirtualTourPlugin
速度快慢不好调时长参数是毫秒(speed: 1500 即 1.5 秒)或 '3rpm' 这类角度速度格式
极点拉伸 / 变形等距柱状图适配器 5.14.2+ 可用 shader: true(像素着色器)消除极点扭曲
想直接用 React用官方生态的 react-photo-sphere-viewer wrapper,或自行在 useEffect 里 new Viewer

典型工作流

工作流一:单场景全景查看器

  1. npm install @photo-sphere-viewer/core,页面里放一个容器并设好宽高
  2. new Viewer({ container, panorama, navbar, caption }) 初始化,defaultYaw/defaultPitch/defaultZoomLvl 定初始机位
  3. 需要热点就加 MarkersPlugin(markers: [{ id, position: { yaw, pitch }, image | html, tooltip }])
  4. 监听 ready / click / position-updated 事件接业务逻辑
  5. 切换图片用 setPanorama(url, options)(可带过渡动画),销毁页面时 destroy() 释放 Three.js 资源

工作流二:多场景虚拟导览

  1. 装 virtual-tour-plugin(+ markers-plugin,导览箭头依赖它)
  2. VirtualTourPlugin.withConfig({ nodes, startNodeId, positionMode }):每个 node 有自己的 panorama 与 links
  3. 需要底部缩略图导航再叠 GalleryPlugin
  4. 用 viewer.getPlugin(VirtualTourPlugin).gotoNode(id) 做程序化跳转

工作流三:大图 / 360° 视频 / 双鱼眼

  1. 大图分块:equirectangular-tiles-adapter(或 cubemap 版),配好多级 tiles 尺寸
  2. 视频:equirectangular-video-adapter(panorama: { source })+ video-plugin 出控制条
  3. 双鱼眼相机原片:dual-fisheye-adapter
  4. 裁剪过的全景图用 panoData(fullWidth/fullHeight/croppedX/Y...)告诉适配器原图与裁剪关系,或依赖默认的 XMP 元数据读取

AI 使用建议

  • 推荐工作流模式:AI 助手应将全景项目组织为「Viewer 核心配置 → 适配器选择 → 插件组合 → 标记定义」的结构。初始用 EquirectangularAdapter + MarkersPlugin + GalleryPlugin 组合覆盖 80% 场景,后续按需添加 VirtualTourPlugin 或 GyroscopePlugin。
  • 关键注意事项:① panorama 路径需确保 CORS 头正确配置(Access-Control-Allow-Origin: *);② 所有时长/速度参数以毫秒为单位(speed: 1500 = 1.5 秒)或 '3rpm' 格式(每分钟旋转次数计算);③ MarkersPlugin 的 CSS 样式需通过 className + 外部 CSS 控制,不建议内联大量样式;④ setPanorama() 后标记需重新设置,除非使用 VirtualTourPlugin 管理节点。
  • 常用代码模式:
    • 基础查看器:new Viewer({ container, panorama }) + @photo-sphere-viewer/core/index.css
    • 标记:MarkersPlugin.withConfig({ markers: [{ id, position, image, tooltip }] })
    • 画廊:GalleryPlugin.withConfig({ items: [{ id, name, panorama, thumbnail }] })
    • 导览:VirtualTourPlugin.withConfig({ nodes, startNodeId, positionMode: 'manual' })
    • 动画:viewer.animate({ yaw, pitch, zoom, speed: 1500 })
    • 获取插件:viewer.getPlugin(MarkersPlugin).addMarker(...)


相关技能


参考资源

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Photo Sphere Viewer AI skill do?

Use when displaying 360-degree panoramic images (equirectangular/cubemap/dual-fisheye) in web applications, building virtual tours with markers and transitions, embedding interactive panoramas in Vue/React/vanilla JS, or creating 360-degree video players with gyroscope VR support. Photo-Sphere-Viewer v5: JavaScript panorama viewer based on Three.js. Covers Viewer class, 6 adapters, 14 plugins, and markers system.

Why use Photo Sphere Viewer on TypingMind?

Because you install it once and use it with any model. Photo Sphere Viewer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Photo Sphere Viewer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/znlgis/opengis-skills/tree/main/3d/photo-sphere-viewer. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Photo Sphere Viewer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Photo Sphere Viewer?

As many as you like. As long as a model supports skills, you can use Photo Sphere Viewer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Photo Sphere Viewer AI skill free?

Yes. It is published on GitHub by znlgis under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇