7_5_TimeOfDay - gaj-cg/ray-mmd-docs-ja GitHub Wiki

7.スカイボックス

7-5.Time of day

昼間用のスカイボックス。
これは、実際の屋外の空をシミュレートするために使用される物理ベースの大気散乱モデルです。 太陽の位置を制御するためにメインライトの位置を制御することにより、日の出から日没までのプロセスを達成することができます。
2種類のモデルがあり、通常版(Time of day)は流れる雲があり、軽量版(Time of day fast)には雲がありません。

Time of day Time of day fast
7_4_TimeOfDay 7_4_TimeOfDayFast

ファイル一覧

「Main」タブは表示用、「EnvLightMap」タブはライティング用、「FogMap」タブはフォグ用。

ファイル名 設定先タブ 説明
LICENSE.txt ―― ライセンスの書かれたファイル(CC BY-NC-SA 3.0)
README.png ―― fxファイルの設定先が記載されてる画像
Time of day fast.fx Main 軽量版用
Time of day fast.pmx ―― 軽量版スカイボックスのモデル兼コントローラー
Time of day.conf ―― 設定ファイル
Time of day.fx Main 通常版用
Time of day.pmx ―― 通常版スカイボックスのモデル兼コントローラー
Time of fog with godray with cloud caster.fx FogMap フォグ用 ゴッドレイ有り クラウドキャスター有り
Time of fog with godray.fx FogMap フォグ用 ゴッドレイ有り
Time of fog.fx FogMap フォグ用
Time of lighting.fx EnvLightMap ライティング用

使い方

  • 通常版

    1. Time of day.pmxをMMDに追加します。
      「Main」タブにはTime of day.fx、「MaterialMap」にはMaterials\material_2.0.fxが割り当てられます。
    2. 「MaterialMap」に Materials\material_skybox.fx を割り当てます。
    3. MMDの「モデル描画順」で一番上に。
      (これはスカイボックス共通の操作)
    4. Time of lighting.fxを「EnvLightMap」に割り当てます。
    5. 必要があればフォグ用のfxファイルを「FogMap」タブに割り当てられます。(必要なければ割り当ては不要です)
    6. コントローラーで各種調整をします。
  • 軽量版

    1. Time of day fast.pmxをMMDに追加します。
      「Main」タブにはTime of day fast.fx、「MaterialMap」にはMaterials\material_2.0.fx.fxが割り当てられます。
    2. 「MaterialMap」に Materials\material_skybox.fx を割り当てます。
    3. MMDの「モデル描画順」で一番上に。
      (これはスカイボックス共通の操作)
    4. Time of lighting.fxを「EnvLightMap」に割り当てます。
    5. 必要があればフォグ用のfxファイルを「FogMap」タブに割り当てられます。(必要なければ割り当ては不要です)
    6. コントローラーで各種調整をします。

コントローラの説明

※ ミー散乱とレイリー散乱:
Time of dayとTime of night は、物理ベースの大気散乱モデルということで、ミー散乱とレイリー散乱の計算が行われており、コントローラの設定にも出てきます。

ミー散乱は、光の波長程度以上の大きさの球形の粒子による光の散乱現象である。粒子のサイズが非常に大きくなると、ミー散乱と幾何光学の二つの手法による計算結果が類似するようになる。なお、波長に対して粒子(散乱体)が大きい場合は回折散乱が、光の波長の1/10以下になるとレイリー散乱が適用される。(wikipediaより引用)

また、ゴッドレイや薄明光線と呼ばれれる、光の筋が見える現象はチンダル現象の一種で、主にミー散乱によって発生します。

表情操作パネル 左上

