atmosphereって?What is atmosphere?
WebGL のフラグメントシェーダ1枚で空を描くレンダラです。依存ライブラリはなく、DOM にも フレームワークにも依存しません。物理的な気象シミュレーションではないので正確ではありませんが、 移り変わる空の要素をプロシージャルにかつ手軽に表現できます。
A renderer that draws the sky from one WebGL fragment shader. No dependencies, and no coupling to the DOM or to any framework. It isn't a physical weather simulation, so it isn't accurate — it's an easy way to get a sky that keeps changing procedurally.
作例Examples
設定可能な項目What you can set
時刻と場所Time and place
緯度経度と日時から実際の太陽と月の位置を計算します。月の満ち欠けも日付どおり。空のグラデーション、夕焼けの赤みの強さ、地球の影とビーナスの帯。 The real positions of the sun and the moon from latitude, longitude and date, the moon's phase included. The sky's gradient, how hard the sunset burns, the Earth's shadow and the Belt of Venus.
雲の形状Cloud shapes
巻雲から積乱雲まで、WMO の十種雲形を量で重ねます。ひとつ選ぶのではなく、実際の空のように混ざります。 Cirrus through cumulonimbus, layered by amount rather than picked one at a time — the way a real sky mixes them.
気象Weather
雨・雪・風・雷・靄。mm/h や m/s といった観測単位で渡せるので、気象 API の応答をほぼそのまま流し込めます。 Rain, snow, wind, lightning and haze — taken in observation units (mm/h, m/s, km), so a weather API's response passes through almost as-is.
夜空The night sky
光害はボートルスケールで。暗い空では天の川が星の集まりとして現れ、流星群は ZHR で流せます(たまに火球も)。オーロラと黄道光、地球照と月面の模様まで。 Light pollution on the Bortle scale. Under a dark sky the Milky Way appears as resolved stars, meteor showers run at a ZHR (with the odd fireball), and there is the aurora, the zodiacal light, and the moon's earthshine and maria.
光学現象Optical phenomena
巻層雲越しの 22° ハロと幻日、雨に日が差したときの虹(副虹つき)、雲の切れ間からの薄明光線、空を横切る飛行機雲。 The 22° halo and parhelia through cirrostratus, a rainbow (and its secondary) when the sun shines on rain, crepuscular rays through gaps in the cloud, contrails crossing the sky.
海The sea
水平線の下を、空を映す水面に。フレネル反射とゆるいうねり、太陽の光の道。CPL を回すと水面の反射も変わります。 Open water below the horizon, mirroring the sky: a Fresnel reflection, a gentle swell and the sun's road of light. Turning the polarizer changes the reflection too.
露出と偏光Exposure and optics
合成は線形光。露出・コントラスト・ショルダーのトーンカーブと、CPL フィルタのエミュレーションを備えます。 Compositing is done in linear light, with a tone curve — exposure, contrast, shoulder — and a circular-polarizer emulation on top.
カラーフィルタColor filters
セピア、モノクロ、サイアノタイプなど。切り替えると色そのものが補間されるので滑らかに移ります。 Sepia, monochrome, cyanotype and the rest. Switching interpolates the colors themselves, so one flows into the next.
使い方Usage
import { Atmosphere } from '@takustaqu/atmosphere';
const sky = new Atmosphere(canvas, {
time: new Date(),
location: { latitude: 35.68, longitude: 139.77 },
weather: { cloudCover: 0.95, precipitation: 12, windSpeed: 18 },
});
// 数秒かけて滑らかに遷移する// eases over a few seconds
sky.set({ weather: 'clear' });
デモDemos
よくある質問FAQ
入道雲が不自然ですThe cumulonimbus looks unnatural
永遠のテーマとして向き合っています。 It is an eternal theme, and we keep working on it.
逆光になっているべき雲がなっていないことが多々ありますClouds that should be backlit often aren't
atmosphere は物理現象のシミュレーションをしているわけではないので、現実を正しく反映していない場合があります。 atmosphere does not simulate the physics, so there are times it does not reflect reality correctly.
重いですIt's heavy
私たちもこのテーマと向き合っていますが、空全体をシェーダー1枚で描くというコンセプト上、特にシェーダーのコンパイル時にはどうしても重くなりがちです。 We are working on that too, but drawing the whole sky in one shader is the concept, and it tends to be heavy — above all while the shader compiles.
音が出ませんThere's no sound
音はサポートの予定がありません。 Sound is not planned.
HDR に対応していますか?Does it support HDR?
内部的には Yes、ブラウザの Canvas / WebGL の出力としてはまだ No、というところです。 Internally, yes; as output from a browser's Canvas / WebGL, not yet.