Sparkjsのロゴ

Sparkjs

コミュニティ
shi3z
sparkjs

Build 3D Gaussian Splat applications using the SparkJS library (@sparkjsdev/spark). This skill should be used when users want to create, modify, or debug web-based 3D Gaussian splatting scenes with Three.js integration, including loading splat files, procedural splat generation, splat editing with SDF shapes, Level-of-Detail streaming, custom Dyno shaders, and performance optimization.

概要

公開者shi3z
リポジトリsparkjs-skill
スキル名sparkjs
スター
38
フォーク
2
同梱ファイル
2
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    shi3zがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Sparkjs」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/shi3z/sparkjs-skill/tree/master
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/shi3z/sparkjs-skill.git \
  .claude/skills/sparkjs
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSparkjsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSparkjsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Sparkjsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

SparkJS - 3D Gaussian Splat Rendering Library

SparkJS is a JavaScript library for rendering and manipulating 3D Gaussian splats in web browsers. It integrates with Three.js to provide high-performance visualization of splat-based 3D models.

  • Documentation: https://sparkjs.dev/docs/
  • Current version: 2.0.0
  • CDN: https://sparkjs.dev/releases/spark/2.0.0/spark.module.js
  • npm: @sparkjsdev/spark

When to Use

Use this skill when:

  • Creating a new 3D Gaussian splatting web application
  • Loading and displaying .ply, .spz, .splat, .ksplat, .sog, .rad splat files
  • Generating procedural splats (grids, spheres, text, images, particles)
  • Editing splats with SDF shapes (lighting, deletion, deformation)
  • Implementing Level-of-Detail (LoD) for large splat scenes
  • Writing custom Dyno shader graphs for GPU computation
  • Optimizing splat rendering performance
  • Adding camera/navigation controls (FPS, pointer, gamepad)

Quick Start Template

Use this as a starting point for any SparkJS project:

html
<style> body { margin: 0; } </style>
<script type="importmap">
  {
    "imports": {
      "three": "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.180.0/three.module.js",
      "@sparkjsdev/spark": "https://sparkjs.dev/releases/spark/2.0.0/spark.module.js"
    }
  }
</script>
<script type="module">
  import * as THREE from "three";
  import { SparkRenderer, SplatMesh } from "@sparkjsdev/spark";

  const scene = new THREE.Scene();
  const camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.01, 1000);
  const renderer = new THREE.WebGLRenderer();
  renderer.setSize(innerWidth, innerHeight);
  document.body.appendChild(renderer.domElement);

  const spark = new SparkRenderer({ renderer });
  scene.add(spark);

  const splat = new SplatMesh({ url: "https://sparkjs.dev/assets/splats/butterfly.spz" });
  splat.quaternion.set(1, 0, 0, 0);
  splat.position.set(0, 0, -3);
  scene.add(splat);

  renderer.setAnimationLoop(function animate(time) {
    renderer.render(scene, camera);
  });
</script>

Core Architecture

SparkRenderer

The main renderer, added to the Three.js scene. Required for all splat rendering.

javascript
const spark = new SparkRenderer({
  renderer,                    // THREE.WebGLRenderer (required)
  maxStdDev: Math.sqrt(8),     // Gaussian render extent
  sortRadial: true,            // true=distance, false=Z-depth
  enableLod: true,             // Level-of-Detail
  lodSplatScale: 1.0,          // LoD detail multiplier
  pagedExtSplats: false,       // Extended encoding for paged splats
  enable2DGS: false,           // 2D Gaussian splatting
});
scene.add(spark);

Key methods:

  • dispose() - Free resources
  • update({ scene, camera }) - Manual splat update (awaitable)
  • render(scene, camera) - Render to canvas
  • renderTarget({ scene, camera }) - Render to offline target
  • readTarget() - Read target as Uint8Array RGBA
  • renderEnvMap({ scene, worldCenter }) - Render environment map

SplatMesh

Represents a splat model. Subclass of THREE.Object3D.

javascript
const splat = new SplatMesh({
  url: "./model.spz",          // Load from URL
  // OR
  packedSplats: myPackedSplats, // From PackedSplats instance
  // OR
  constructSplats: (splats) => { /* procedural */ },

  maxSplats: 100000,           // Reserve capacity
  extSplats: false,            // Float32 precision
  lod: true,                   // Generate LoD
  paged: true,                 // Streaming from .rad

  onProgress: (e) => {},       // Download progress
  onLoad: (mesh) => {},        // Init complete
  onFrame: ({ mesh, time, deltaTime }) => {}, // Per-frame
});
scene.add(splat);

Key properties:

  • position, quaternion, rotation, scale - Transform (uniform scale only)
  • recolor: THREE.Color - Tint multiplier
  • opacity: number - Global opacity (0-1)
  • maxSh: number - Spherical Harmonics level (0-3)
  • initialized: Promise<SplatMesh> - Await initialization
  • numSplats: number - Current splat count

Key methods:

  • pushSplat(center, scales, quaternion, opacity, color) - Add a splat
  • forEachSplat(callback) - Iterate all splats (read-only)
  • getBoundingBox(centersOnly) - Get bounding box
  • raycast(raycaster, intersects) - Three.js raycasting
  • dispose() - Free resources