太陽と太陽光に影響を受ける大気の設定。結果的に空の色や空からの環境光に影響を与えます。

  • SunRadius+ / SunRadius-
    太陽の半径を増減

    SunRadius+ SunRadius ±0 SunRadius-
    7_4_SunRadius_1 7_4_SunRadius_0 7_4_SunRadius_2
  • SunRadiance+ / SunRadiance-
    太陽の輝きを増減

    SunRadiance+ SunRadiance ±0 SunRadiance-
    7_4_SunRadiance_1 7_4_SunRadius_0 7_4_SunRadiance_2
  • SunPhase+ / SunPhase-

    SunPhase+ SunPhase ±0 SunPhase-
    7_4_SunPhase_1 7_4_SunRadius_0 7_4_SunPhase_2
  • SunTurbidity+ / SunTurbidity-

    SunTurbidity+ SunTurbidity ±0 SunTurbidity-
    7_4_SunTurbidity_1 7_4_SunRadius_0 7_4_SunTurbidity_2
  • OzoneMass+ / OzoneMass-
    オゾン層の密度。

    OzoneMass+ OzoneMass ±0 OzoneMass-
    7_4_OzoneMass_1 7_4_SunRadius_0 7_4_OzoneMass_2
  • RayleighColorH+ / RayleighColorS+ / RayleighColorV+ / RayleighColorV-
    レイリー散乱の色の調整。空の色を調整します。

    RayleighColorS ±0 RayleighColorS+
    7_4_SunRadius_0 7_4_RayleighColorS_1
  • RayleighHeight+ / RayleighHeight-
    レイリー散乱が起こる大気の高さ
    デフォルトは8kn、最大24km、最小0.00001km(=1cm)

    RayleighHeight+ RayleighHeight ±0 RayleighHeight-
    7_4_RayleighHeight_1 7_4_SunRadius_0 7_4_RayleighHeight_2

表情操作パネル 右上

環境光関連の設定

名称 機能
EnvDiffLight+
EnvDiffLight-
アルベドに対して影響を及ぼす光の強さ
EnvSpecLight+
EnvSpecLight-
スペキュラに対して影響を及ぼす光の強さ
EnvSSSLight+
EnvSSSLight-
サブサーフェスに対して影響を及ぼす光の強さ

※ 効果は 7_2_Helipad_GoldenHour の同名モーフを参照のこと。

表情操作パネル 左下

フォグ関連の設定(フォグ用のfxを割り当てていないと効果はありません)
※ 画像は Time of fog with godray.fx を「FogMap」タブに割り当てています。

  • MiePhase+ / MiePhase-

    MiePhase+ MiePhase ±0 MiePhase-
    7_4_MiePhase_1 7_4_TimeOfDay_withFog 7_4_MiePhase_2
  • MieTurbidity+ / MieTurbidity-

    MieTurbidity+ MieTurbidity ±0 MieTurbidity-
    7_4_MieTurbidity_1 7_4_TimeOfDay_withFog 7_4_MieTurbidity_2
  • FogRange+ / FogRange-
    フォグの範囲

    FogRange+ FogRange ±0 FogRange-
    7_4_FogRange_1 7_4_TimeOfDay_withFog 7_4_FogRange_2
  • FogIntensity+ / FogIntensity-
    フォグ強度

    FogIntensity+ FogIntensity ±0 FogIntensity-
    7_4_FogIntensity_1 7_4_TimeOfDay_withFog 7_4_FogIntensity_2
  • FogDensity+ / FogDensity-
    フォグ密度

    FogDensity+ FogDensity ±0 FogDensity-
    7_4_FogDensity_1 7_4_TimeOfDay_withFog 7_4_FogDensity_2
  • FogDensityFar+ / FogDensityFar-
    遠方のフォグ密度

    FogDensityFar+ FogDensityFar ±0 FogDensityFar-
    7_4_FogDensityFar_1 7_4_TimeOfDay_withFog 7_4_FogDensityFar_2

表情操作パネル 右下

雲の設定(Time of day fastにはありません)

  • Cloud+ / Cloud-
    雲の量

    Cloud+ Cloud ±0 Cloud-
    7_4_Cloud_1 7_4_SunRadius_0 7_4_Cloud_2
  • CloudTurbidity+ / CloudTurbidity-
    雲の濃さ

    CloudTurbidity+ CloudTurbidity ±0 CloudTurbidity-
    7_4_CloudTurbidity_1 7_4_SunRadius_0 7_4_CloudTurbidity_2
  • CloudSpeed+ / CloudSpeed-
    雲が流れるスピードの調整

Time of day.confの説明

コントローラーで調整するパラメータの多くはこのファイルで設定されています。

R = default value,G = min value for silder bar,B = max value for silder bar

