1 / 11

3D 散歩ゲーム

3D 散歩ゲーム. 08A2043 谷口盛海. 研究動機. 近年、 MMD の普及で沢山の MMD 用 3D モデルが 配布さ れる様になった。この MMD 用 3D モデルを 利用して何かを 作ってみたいと 思った。. MMD. MikuMikuDance (ミクミクダンス)とは、プリセットされたキャラクターの 3D モデルを操作しコンピュータアニメーションを作成する 3DCG ソフトウェアである 。. PMD. ・ MMD で使われる独自形式の モデルデータファイル( . pmd ) ・ MMD ver1 ~ 2 では DirectX の形状データなどを

shada
Télécharger la présentation

3D 散歩ゲーム

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 3D散歩ゲーム 08A2043 谷口盛海

  2. 研究動機 近年、MMDの普及で沢山のMMD用3Dモデルが 配布される様になった。このMMD用3Dモデルを 利用して何かを作ってみたいと思った。

  3. MMD • MikuMikuDance(ミクミクダンス)とは、プリセットされたキャラクターの3Dモデルを操作しコンピュータアニメーションを作成する3DCGソフトウェアである。

  4. PMD ・MMDで使われる独自形式の モデルデータファイル(.pmd) ・MMD ver1~2ではDirectXの形状データなどを 格納するXファイル(.x)をベースに拡張した(.xx)が 使われていたがVer3では(.xx)をさらに拡張した (.pmd)が使われるようになった

  5. DirectX • Microsoft DirectX(ダイレクトエックス)は、マイクロソフト社が開発したゲームおよびマルチメディア処理用のAPIの集合である。(研究では9.0を使用) Windows API • Windows API(ウィンドウズ エーピーアイ)とは、Microsoft WindowsのAPIのことである。特に32ビットプロセッサで動作するWindows 95以降やWindows NTで利用できるものはWin32 APIと呼ばれる。また、それらのWindowsにおけるWin32 APIの実装をWin32と呼ぶ。

  6. ウィンドウの作成 DirectX Graphicsインターフェイスを取得 デバイスの作成・設定 BeginScene() 画面の描画 ループ EndScene() インターフェイスの開放

  7. 実行画面

  8. MMDモデルの読み込み PMDファイル ifstream ifs(filename, ios::binary); if (ifs.fail()) throw TEXT("ファイルがありません"); ifs.read((char*)&pmdHeader, sizeof(pmdHeader)); unsigned long numPmdVertex; ifs.read((char*)&numPmdVertex, sizeof(numPmdVertex)); PmdVertex* pmdVertices = new PmdVertex[numPmdVertex]; ifs.read((char*)pmdVertices, sizeof(PmdVertex)*numPmdVertex); unsigned long numPmdFace; ifs.read((char*)&numPmdFace, sizeof(numPmdFace)); unsigned short *pmdFaces = new unsigned short[numPmdFace]; ifs.read((char*)pmdFaces, sizeof(unsigned short)*numPmdFace); unsigned long numPmdMaterial; ifs.read((char*)&numPmdMaterial, sizeof(numPmdMaterial)); PmdMaterial* pmdMaterial = new PmdMaterial[numPmdMaterial]; ifs.read((char*)pmdMaterial, sizeof(PmdMaterial)*numPmdMaterial); PMDデータ コピー MeshData MeshDatameshData; for (unsigned inti = 0; i < numPmdVertex; ++i) { Vertex v; v.position = D3DXVECTOR3(pmdVertices[i].pos[0], pmdVertices[i].pos[1], pmdVertices[i].pos[2]); v.position *= 0.1f; // 倍率 v.normal= D3DXVECTOR3(pmdVertices[i].normal_vec[0], pmdVertices[i].normal_vec[1], pmdVertices[i].normal_vec[2]); v.texture = D3DXVECTOR2(pmdVertices[i].uv[0], pmdVertices[i].uv[1]); meshData.vertices.push_back(v); } delete pmdVertices; Face f; for (unsigned inti = 0; i < numPmdFace; ++i) { f.indices[i%3] = pmdFaces[i]; if (i%3 == 2) meshData.faces.push_back(f); } delete pmdFaces; D3DMATERIAL9 material = {0}; unsigned int j = 0, material_end = 0; for (unsigned inti = 0; i < numPmdMaterial; ++i) { CopyMaterial(material, pmdMaterial[i]); meshData.material.push_back(material); char tex[21] = {0}; // ファイル名が20byteのときのために最後に0を追加 memcpy(tex, pmdMaterial[i].texture_file_name, 20); string s(tex); s = s.substr(0, s.find("*")); // temp meshData.texture_filename.push_back(s); material_end += pmdMaterial[i].face_vert_count; for (; j < material_end; ++j) meshData.faces[j/3].material_number = i; } delete pmdMaterial;

  9. 実行画面

  10. 今後の予定 • 衝突判定機能 • キーボード操作による移動・モーション • 環境音

  11. 参考文献・リンク • DirectX9 シェーダプログラミングブック • 3次元コンピュータグラフィックス • 私設研究所ネオテックラボ http://www.neo-tech-lab.co.uk/ • DirectX Class http://princess-tiara.biz/directx/ • PICの罠 http://www2.ocn.ne.jp/~mhage/PIC_Trap/

More Related