約 4,506,170 件
https://w.atwiki.jp/railsimnewwiki/pages/379.html
テクスチャを替えるには? テクスチャを替えるのは、そんな難しい構文は必要ありません。 ある程度、定義ファイルを弄っている人なら簡単に出来るかと思います。 弄ったこともない人も、手軽に出来るので試してみて下さい。 ここでは、方向幕の変更を例として取り上げます…。 1.テクスチャを用意する これがないと、テクスチャを替える意味が無くなってしまいます。 簡単でいいので、方向幕のテクスチャを用意しましょう。 下の画像は、参考例となります。 2.材質番号を数える メタセコイヤ等で、方向幕のテクスチャが組み込まれているMQOファイルを開く。 材質パネルで、方向幕テクスチャがある材質を数えながら探す。 あくまでも、この方法は一つの例です。他にもあらゆるやり方があると思います。 ここで注意しないといけないことは「材質番号は0から数える」と言うことです。 何故かというと、RailSimは数を1からではなく0から数えているからです。 このことはスイッチの選択肢の数を数えることにも関係します。 3.スイッチを作る いよいよ、定義ファイルに触れることになります。定義ファイルはテキスト形式なのでメモ帳でも開くことは可能です。しかし、構文エラーなどのミスをしやすいので、強調表示が可能なテキストエディタをおすすめします。 その例として「MKEditor」や「TeraPad」などがあります。また、MKEditorにおいてはRailSim用の強調表示ファイルが有志の手によって公開されているので、こちらも活用する手もあります。 こちらでは、テクスチャを替えるのに必要な構文のみ解説を行います。よって、他の構文の解説は割愛させて頂きます。ご了承下さい。また、定義ファイルの解説はこちらにもありますので併せてご覧ください。 と言うことで、スイッチを作ります。しかし、スイッチだけでは何も起こらないので、動作するようにしないといけません。その点に関しては後ほど解説します。 それでは、次の構文を定義ファイルに打ち込みましょう。コピーではなく自分で打ち込むと覚えますよ。 なお、これは一例に過ぎないので、作る人によって搭載させる幕が違って当たり前です。参考程度でご覧下さい。 DefineSwitch "方向幕"{ GroupCommon = "方向幕"; Entry = "回送"; Entry = "団体"; Entry = "普通"; Entry = "RailSim新Wiki"; } さて、1つづつ解説して参ります。 DefineSwitch "方向幕"{ この一文で「方向幕と言うスイッチを作る」と宣言されます。これがあることにより、1つスイッチが作られます。 次はこれです。 GroupCommon = "方向幕"; この一文があることで、編成全体にスイッチで指定した設定を適用させることが出来ます。ですが、""の中にある名前が完全一致して時だけ適用されますのでご注意下さい。また、車両PIだけの設定になります。 先ほどのDefineSwitchと似たような感じですが、混同しないようにして下さい。全く性質が異なります。 続いてはこちらです。 Entry = "回送"; この一文があることで、「回送という選択肢を作る」と宣言されます。つまり、スイッチの選択肢が作られると言うことです。また、DefineSwitchと対になっていますのでEntryだけでは構文エラーが発生します。 最後はこちらです。 } 一見、普通の中括弧ですが、とても重要な役割を果たしています。先に紹介したDefineSwitchの最後に{と言うのがありましたよね。この中括弧で「このスイッチは終わりましたよ」を意味します。つまり、これがないとスイッチ定義が続きますのでご注意下さい。 以上が、スイッチの解説になります。いよいよ、最後の手順になります。 4.スイッチを動作できるようにする+その中にテクスチャを替える構文を入れる 見出しが長いですが、気にしないように。これが最終段階です。頑張りましょう。 それでは、次のようにしてスイッチを動作される様にします。 こちらでは、画像形式をpngとしておりますが、特にこだわる必要性はありません。ただし、仕様上gif形式は使えませんので、その点に注意して使用する形式を選んで下さい。 ApplySwitch "方向幕{ Case 0 ChangeTexture = 0,"sidkaiso.png"; Case 1 ChangeTexture = 0,"siddantai.png"; Case 2 ChangeTexture = 0,"sidfutu.png"; Case 3 ChangeTexture = 0,"sidrsnw.png"; } 先ほどと同じように、1つづつ解説して参ります。 ApplySwitch "方向幕{ この一文で「方向幕というスイッチを呼び出す」という宣言をします。つまり、これにより使用するスイッチを定義することになります。 次は、この文です。 Case n nというのは仮にn(=number。日本語訳にすると「数字」)としました。nには数字が入ります。 これで、「nのとき」という意味になります。と言うことは、使う選択肢を指定する構文になります。なお、この構文はApplySwitchがあって初めて使える構文ですので、その点はご注意下さい。 続いて、この文になります。 ChangeTexture = 0, "sidkaiso.png"; この一文で「材質番号0のテクスチャを『sidkaiso.png』というテクスチャに替える」という意味になります。つまり、この文でテクスチャを替えることが出来ます。 この構文は単独で使用することが出来ますが、一つだけ条件があります。それは、「モデルファイルを定義している構文の前には置かない」と言うことです。例えば、目的のモデル名が「Body」だとします。車体モデルは大体が「Body "body.x";」のように指定されています。 この構文の前には絶対に置かない、と言うことになります。 最後はこの記号です。 } 先ほどの項で解説しましたが、全く同じ意味を持っています。つまり、ApplySwitchを閉じる記号になります。 この後、RailSimのプラグインビュアー機能を使いデバックを行います。 これで全ての手順がおわりました。最後までお読み頂き、ありがとうございました。
https://w.atwiki.jp/eg-memo/pages/260.html
[部分編集] Yoshi Castle / lolnemsk N64 White Blue Castle / marioanddragon MrNight89x-Castle / MrNight89x N64 Bowser s Castle Wii / Buschkling Castle Hyrule / DarkyBenji Old Style Castle / masterkirbyxd Mystic Mansion / DarkyBenji
https://w.atwiki.jp/blendermemo/pages/42.html
ver2.63 texture bake関連覚え書き 1.基本的なやりかた High-Resなオブジェクト(Bake元)と、それに対応するLow-Resオブジェクト(Bake先)を用意する。 Bake元オブジェクト→Bake先オブジェクトを選び、Renderタブから Selection to Activeにチェックを入れてBake Img1-1 2."No Image to Bake To"の場合 Bake先オブジェクトのエディットモードに入ってそのままUV Image Editor内からテクスチャが選択されているかを確かめる。 Img2-1 タブキーを押して、そのまま画像ファイルがUV Image Editorに表示されていればBakeできる。 3.Bakeできたけど何か汚い場合 Bake元オブジェクトの法線と頂点の重複を確認する。エディットモードで Propertiesタブ[T] Mesh Display Normals エディットモードでW Remove Doubles Bias/Distanceのパラメータをいじる。 可能な限り個別にBakeする。Bake先オブジェクトに独立したメッシュが複数ある場合、一端 Separete(P) By loose Partsでパーツごとに分けてBakeする。 4.Mirror ModifierをBake先に設定している時、Normalの切れ目が発生する 参考 http //blenderartists.org/forum/archive/index.php/t-213018.html? 書きかけ
https://w.atwiki.jp/eg-memo/pages/224.html
[部分編集] Non Title / DaLlyod Megalo Stadium / DarkyBenji Terminal Velocity / mkwiiNinclan Prison Lane / DarkyBenji Chemical Plant / DarkyBenji Sci-Fi Factory / MrKoeikoei Lee s Christmas Toy Factory / ALPHAMARIOX
https://w.atwiki.jp/natsutan/pages/60.html
概要 名前解決スキーム用リンクリスト typedef int (Tcl_ResolveCompiledVarProc)(Tcl_Interp *interp, CONST84 char *name, int length, Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr); typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, CONST84 char *name, Tcl_Namespace *context, int flags, Tcl_Var *rPtr); typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, CONST84 char *name, Tcl_Namespace *context, int flags, Tcl_Command *rPtr); メンバー char *name; スキーム名 Tcl_ResolveCmdProc *cmdResProc; 名前解決のための手続き Tcl_ResolveVarProc *varResProc; 実行時にのみハンドルされる変数の名前解決用手続き Tcl_ResolveCompiledVarProc *compiledVarResProc; コンパイルじの名前解決の手続き struct ResolverScheme *nextPtr; 次の ResolverScheme へのポインタ ソース /* * The interpreter keeps a linked list of name resolution schemes. The scheme * for a namespace is consulted first, followed by the list of schemes in an * interpreter, followed by the default name resolution in Tcl. Schemes are * added/removed from the interpreter s list by calling Tcl_AddInterpResolver * and Tcl_RemoveInterpResolver. */ typedef struct ResolverScheme { char *name;/* Name identifying this scheme. */ Tcl_ResolveCmdProc *cmdResProc; /* Procedure handling command name * resolution. */ Tcl_ResolveVarProc *varResProc; /* Procedure handling variable name resolution * for variables that can only be handled at * runtime. */ Tcl_ResolveCompiledVarProc *compiledVarResProc; /* Procedure handling variable name resolution * at compile time. */ struct ResolverScheme *nextPtr; /* Pointer to next record in linked list. */ } ResolverScheme;
https://w.atwiki.jp/sampleisbest/pages/238.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaTexture2D 参考 Planet Earth Texture Maps Game1.cs /* * XnaTexture2D4 正距方位図法 * * プロジェクトのプロパティ * [XNA Game Studio]タブ * Use HiDef to access the complete API */ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaTexture2D { class Game1 Game { GraphicsDeviceManager graphics; SpriteBatch sprite; SpriteFont font; VertexBuffer vertexBuffer; Effect effect; BasicEffect basicEffect; Texture2D texture; VertexPositionColor[] cross; EffectParameter fxLat; EffectParameter fxLon; EffectParameter fxAxis; float lat = 35; float lon = 135; // fps int fpsSec; int fpsDraw = 0; int fpsCount = 0; public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void LoadContent() { sprite = new SpriteBatch(GraphicsDevice); font = Content.Load SpriteFont ("SpriteFont1"); texture = Content.Load Texture2D ("earthmap1k"); effect = Content.Load Effect ("Effect1"); effect.Parameters["EarthMap"].SetValue(texture); effect.Parameters["aspect"].SetValue(GraphicsDevice.Viewport.AspectRatio); fxLat = effect.Parameters["centerLatRad"]; fxLon = effect.Parameters["centerLonRad"]; fxAxis = effect.Parameters["axis"]; fxLat.SetValue(MathHelper.ToRadians(lat)); fxLon.SetValue(MathHelper.ToRadians(lon)); SetAxis(); basicEffect = new BasicEffect(GraphicsDevice); // 地図 VertexPositionTexture[] vertices = new VertexPositionTexture[4]; vertices[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); vertices[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); vertices[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); vertices[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1)); vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionTexture), 4, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); // 照準 cross = new VertexPositionColor[4]; cross[0] = new VertexPositionColor(new Vector3(-0.05f, 0, 0), Color.White); cross[1] = new VertexPositionColor(new Vector3(0.05f, 0, 0), Color.White); cross[2] = new VertexPositionColor(new Vector3(0, -0.1f, 0), Color.White); cross[3] = new VertexPositionColor(new Vector3(0, 0.1f, 0), Color.White); base.LoadContent(); } protected override void Update(GameTime gameTime) { float deltaLat = 0; float deltaLon = 0; bool modified = false; KeyboardState kState = Keyboard.GetState(); if (kState.IsKeyDown(Keys.Escape)) Exit(); if (kState.IsKeyDown(Keys.Up)) deltaLat = 1; if (kState.IsKeyDown(Keys.Down)) deltaLat = -1; if (kState.IsKeyDown(Keys.Left)) deltaLon = -1; if (kState.IsKeyDown(Keys.Right)) deltaLon = 1; if (deltaLat != 0) { lat = MathHelper.Clamp(lat + deltaLat, -89.9f, 89.9f); fxLat.SetValue(MathHelper.ToRadians(lat)); // -pi/2 - pi/2 modified = true; } if (deltaLon != 0) { lon += deltaLon; if (lon = -180) lon += 360; if (180 lon) lon -= 360; fxLon.SetValue(MathHelper.ToRadians(lon)); // -pi - pi modified = true; } if (modified) { SetAxis(); } base.Update(gameTime); } void SetAxis() { float rad = MathHelper.ToRadians(lat); float y = (float)Math.Sin(rad); float r = (float)Math.Cos(rad); rad = MathHelper.ToRadians(lon); float z = (float)Math.Cos(rad) * r; float x = (float)Math.Sin(rad) * r; Vector3 v = new Vector3(x, y, z); v.Normalize(); fxAxis.SetValue(v); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; GraphicsDevice.SetVertexBuffer(vertexBuffer); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); } foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, cross, 0, 2); } // fps fpsDraw++; if (gameTime.TotalGameTime.Seconds != fpsSec) { fpsCount = fpsDraw; fpsDraw = 0; fpsSec = gameTime.TotalGameTime.Seconds; } sprite.Begin(); string text = string.Format("fps={0} lat={1 f1} lon={2 f1}", fpsCount, lat, lon); sprite.DrawString(font, text, new Vector2(0, 0), Color.Red); sprite.End(); base.Draw(gameTime); } } } Effect1.fx // XnaTexture2D4 正距方位図法 texture EarthMap; float centerLatRad; float centerLonRad; float aspect; float3 axis; sampler TextureSampler = sampler_state { texture = EarthMap ; minfilter = linear; magfilter = linear; }; struct VertexShaderInput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; struct VertexShaderOutput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; output.Position = input.Position; output.TexCoord = input.TexCoord; return output; } float4 MulQ(float4 q1, float4 q2) { float4 q; q.x = (q1.w * q2.x) + (q1.x * q2.w) + (q1.y * q2.z) - (q1.z * q2.y); q.y = (q1.w * q2.y) + (q1.y * q2.w) + (q1.z * q2.x) - (q1.x * q2.z); q.z = (q1.w * q2.z) + (q1.z * q2.w) + (q1.x * q2.y) - (q1.y * q2.x); q.w = (q1.w * q2.w) - (q1.x * q2.x) - (q1.y * q2.y) - (q1.z * q2.z); return q; } float4 PixelShaderFunction(VertexShaderOutput input) COLOR0 { float x = input.TexCoord.x * 2.0f - 1.0f; // -1 - 1 float y = input.TexCoord.y * 2.0f - 1.0f; // -1 - 1 x *= aspect; // 距離(=回転軸からの角度)0 - 1 float dist = sqrt(x * x + y * y); if (1.0f dist) { discard; } if (abs(dist - 0.5f) 0.0015f) { return float4(1, 1, 0, 1); } // 方位角(=回転する角度)-pi - pi float angleRad = atan2(x, -y); // 回転する座標 float4 p; float rad = centerLatRad + radians(dist * 180.0f); p.y = sin(rad); float r = cos(rad); p.z = cos(centerLonRad) * r; p.x = sin(centerLonRad) * r; p.w = 0; // 回転 float4 rot; angleRad *= 0.5f; rot.xyz = axis * sin(angleRad); rot.w = cos(angleRad); float4 conj; conj.xyz = -rot.xyz; conj.w = rot.w; float4 q = MulQ(MulQ(conj, p), rot); float lat = 90.0f - degrees(asin(q.y)); float lon = 180.0f + degrees(atan2(q.x, q.z)); float eps = 0.2f / (0.2f + dist); if (lat % 10.0f eps || lon % 15.0f eps) { return float4(1, 1, 1, 1); } float2 t; t.x = lon / 360.0f; t.y = lat / 180.0f; return tex2D(TextureSampler, t); } technique Technique1 { pass Pass1 { VertexShader = compile vs_3_0 VertexShaderFunction(); PixelShader = compile ps_3_0 PixelShaderFunction(); } }
https://w.atwiki.jp/wikimm/pages/137.html
Enlisted 画質 @wiki 画質 Display settings ディスプレイの設定 解像度 Resolution モード Mode モニター Monitor NVIDIA DLSS NVIDIA DLSS NVIDIA Reflex Low Latency NVIDIA Reflex Low Latency オフ V-Sync V-Sync チェック オフ FPS上限 FPS Limit オフバー Antialiasing アンチエイリアシング 「Temporal Antialiasing Quality」 ロウ テンポラルアンチエイリアシングの質 拡張テンスチャーフィルタリング Enhanced Texture Filtering マイナスバー 時間分解能スケール Temporal Resolution Scale 100% Shadows Lighting 影 点灯 影の質 Shadow Quality ロウ 効果の影 Shadows from effects チェック オフ グローバルイルミネーションクオリティ Global Illumination Quality ロウ 大気散乱品質 Atmospheric Scattering Quality ロウ アンビエントオクルージョン品質 Ambient Occlusion Quality ロウ 反射の改善 Improved Reflections オン Details Textures 詳細 テクスチャ画質 Texture Quality ハイ High 異方性 Anisotropy オフ 水質 Water Quality ロウ Water Ripples Quality 水の波紋の質 地形テッセレーションの品質 Terrain Tessellation Quality ロウ 動的地形変動 Dynamic Terrain Deformations オフ 高解像度の視覚効果High Resolution Visual Effects チェック オフ 画面上の雨粒 Raindrops On Screen チェック オフ スコープ画質 Scope Image Quality ミディアム 中 Other settings その他の設定 非圧縮のスクリーンショット Uncompressed Screenshots チェック オン Resolution Mode Monitor Gamma correction NVIDIA DLSS Temporal Resolution Scale Temporal Antialiasing Quality NVIDIA Reflex Low Latency V-Sync FPS Limit Texture Quality Anisotropy 解決 モード モニター ガンマ補正 NVIDIA DLSS 時間分解能スケール 時間的アンチエイリアスの品質 NVIDIAReflex低遅延 V-Sync FPS制限 テクスチャ品質 異方性 Enhanced Texture Filtering Shadow Quality Shadows from effects Global Illumination Quality Atmospheric Scattering Quality Ambient Occlusion Quality Improved Reflections Water Quality Terrain Tessellation Quality Dynamic Terrain Deformations High Resolution Visual Effects 強化されたテクスチャフィルタリング 影の品質 効果からの影 グローバルイルミネーションの品質 大気散乱品質アンビエントオクルージョン品質 改善された反射 水質 地形テッセレーションの品質 動的地形変形 高解像度の視覚効果 Raindrops On Screen Scope Image Quality Uncompressed Screenshots画面上の雨滴 スコープの画質 圧縮されていないスクリーンショット 名前 コメント
https://w.atwiki.jp/sampleisbest/pages/255.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaTexture2D 参考 Planet Earth Texture Maps Game1.cs /* * XnaTexture2D5 正距方位図法+日照 * * プロジェクトのプロパティ * [XNA Game Studio]タブ * Use HiDef to access the complete API */ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaTexture2D { class Game1 Game { GraphicsDeviceManager graphics; SpriteBatch sprite; SpriteFont font; VertexBuffer vertexBuffer; Effect effect; BasicEffect basicEffect; Texture2D texture; VertexPositionColor[] cross; KeyboardState kStateOld = new KeyboardState(); EffectParameter fxLat; EffectParameter fxLon; EffectParameter fxAxis; float lat = 35; // 緯度 float lon = 135; // 経度 // fps int fpsSec = -1; int fpsDraw = 0; int fpsCount = 0; const double solarYear = 365.24219; // 太陽年(day) 365d5h48m45s const double anomalisticYear = 365.259643; // 近点年(day) 365d6h13m53.1552s const double earthRotationPerSec = (2 * Math.PI) / 86400; // 地球が1秒間に回転する角度 const double e = 0.01671022; // 離心率(Orbital eccentricity) readonly double K = Math.Sqrt((1 + e) / (1 - e)); // ケプラー方程式の定数 const double epsilon = 1.0e-14; DateTime dt = DateTime.UtcNow; int tz = 1; readonly string[] tzName = { "UTC", "JST-9" }; int cursor = 0; readonly int[] cursorPos = { 0, 5, 8, 11, 14, 15, 17 }; readonly int[] cursorLen = { 4, 2, 2, 2, 1, 1, 3 }; int repeatFrame = 0; double MJD; // 修正ユリウス日 double MJD_date; double MJD_time; double T; // 2000/1/1 12 00(UT)からのユリウス世紀(36525日) double obliquity; // 黄道傾斜角 double eclipticLon; // 黄径 public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 960; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void LoadContent() { sprite = new SpriteBatch(GraphicsDevice); font = Content.Load SpriteFont ("SpriteFont1"); texture = Content.Load Texture2D ("earthmap1k"); effect = Content.Load Effect ("Effect1"); effect.Parameters["EarthMap"].SetValue(texture); effect.Parameters["aspect"].SetValue(GraphicsDevice.Viewport.AspectRatio); effect.Parameters["revision"].SetValue( (float)Math.Sin((0.533 / 2 + (35 * 60 + 8) / 3600.0) * Math.PI / 180)); fxLat = effect.Parameters["centerLatRad"]; fxLon = effect.Parameters["centerLonRad"]; fxAxis = effect.Parameters["axis"]; fxLat.SetValue(MathHelper.ToRadians(lat)); fxLon.SetValue(MathHelper.ToRadians(lon)); SetAxis(); basicEffect = new BasicEffect(GraphicsDevice); // 地図 VertexPositionTexture[] vertices = new VertexPositionTexture[4]; vertices[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); vertices[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); vertices[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); vertices[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1)); vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionTexture), 4, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); // 照準 cross = new VertexPositionColor[4]; cross[0] = new VertexPositionColor(new Vector3(-0.05f, 0, 0), Color.White); cross[1] = new VertexPositionColor(new Vector3(0.05f, 0, 0), Color.White); cross[2] = new VertexPositionColor(new Vector3(0, -0.1f, 0), Color.White); cross[3] = new VertexPositionColor(new Vector3(0, 0.1f, 0), Color.White); CalcParameter(); base.LoadContent(); } void CalcParameter() { // 修正ユリウス日 int y = dt.Year; int m = dt.Month; int d = dt.Day; if (m 3) { y--; m += 12; } MJD_date = (int)(365.25 * y) + (y / 400) - (y / 100) + (int)(30.59 * (m - 2)) + d - 678912; MJD_time = (dt.Hour * 60 + dt.Minute) / 1440.0; MJD = MJD_date + MJD_time; // 黄道傾斜角 T = (MJD - 51544.5) / 36525; obliquity = (84381.406 - 46.836769 * T - 0.00059 * T * T + 0.001813 * T * T * T) / 3600; // 平均近点角(概算)近日点から次の近日点までの角度 double Ma = ModAngle((2 * Math.PI) * ((MJD / anomalisticYear - 0.1242853) % 1.0)); double E; double Ta; // 真近点角 KeplersEquation(Ma, out E, out Ta); // 春分点(vernal equinox)の真近点角 double MJDv = ((int)(MJD / solarYear - 0.3399541) + 0.3399541) * solarYear; double Mv = ModAngle((2 * Math.PI) * ((MJDv / anomalisticYear - 0.1242853) % 1.0)); double Tv; KeplersEquation(Mv, out E, out Tv); // 黄径(概算)春分点から次の春分点までの角度 eclipticLon = ModAngle(Ta - Tv); // 楕円効果と傾斜効果 int ellipseEffect = (int)Math.Round(Ma / earthRotationPerSec - Ta / earthRotationPerSec); int obliquityEffect = CalcObliquityEffect(obliquity, eclipticLon); int equationOfTime = ellipseEffect + obliquityEffect; // 均時差 float transit = (43200 - equationOfTime) / 86400.0f; // 南中時 // 天球上の太陽軌道の高さと半径 double solarDecl = Math.Sin(eclipticLon) * obliquity * Math.PI / 180; // 太陽の赤緯 double solarAlt = Math.Sin(solarDecl); double solarRad = Math.Cos(solarDecl); effect.Parameters["MJD_time"].SetValue((float)MJD_time); effect.Parameters["solarDecl"].SetValue((float)solarDecl); effect.Parameters["solarAlt"].SetValue((float)solarAlt); effect.Parameters["solarRad"].SetValue((float)solarRad); effect.Parameters["transit"].SetValue(transit); } double ModAngle(double angle) { while (angle = -Math.PI) angle += (2 * Math.PI); while (Math.PI angle) angle -= (2 * Math.PI); return angle; } // 傾斜効果の計算 int CalcObliquityEffect(double obliquity, double eclipticLon) { // 地球を基準とした太陽の公転 double x = Math.Cos(eclipticLon); double r = Math.Sin(eclipticLon); double y = Math.Cos(obliquity * Math.PI / 180) * r; double celestialEquator = Math.Atan2(y, x); // 天の赤道上の角度 return (int)Math.Round(eclipticLon / earthRotationPerSec - celestialEquator / earthRotationPerSec); } // 漸化式によりケプラー方程式を解く // M 平均近点角(mean anomaly) // E 離心近点角(Eccentric anomaly) // T 真近点角(true anomaly) void KeplersEquation(double M, out double E, out double T) { double E0 = M; // 初項 for (int i = 0; ; ) { i++; E = M + e * Math.Sin(E0); if ((E0 - epsilon E) (E E0 + epsilon)) { break; } if (10 = i) { Console.WriteLine(string.Format("計算打ち切り M={0} E={1}", M, E)); break; } E0 = E; } T = Math.Atan(K * Math.Tan(E / 2)) * 2; } protected override void Update(GameTime gameTime) { int delta = 0; KeyboardState kState = Keyboard.GetState(); if (kState.IsKeyDown(Keys.Escape)) Exit(); if (kState.IsKeyDown(Keys.Left) kStateOld.IsKeyUp(Keys.Left)) { cursor = (cursor + 6) % 7; } if (kState.IsKeyDown(Keys.Right) kStateOld.IsKeyUp(Keys.Right)) { cursor = (cursor + 1) % 7; } if (kState.IsKeyDown(Keys.Up)) delta = 1; if (kState.IsKeyDown(Keys.Down)) delta = -1; kStateOld = kState; if (delta == 0) { repeatFrame = 0; } else { if (--repeatFrame = 0) { switch (cursor) { case 0 dt = dt.AddYears(delta); break; case 1 dt = dt.AddMonths(delta); break; case 2 dt = dt.AddDays(delta); break; case 3 dt = dt.AddHours(delta); break; case 4 dt = dt.AddMinutes(delta * 10); break; case 5 dt = dt.AddMinutes(delta); break; case 6 tz = (tz + 1) % 2; break; } if (cursor != 6) { CalcParameter(); } repeatFrame = (repeatFrame == 0) ? 6 30; } } base.Update(gameTime); } void SetAxis() { float rad = MathHelper.ToRadians(lat); float y = (float)Math.Sin(rad); float r = (float)Math.Cos(rad); rad = MathHelper.ToRadians(lon); float z = (float)Math.Cos(rad) * r; float x = (float)Math.Sin(rad) * r; Vector3 v = new Vector3(x, y, z); v.Normalize(); fxAxis.SetValue(v); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; GraphicsDevice.SetVertexBuffer(vertexBuffer); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); } foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, cross, 0, 2); } // fps fpsDraw++; if (gameTime.TotalGameTime.Seconds != fpsSec) { fpsCount = fpsDraw; fpsDraw = 0; fpsSec = gameTime.TotalGameTime.Seconds; } sprite.Begin(); string text = new string( , cursorPos[cursor]) + new string( _ , cursorLen[cursor]); sprite.DrawString(font, text, new Vector2(0, 0), Color.White); text = string.Format("{0} {1}", dt.AddHours(tz * 9).ToString("yyyy/MM/dd HH mm"), tzName[tz]); sprite.DrawString(font, text, new Vector2(0, 0), Color.White); text = string.Format("fps={0} lat={1 f1} lon={2 f1}", fpsCount, lat, lon); sprite.DrawString(font, text, new Vector2(0, 20), Color.White); sprite.End(); base.Draw(gameTime); } } } Effect1.fx // XnaTexture2D5 正距方位図法+日照 texture EarthMap; float centerLatRad; float centerLonRad; float aspect; float3 axis; float MJD_time; // 修正ユリウス日の時刻 float solarDecl; // 太陽の赤緯 float solarAlt; // 天球上の太陽軌道の高さ float solarRad; // 天球上の太陽軌道の半径 float transit; // 南中時 float revision; // 太陽の視角(0.533deg)と大気差(35m8s)による昼の長さの補正 sampler TextureSampler = sampler_state { texture = EarthMap ; mipfilter = linear; minfilter = linear; magfilter = linear; }; struct VertexShaderInput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; struct VertexShaderOutput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; output.Position = input.Position; output.TexCoord = input.TexCoord; return output; } float4 MulQ(float4 q1, float4 q2) { float4 q; q.x = (q1.w * q2.x) + (q1.x * q2.w) + (q1.y * q2.z) - (q1.z * q2.y); q.y = (q1.w * q2.y) + (q1.y * q2.w) + (q1.z * q2.x) - (q1.x * q2.z); q.z = (q1.w * q2.z) + (q1.z * q2.w) + (q1.x * q2.y) - (q1.y * q2.x); q.w = (q1.w * q2.w) - (q1.x * q2.x) - (q1.y * q2.y) - (q1.z * q2.z); return q; } float4 PixelShaderFunction(VertexShaderOutput input) COLOR0 { float x = input.TexCoord.x * 2 - 1; // -1 - 1 float y = input.TexCoord.y * 2 - 1; // -1 - 1 x *= aspect; // 距離(=回転軸からの角度)0 - 1 float dist = sqrt(x * x + y * y); if (1 dist) { discard; } // 方位角(=回転する角度)-pi - pi float angleRad = atan2(x, -y); // 回転する座標 float4 p; float rad = centerLatRad + radians(dist * 180); p.y = sin(rad); float r = cos(rad); p.z = cos(centerLonRad) * r; p.x = sin(centerLonRad) * r; p.w = 0; // 回転 float4 rot; angleRad *= 0.5; rot.xyz = axis * sin(angleRad); rot.w = cos(angleRad); float4 conj; conj.xyz = -rot.xyz; conj.w = rot.w; float4 q = MulQ(MulQ(conj, p), rot); // 緯度、経度 float latRad = asin(q.y); float lonDeg = degrees(atan2(q.x, q.z)); // ローカル時刻 float localtime = MJD_time + lonDeg / 360; localtime = frac(localtime); // テクスチャサンプリング float2 t; t.x = (180 + lonDeg) / 360; t.y = (90 - degrees(latRad)) / 180; float4 output = tex2D(TextureSampler, t); // 天球上の太陽軌道と地平面の交点=日出・日没 float ra = sin(latRad) * revision; float rx = cos(latRad) * revision; float cosx = ((solarAlt + ra) * -tan(latRad) - rx) / solarRad; if (cosx = -1) // 白夜 { return output; } if (1 = cosx) // 極夜 { output.rgb *= 0.5; return output; } float halfDaytime = degrees(acos(cosx)) / 360; // 日出・日没時刻(南中時-半分の昼の長さ) float rising = transit - halfDaytime; float setting = transit + halfDaytime; if (localtime = rising || setting = localtime) { output.rgb *= 0.5; } return output; } technique Technique1 { pass Pass1 { VertexShader = compile vs_3_0 VertexShaderFunction(); PixelShader = compile ps_3_0 PixelShaderFunction(); } }
https://w.atwiki.jp/eg-memo/pages/246.html
[部分編集] N64 Sherbet Hell / Enryx13ftw Space Ice Land / MrMario NFS Hot Pursuit / mircojanisch Stone Path / Omegasis Emissaire Subspatial / DarkyBenji Dark UnderWorld / masterkirbyxd Sherbet Volcano / DarkyBenji
https://w.atwiki.jp/athena_memo/pages/16.html
./data/texture/effect/内詳細 pikapika2.bmp通常、Lv99以上でPCやMOB、ホムンクルスなどに発生するエフェクトの足元部分のデータ。周りを回っているエフェクトに関しては所在不明w ./data/texture/