設定 対応モーフ 説明
static const float3 mSunRadiusParams = float3(5000, 100000, 100); SunRadius+
SunRadius-
Sun Radius
static const float3 mSunRadianceParams = float3(10, 1.0, 20.0); SunRadiance+
SunRadiance-
Sun light power, 10.0 is normal
static const float3 mSunPhaseParams = float3(0.76, 0.65, 1.0); SunPhase+
SunPhase-
Sun concentration with its phase functions up to 0.76, 0.76 is standard
static const float3 mSunTurbidityParams = float3(100, 1e-5, 500); SunTurbidity+
SunTurbidity-
Sun turbidity
static const float3 mMiePhaseParams = float3(0.76, 0.65, 1.0); MiePhase+
MiePhase-
Mie scattering with its phase functions up to 0.76, 0.76 is standard
static const float3 mMieHeightTopParams = float3(1.2, 1e-5, 2.4); MieHeight+
MieHeight-
Mie scattering with its water particles up to 1.2km, 1.2km is standard
static const float3 mMieTurbidityParams = float3(200, 1e-5, 500); MieTurbidity+
MieTurbidity-
Mie scattering with its wave length param
static const float3 mRayleighHeightParams = float3(8.0, 1e-5, 24.0); RayleighHeight+
RayleighHeight-
Rayleigh scattering with its atmosphereic up to 8.0km, 8.0km is standard
static const float3 mRayleighScatteringCoeff = float3(5.8e-6, 13.6e-6, 33.1e-6); ―― Precomputed Rayleigh scattering coefficients for wavelength lambda
static const float3 mOzoneMassParams = float3(0.6e-6, 0.0, 0.9e-6) * 2.504; OzoneMass+
OzoneMass-
static const float3 mOzoneScatteringCoeff = float3(1.36820899679147, 3.31405330400124, 0.13601728252538); ――
static const float3 mFogRangeParams = float3(1, 1e-5, 10.0); FogRange+
FogRange-
Fog range
static const float3 mFogIntensityParams = float3(1, 0.0, 200.0); FogIntensity+
FogIntensity-
Fog intensity
static const float3 mFogDensityParams = float3(100, 0.1, 5000.0); FogDensity+
FogDensity-
Fog density
static const float3 mFogDensityFarParams = float3(1e-2, 1e-5, 1e-1); FogDensityFar+
FogDensityFar-
Fog Density Far
static const float3 mCloudSpeedParams = float3(0.05, 0.0, 1.0); CloudSpeed+
CloudSpeed-
Cloud Speed
static const float3 mCloudTurbidityParams = float3(80, 1e-5, 200.0); CloudTurbidity+
CloudTurbidity-
Cloud Turbidity
static const float3 mCloudDensityParams = float3(400, 0.0, 1600.0); Cloud+
Cloud-
Cloud Density
static const float mUnitDistance = 1000; ―― Defines the unit distance of the world up to 1000, 1000 is equal to 1km
static const float mEarthRadius = 6360; ―― Earth radius to 6360km
static const float mEarthAtmoRadius = 6420; ―― Earth radius with its atmospheric height to 6420km
static const float mEarthPeopleHeight = 1; ―― People reach of the earth to 1km
static const float3 mWaveLength = float3(680e-9, 550e-9, 450e-9); ―― standard earth lambda of 680nm, 550nm, 450nm

フォグ用fxファイル

フォグ関連のパラメータがあります。書き換えてカスタマイズすることもできます。

設定項目 Time of fog.fx Time of fog with godray.fx Time of fog with godray with cloud caster.fx 説明
FOG_DISCARD_SKY 1 フォグをスカイボックスに描画しない
0:描画する
1:描画しない(デフォルト)
※描画する場合、スカイボックスが最遠方になるので、デフォルト設定では白くなります。
FOG_WITH_GODRAY 0 1 ゴッドレイを描画する
0:描画しない
1:描画する
FOG_WITH_GODRAY_SAMPLES 48 ゴッドレイのサンプル数
数値を上げるとゴッドレイの描画が細かくなり、下げると荒くなる。
ATM_SAMPLES_NUMS 4 大気のサンプル数
上げるとフォグが濃くなったりする。
ATM_CLOUD_ENABLE 0 1 (効果確認中)
ATM_FOG_ENABLE 1 フォグを描画する
1:描画する(フォグ用の設定なので必ず 1
ATM_LIMADARKENING_ENABLE 0 (効果確認中)
FogSampleLength 0.9 ゴッドレイの長さに影響を与える。

Model : Hatsune Miku V4X Model by Digitrevx / 唄川町(うたがわまち) by シロ

⚠️ **GitHub.com Fallback** ⚠️