lightning-energy-skill-vfx
它能做什么
这个技能指导智能体为游戏技能制作闪电、能量球以及相关的冲击效果。适合希望电光效果动感十足、线条精细、又不会遮挡屏幕的游戏开发者。
适用场景
- ✓游戏技能需要分叉闪烁的闪电的时候。
- ✓能量球或风暴需要位于角色拳头前方的时候。
- ✓同一技能需要冲击帧、气爆或残影烟雾的时候。
技能链接
https://github.com/MengTo/Skills/blob/main/agent-skills/game-combat/lightning-energy-skill-vfx/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我的拳击技能中加入一个闪电能量球,带有分叉的电击,并在命中时闪烁。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把闪电构建为分叉的条带,带有明亮的核心和紫色光晕,把电击的时机与共享的效果时钟对齐,并添加合成通道。它会限制闪烁的频率,使屏幕保持清晰可读。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Lightning Energy Skill VFX
Use this for the effect half of a skill: what the fist throws, what the air does, what the hit leaves. Reach for a sibling instead in these cases:
- Readable, budgeted gameplay effects in general (telegraphs, status, cleanup rules):
create-game-vfx. Its readability rules still apply here. - Scoring a skill out of 10, or polishing the caster's body and timing:
game-dev-combat-skill-polishandgame-dev-combat-animation.
Source: a 30-second skill-showcase brief for a dark-fantasy ability user. White-blue lightning, a semi-transparent thunderstorm orb ahead of the fist, black smoke afterimages like a shattered cloak, air bursts, orange sparks and impact frames. Only the effect language is kept here. The character, story and shot list are left out.
Verified stack: Three.js r170, WebGL2, GLSL ShaderMaterials, HalfFloat render targets, a 96³ baked noise texture, and a hand-written bloom and composite. No post-processing library. The demo's floor is Poly Haven's Dry Ground 01 by Rob Tuytel (CC0), its 1k colour, normal and AO/roughness maps in demo/assets/ground/, embedded by demo/build.mjs as data URIs so the page still opens from disk.
The mechanism
One effect clock, one composite, and a shadow that belongs to the orb.
- One clock. Lightning re-rolls on it, a hit freezes it (a hold), and a time ramp slows it. A 0.1 s hold therefore stops sparks, smoke, rings and lightning together.
- One composite. Every layer that bends the air writes a signed screen offset into one shared distortion buffer. The composite reads colour through that offset, adds bloom and tone maps once. Only then does it draw the impact frame on top, so a negative flash inverts the finished image rather than one layer.
- The orb carries its own shadow. A black teardrop is drawn behind the orb, and ribbons and billows leave from the orb's back. Wherever the fist goes, the black follows it; nothing is emitted from a body you cannot see.
- Lightning is a tree of strips in one point ring. A bolt is a trunk, its forks, their forks and twigs. All their points live in one ring buffer and the GPU buffers are sized by a point budget, so thousands of twigs fit. Points of bolts anchored to the orb are stored relative to it and the anchor is a uniform, so the buffers change only when the lightning re-rolls (30 Hz), not every frame the orb moves.
- Lightning has a life, drawn in the shader. Every vertex carries when the leader reaches it, so a channel grows out from its origin (forks from their junctions) in 30–90 ms on the lightning's own clock, flares as the return stroke connects, holds its shape for a few ticks, and fades through an afterglow. The ground flashes when the leader arrives.
Reuse the working effect
Copy assets/storm-energy.mjs. You pass in your own THREE, and the module does not import a second copy. The demo runs this same module, inlined by demo/build.mjs because a page opened from disk cannot import modules.
import { createStormEnergy, ENERGY_LIGHTS_GLSL, GROUND_HEAT_GLSL } from './storm-energy.mjs';
const fx = createStormEnergy(THREE, { renderer, scene, camera }); // bakes the noise texture
fx.setSize(width * dpr, height * dpr, dpr); // drawing-buffer pixels, again on resize
fx.warmup(); // compile every effect before the first hit
const orb = fx.createOrb({ radius: 0.4 }); // shadow: true by default (teardrop, ribbons, billows, motes)
orb.reach = [shoulder, elbow, head]; // Vector3s the arcs can leap back to
orb.strikeAt = groundSpot; // optional: aim its ground strikes; orb.strikes = false stops them
// Optional: let ground arcs follow your ground's cracks. Return [x,y,z,...] walking from (x, z).
fx.options.crackPath = (x, z, heading, length) => traceAlongCracks(x, z, heading, length);
// Ground and props: add ENERGY_LIGHTS_GLSL (+ GROUND_HEAT_GLSL, WET_GLSL), spread fx.lightUniforms
// (+ fx.heatUniforms) into their uniforms, and add energyLight(...) and
// uGlow * groundHeat(p.xz) * yourCrackMask to their colour. Use wetness(p.xz) for the ground's
// roughness: the bolts' reflections are masked by the same function.
function frame(realDt) {
const dt = fx.update(realDt); // sim seconds: 0 during a hold, scaled by ramps
// move the fist with dt, then:
常见问题
效果会不会太亮?
技能追求动感但不刺眼的效果,并限制屏幕闪烁的频率。
它包括烟雾或火花吗?
包括。它涵盖同一技能中的黑色残影烟雾和橙色火花。
它使用哪个引擎?
Three.js,配合 WebGL2 和自定义着色器。
详情
作者的原始描述
Build the effects of a close-combat energy skill as one visual language in Three.js. Lightning that reads as lightning, dynamic but never in your face: trees of strips (trunk, forks of forks, hair-fine branchlets) with a fine white core in a violet-blue glow, each channel reaching out as a stepped leader, flaring as it connects, holding its shape and fading through an afterglow, one discharge at a time; a storm-cloud orb (a lit billow surface that churns in place, 10-15 plasma-globe arcs from a small white core to its inner wall, crawlers on the rim, a hairline fresnel); ground strikes that fl
repo: MengTo/Skills
热度
- GitHub 星标
- 7.2k
- 排名
- #13349
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
3d-cloth-material
7.2k帮你的智能体在 Three.js 中制作逼真的编织织物,包括纱线编织纹理、柔和光泽、自然褶皱、下摆和缝线。
3d-falling-leaves
7.2k帮你的智能体在 3D 场景中添加逼真的飘落树叶,树叶会翻滚、随风飘动,并在镜头移动时循环利用。
3d-four-seasons
7.2k帮你的智能体为 3D 场景添加春夏秋冬四季效果,无需重建场景即可改变植被、光线、天空和积雪。
3d-high-poly-models
7.2k帮你的智能体构建形状平滑、边缘可信的精细 3D 模型,然后制作在网页上运行流畅的轻量版本。