PackedSplats

Efficient 16-byte-per-splat data structure.

javascript
const packed = new PackedSplats({
  url: "./model.ply",
  // OR
  construct: (splats) => {
    splats.pushSplat(center, scales, quat, opacity, color);
  },
  maxSplats: 1000,
});

Methods: getSplat(i), setSplat(i, ...), pushSplat(...), forEachSplat(cb), getTexture(), dispose()

ExtSplats

32-byte-per-splat format with float32 center coordinates for large scenes.

javascript
const ext = new ExtSplats({ url: "./large-scene.ply", extSplats: true });

Splat Editing (SDF)

Apply real-time edits using Signed Distance Field shapes:

javascript
import { SplatEdit, SplatEditSdf, SplatEditSdfType, SplatEditRgbaBlendMode } from "@sparkjsdev/spark";

const edit = new SplatEdit({
  rgbaBlendMode: SplatEditRgbaBlendMode.MULTIPLY,
  sdfSmooth: 0.1,
  softEdge: 0.05,
  sdfs: [
    new SplatEditSdf({
      type: SplatEditSdfType.SPHERE,
      radius: 0.5,
      opacity: 0.0,       // Delete splats in sphere
      color: new THREE.Color(1, 1, 1),
    })
  ]
});
edit.position.set(0, 1, 0);
splatMesh.add(edit);       // Attach as child

SDF shape types: ALL, PLANE, SPHERE, BOX, ELLIPSOID, CYLINDER, CAPSULE, INFINITE_CONE Blend modes: MULTIPLY, SET_RGB, ADD_RGBA

Procedural Splats

Built-in constructors for common patterns:

javascript
import { constructGrid, constructAxes, constructSpherePoints, textSplats, imageSplats } from "@sparkjsdev/spark";
  • constructGrid({ ... }) - Regular grid lattice
  • constructAxes({ scale }) - XYZ axis visualization
  • constructSpherePoints({ maxDepth }) - Sphere subdivision
  • textSplats({ text, font, size, color }) - Text to splats
  • imageSplats({ url, subsample }) - Image to splats
  • generators.staticBox(...) - Random particles in volume
  • generators.snowBox(...) / DEFAULT_SNOW / DEFAULT_RAIN - Particle effects

Controls

javascript
import { SparkControls } from "@sparkjsdev/spark";

const controls = new SparkControls({
  canvas: renderer.domElement,
  moveSpeed: 1.0,
  rotateSpeed: 2.0,
});

// In animation loop:
controls.update(deltaTime, { position: camera.position, quaternion: camera.quaternion });

Level-of-Detail (LoD)

Runtime LoD

javascript
const splat = new SplatMesh({ url: "./model.spz", lod: true });

Pre-built LoD (recommended)

bash
npm run build-lod -- model.ply --quality
javascript
const splat = new SplatMesh({ url: "./model-lod.rad", paged: true });

Tuning

  • SparkRenderer.lodSplatCount - Target budget (platform-dependent)
  • SparkRenderer.lodSplatScale - Budget multiplier
  • SplatMesh.lodScale - Per-object detail factor

Performance Tips

  • Set antialias: false on THREE.WebGLRenderer
  • For VR: use maxStdDev: Math.sqrt(5)
  • Splat budgets: Quest 3 ~1M, phones ~1-3M, desktop ~1-20M
  • Use LoD and foveation for large scenes
  • Evaluate devicePixelRatio vs. performance tradeoff

Dyno Shader System

For custom GPU computation, refer to references/dyno-api.md for the full Dyno stdlib (117+ functions). Basic pattern:

javascript
import { dyno } from "@sparkjsdev/spark";

const myGenerator = dyno.dynoBlock(
  { index: "int" },
  { gsplat: "Gsplat" },
  ({ index }) => {
    let gsplat = dyno.readPackedSplat(packedSplats.dyno, index);
    gsplat = dyno.combineGsplat({ gsplat, opacity: 1.0 });
    return { gsplat };
  }
);

Key Imports

javascript
import {
  SparkRenderer,
  SplatMesh,
  PackedSplats,
  ExtSplats,
  SplatEdit,
  SplatEditSdf,
  SplatEditSdfType,
  SplatEditRgbaBlendMode,
  SparkControls,
  dyno,
  utils,
  constructGrid,
  constructAxes,
  constructSpherePoints,
  textSplats,
  imageSplats,
  generators,
} from "@sparkjsdev/spark";

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Sparkjs」では何ができますか?

Build 3D Gaussian Splat applications using the SparkJS library (@sparkjsdev/spark). This skill should be used when users want to create, modify, or debug web-based 3D Gaussian splatting scenes with Three.js integration, including loading splat files, procedural splat generation, splat editing with SDF shapes, Level-of-Detail streaming, custom Dyno shaders, and performance optimization.

TypingMindでSparkjsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Sparkjsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSparkjsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/shi3z/sparkjs-skill/tree/masterを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Sparkjsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Sparkjsで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSparkjsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Sparkjs」は無料ですか?

shi3zがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