#author("2022-10-12T03:28:14+00:00","default:admin","admin")
*物体 [#q1d08305]
#author("2022-10-16T03:22:29+00:00","default:admin","admin")
*Objects [#q1d08305]
#contents

**物体および遠景 [#mfab5af7]
建物やモニュメントなど、マップに設置する物体の追加⽅法です。
まず追加する前に、モデル、テクスチャ、モーションなど必要となるすべてのデータを、
ひとつのフォルダにまとめておきましょう。
**Objects and Skyboxes [#mfab5af7]
The method of adding buildings, monuments, and other objects to be placed on maps.
First, before adding, put all the data required, including a model, textures, motions, etc., into a single folder.
#ref(物体.png)
#br

**■追加できるファイルの形式 [#i89efb9b]
ひとつの物体は、モデル・テクスチャ・モーションの3ファイルから成り⽴っています。
これらの作成には3Dグラフィックスの専⾨知識や所定のソフトウェアが必要です。
**File Format to be Added [#i89efb9b]
An object consists of three files: model, textures, and motions.
Creation of these requires specific knowledge of 3D graphics and prescribed software.

***''1.モデル(必須)'' [#r5e05086]
• ファイル形式:Blender2.83以降で作成した、FBX7.4.0(FBX2014)形式モデルデータ(*.fbx)
***''1. Model (required)'' [#r5e05086]
- File Format: FBX7.4.0 (FBX2014) format model data (*.fbx) created with Blender 2.83 or later

• バージョンは FBX7.4.0(FBX2014)のみです。現在のところそれ以外には対応していません。
- The version is FBX7.4.0 (FBX2014) only. Other versions are not supported at this time.

• ポリゴン数の制限は設けていません。
- There is no limit to the number of polygons.

• ポリゴンメッシュは三⾓ポリゴンにする必要があります。三⾓ポリゴン以外は正しく表⽰されません。
あらかじめ三⾓ポリゴン化を⾏うか、BAKIN へモデル追加の際に最適化オプション設定を有効にして下さい。
(最適化オプションを有効にすると、⾃動的に三⾓ポリゴン化が⾏われます。)
- The polygonal mesh must be triangulated. The display will not be correct if they are not triangular polygons.  Perform triangulating polygons in advance or specify the optimization option when adding models to Bakin.  (If the optimization option is enabled, automatic triangular polygonization is performed.)

• スケールについては仕様上、BAKIN上の1グリッドのサイズ=blenderの標準グリッドサイズの1/100となるため、
モデルエクスポート時にスケール「0.01」として出力してください。
- For the scale, the size of one grid on Bakin = 1/100 of Blender's standard grid size due to specifications, so please export models with a scale of "0.01".
#ref(スケール0.01.png)
#br
• 1つのモデルに対し、複数のマテリアル設定が可能です。
• ノーマルマップテクスチャを使用するモデルの場合、fbxエクスポート設定で「タンジェント空間」のチェックを入れてください。
- Multiple material settings are possible for a single model.
- For models that use normal map textures, check the "Tangent Space" checkbox in the fbx export specification.
#br
***''2.テクスチャ(必須)'' [#q245188b]
• ファイル形式:BMP 形式 または PNG 形式
• テクスチャのピクセルサイズは、
64×64、128×128、256×256、512×512 などの2のべき乗と呼ばれる数値を推奨します。
256×128 なども使⽤可能です。
2のべき乗以外のサイズのテクスチャを設定すると表⽰に不具合が起る事があります。
***''2. Texture (required)'' [#q245188b]
- File Format: BMP or PNG

• テクスチャのファイル名は、モデルの FBX 内で指定されているものと同じにしてください。
同じ場合、モデル読み込み時自動でテクスチャが設定されますが、異なっている場合は自分で設定する必要があります。
- The recommended pixel size for textures is a value called a power of 2, such as 64 x 64, 128 x 128, 256 x 256, or 512 x 512.  256 x 128, etc. can also be used.  Specifying a texture with a size other than a power of 2 may cause problems with the display.

• BMP にアルファチャンネルの設定することで、透過表現が可能です。
また、PNG についても透明部分を設定することで、透過表現が可能です。
- The file name of the texture should be the same as the one specified in the model's FBX.  If the names are the same, the textures are automatically specified when the model is imported, but if they are different, you must specify the textures yourself.

•BAKINでは PBR ( Physical Based Rendering )を採用することにより、よりリアルな質感表現が可能です。
PBR表現を使用する場合、1つのモデルに対し、用途に合わせてテクスチャを3枚設定する事を推奨します。
アルベドマップテクスチャ:モデルの色を設定するテクスチャ
ノーマルマップテクスチャ:モデル表面の凹凸を設定するテクスチャ
マスクマップテクスチャ:RGBA各チャンネルにそれぞれ、R(発光)、G(ラフネス)、B(金属)、A(スペキュラ強度)を設定するテクスチャ
これらを正しく設定することで、よりリアルな質感表現が可能です。
- Alpha channel can be specified in BMP to create transparency.  PNGs can also be rendered transparently by specifying transparent areas.

また、マスクマップがなくても、
マスクマップで制御される設定はマテリアルプロパティにより、ある程度調整が可能です。
-Bakin uses PBR (Physical Based Rendering) to achieve more realistic textures.  When using PBR rendering, it is recommended that three textures be specified for each model, depending on the purpose of use.

Albedo Map Texture: Texture that specifies the color of the model
Normal Map Texture: Texture that specifies the surface roughness of the model
Mask Map Texture: Texture that specifies R (luminance), G (roughness), B (metal), and A (specular intensity) for each RGBA channel, respectively

By specifying these settings correctly, more realistic textures can be expressed.

Also, even without a mask map, the specifications controlled by the mask map can be adjusted to some extent by the material properties.
#ref(マテリアルプロパティ.png)
#br
• ファイル名は、半⾓英数字で設定して下さい。
• テクスチャファイルの例
- The file names should be specified in half-width alphanumeric letters.

アルベドマップ テクスチャ
-Example of Texture Files
#br
Albedo Map Texture
#ref(アルベドマップ.png)
ノーマルマップ テクスチャ
Normal Map Texture
#ref(ノーマルマップテクスチャ.png)
マスクマップ テクスチャ
Mask Map Texture
#ref(マスクマップテクスチャ.png)
#br

***''3.モーションファイル(.fbx)'' [#s38313ab]
モーションがある場合はモーションデータを用意します。
モーションデータの持ち方は、モデルファイルにそのまま設定する方法と、
モデルとモーション別個のファイルとする方法の2つがあります。
(別個とする場合、モーションファイル FBX の対応バージョンはモデルファイルと同じ仕様です。)
***''3. Motion Files (.fbx)'' [#s38313ab]
If there are motions, prepare the motion data.  There are two ways of handling motion data: one is to specify the motion data as it is in the model file, and the other is to use separate files for the model and the motions.  (If separate, the supported version of the motion files FBX are the same specifications as the model files.)

''【モデルとモーションが同一ファイルの場合】''
. ファイル形式: FBX 形式。
''[If a Model and Motions are in the Same File]''
- File Format: FBX format.

• モーションの作業単位は、60fps となります。
- The working unit of motion is 60 fps.

• 使用可能なボーン数についてはモデル一体に対して、OpenGLの仕様上可能な数「最低341~最大1365」となります。(ドライバ性能に依存します。)
- The number of bones that can be used is the minimum of 341 and the maximum of 1365 for a single model, according to OpenGL specifications. (The number of bones is dependent on the performance of the driver.)

• blenderで各モーションを別個のアクションとした場合、それぞれ別のモーションとして読み込まれます。
- If each motion is a separate action in Blender, they will be imported as separate motions.

• 開始フレームと終了フレームを指定し、ベイク処理を設定して FBX ファイルを出⼒してください。
- Specify the start and end frames and export the FBX file with the baking process specified.

• モーションはループ再⽣なしが初期設定となっています。
ループ再⽣させたい場合は、モーションプロパティで該当モーションの「ループ」設定をONにしてください。
- The default setting for motion is no loop regeneration.  If you wish to loop the animation, turn on the "Loop" specification for the motion in the motion properties.
#ref(ループ.png)
#br

''【モデルとモーションが別個のファイルの場合】''
. ファイル形式: FBX 形式。
''[If a Model and Motions are Separate Files]''
- File Format: FBX format.

• モーションの作業単位は、60fps となります。
- The working unit of motion is 60 fps.

• 使用可能なボーン数についてはモデル一体に対して、OpenGLの仕様上可能な数「最低341~最大1365」となります。(ドライバ性能に依存します。)
- The number of bones that can be used is the minimum of 341 and the maximum of 1365 for a single model, according to OpenGL specifications. (The number of bones is dependent on the performance of the driver.)

• blenderで各モーションを別個のアクションとした場合、それぞれ別のモーションとして読み込まれます。
- If there are multiple motions (actions) in one motion file, they are loaded as separate motions.

• 出⼒したいモーションの開始フレームと終了フレームを指定し、ベイク処理を設定して FBX ファイルを出⼒してください。
- Specify the start and end frames and export the FBX file with the baking process specified.

• モーションファイルのポリゴンメッシュは削除して下さい。
- Delete the polygon mesh in the motion files.

• スケルトンがある場合、構造及び名称はモデルファイルのスケルトンと同⼀にして下さい。
- If there is a skeleton, the structure and name should be the same as the skeleton in the model file.

• モーションはループ再⽣なしが初期設定となっています。
ループ再⽣させたい場合は、モーションプロパティで該当モーションの「ループ」設定をONにしてください。
- The default setting for motion is no loop regeneration.  If you want to loop the animation, turn on the "Loop" specification on Bakin.
#ref(ループ.png)

**モデル追加時の下準備 [#ydf60d6e]
モデルを追加する場合、2つの方法があります。
1つは、BAKINの内蔵データを流用する方法、
2つめは、自分で新規にデータを用意する方法です。
それぞれの手順について説明します。
**Preparation for Adding a Model [#ydf60d6e]
There are two ways to add a model.
One is to divert Bakin's built-in data, and the second is to prepare new data yourself.
Each procedure is described below.

①追加したい素材のファイルを⼊れるフォルダを⽤意します。
このフォルダは追加の際に⼀時的に使⽤するだけです。ファイルの場所やフォルダ名は問いません。
追加したモデルは、ゲームファイルフォルダ内のresフォルダ下へ追加されます。

②⽤意したフォルダの直下にモデルファイル(.fbx)とテクスチャファイル(.bmpまたは.png)を⼊れます。
例:[Table]フォルダに、追加したい素材(Table)を⼊れた場合
+Prepare a folder for the assets you wish to add.
This folder is only used temporarily for addition. Any file location or folder name is acceptable.
The added model will be added under the res folder in the game file folder.
#br
+Put a model file (.fbx) and textures file (.bmp or .png) directly under the folder you have prepared.
Example: If you put an asset (Table) you want to add in the [Table] folder
#ref(Table.png)


**追加するフォルダーの準備(1)システム素材を書き出す場合 [#r852ea53]
標準のシステム素材モデルは外部のフォルダーに書き出して、
CG ソフトを使ってカスタマイズすることができます。⼿順は以下の通りです。
**Preparation of Folder to be Added (1): When exporting system assets [#r852ea53]
The default system asset models can be exported to an external folder and customized using CG software. The procedure is as follows

①任意のゲームファイルを開き、
「リソース管理>モデル>reserved>イベント用モデル>sb_obj_indoor005_Table01」を選択し、コピーボタンを押します。
#ref(任意のゲームファイル.png)
②そのまま、ペーストボタンを押します。
#ref(ペーストボタン.png)
③ダイアログが表示されるので「別IDで追加」を選択します。
#ref(別IDで追加.png)
④ペーストされたテーブルモデルを選択し、エクスポートボタンを押します。
+Open any game file, select "Resources -> Models -> reserved -> For Event Templates -> sb_obj_indoor005_Table01" and press the Copy button.
#br
#ref(エクスポートボタン.png)
⑤任意のフォルダを選択し、エクスポートします。

⑥エクスポートされたフォルダーの中に、選択した物体フォルダーが作られ、
その中に FBX ファイル、テクスチャ ファイル、defファイル ( マテリアル情報 等 ) が書き出されます。
+Select any folder to export.
#br
+In the exported folder, the selected object folder is created and the FBX file, texture files, and def files (material information, etc.) are exported to it.
#ref(FBXファイル.png)
⑦書き出されたモデルやテクスチャは、blenderなどのDCCツール、画像編集ソフトによって描き替えることが可能です。
+Exported models and textures can be modified by DCC tools such as Blender and image editing software.

※ 編集の際、テクスチャのファイル名を変更すると、テクスチャの自動読み込みがされなくなるのでご注意ください。
変更する場合は、BAKIN側でテクスチャ指定を再設定するか、defファイルを開きテクスチャ名の記述を変更してください。
(Note that if you change the file name of a texture during editing, the texture will not be loaded automatically.  To change, either re-specify the texture specification on the Bakin side or open the def file and change the description of the texture name.)

**■追加するフォルダーの準備(2)新規に作成する場合 [#v2dd2ad1]
**Preparation of Folder to be Added (2): To Create a New One[#v2dd2ad1]

&size(16){''モデル追加時の下準備''};
①追加したい素材ファイルを⼊れるフォルダーを、任意の場所に作成します。(フォルダ名や場所は問いません)
このフォルダーはデータ追加後、更新用フォルダとして参照先に設定されます。
※BAKINにデータを追加したあとは、こちらのフォルダ内のデータを更新することで、BAKIN内の該当データも更新されます。
追加したモデルは、ゲームファイルフォルダ内のresフォルダ下へ追加されます。

②⽤意したフォルダの直下にモデルファイル(.fbx)とテクスチャファイル(.bmpまたは.png)を⼊れます。
例:[Table]フォルダに、追加したい素材(Table)を⼊れた場合
&size(16){''Preparation for Adding a Model''};
+Create a folder in any location where you would like to put the assets you would like to add. (Any folder name and location is acceptable.)  This folder will be specified as the destination folder for updates after data is added.  
(After adding data to Bakin, updating the data in this folder will also update the corresponding data in Bakin.  The added model will be added under the res folder in the game file folder.)
#br
+Put a model file (.fbx) and textures file (.bmp or .png) directly under the folder you have prepared.
Example: If you put an asset (Table) you want to add in the [Table] folder
#ref(Table.png)
新しく物体を追加するには、準備として追加したいモデルの名前が付けたフォルダーを任意の場所に作成し、
その中に追加するすべてのモデル、テクスチャ を⼊れておいてください。
#br
To add a new object, create a folder with the name of the model you wish to add in any location, and put all the models and textures to be added in the folder.
#br
+Place all files directly in the folder you have prepared.
#br
+Textures are automatically searched for and imported based on their names in the FBX file.
The search will be performed either in the same folder as the FBX or in the "texture" folder within the FBX.
(If there are motion files separate from the model, add them as separate models and specify motion and stamp settings separately.)

1. すべてのファイルを、⽤意したフォルダー直下に配置します。

2. テクスチャは、FBX ファイル内の名前をもとに⾃動的に検索されて取り込まれます。
FBX と同じフォルダー内か、その中の「texture」フォルダー内が検索対象になります。

※ モデルとは別にモーションファイルがある場合は、別モデルとして追加し、モーション設定とスタンプ設定を別途行います。

***■追加⽅法 [#z23cce4f]
1. 【リソースメニュー】>【モデル】>【追加 ボタン】を選択、【Asset Picker】ウィンドウを開きます。
***Adding Method [#z23cce4f]
+Select [Resources] -> [Models] -> [Add Button] to open the [Asset Picker] window.
#ref(追加ボタン.png)
2. 【ファイルから選択】タブを選択します
#br
+Select the [Select from File] tab
#ref(ファイルから選択.png)
3. 追加したいモデルの入ったフォルダを開き、fbxファイルを選択します。
#br
+Open the folder containing the model you wish to add and select the fbx file.
#br
+Check [Auto Optimization Shen Importing FBX File] if necessary.
Optimization automatically performs the following processes:
---Skin weight normalization
---Polygon triangulation
---Apply scale (scale option next to the optimization checkbox)
---For FBX formats earlier than FBX7.4, conversion to FBX7.4
(If the model file was not imported correctly, uncheck the box.

4. 必要に合わせて【FBXファイルのインポート時、自動で最適化を行う】をチェックします。
最適化は以下の処理を自動で行います。
・スキンウェイトの正規化
・ポリゴンの三角化
・スケールの適用(最適化チェックボックスの横にあるスケールオプション)
・FBX7.4より以前のFBXフォーマットの場合、FBX7.4への変換
※もしモデルファイルが正しく取り込めなかった場合は、チェックを外してください。

5.【追加して終了】を押します。

''★1~5の手順は、モデル リストにfbxファイルをドラッグ&ドロップすることでも可能です。''

※すでに同じ名前のモデルがあった場合は、別名で追加されます。
すでに追加済みのモデルを更新したい場合は「情報の更新」ボタンを押してください。
#ref(情報の更新.png)

''モデルのスタンプ化''
モデルはスタンプにすることで、マップに配置できるようになります。
スタンプ化の手順は以下の通りです。

1. スタンプにしたいモデルを選択します。

2. スタンプボタンをクリックします。
#ref(モデルのスタンプ化.png)
3. 「3Dスタンプ」リストに新規スタンプとして追加されます。

''物体設定について''
追加した物体には、そのままでは当たり判定がなく、プレイヤーがすり抜けてしまいます。
モデルの形に応じた当たり設定が必要なときは、コリジョンを設定する必要があります。

コリジョンの追加方法は2種類あります。

・簡易コリジョン設定を使用する場合
・「物理設定」タブで専用コリジョンを用意して使用する場合
''・簡易コリジョン設定を使用する場合''
1. 物理設定をつけたいモデルのスタンプを選択し、「簡易コリジョン設定」を確認します。
(簡易コリジョン設定は「正確なコリジョン設定」がオフの場合にのみ表示されます。)
#ref(簡易コリジョン.png)
2. 「Shape」でボックスや球など、シンプルなコリジョン形状が選択できるので、近い形のものを選択し、
プレビューを見ながら位置・回転・サイズを調整します。
#ref(Shape.png)
※ドラッグアンドドロップで追加されたモデルは、自動でスタンプ化されますが、
その際、自動調整されたBoxコリジョンが設定されるので、シンプルな形状の場合はそのままでOKです。

''Shape「Mesh」の場合''
Shapeを「Mesh」にすると、自分で用意したコリジョンモデルを使用できます。
シンプルな形状で適したものが無い場合は、自分でコリジョンモデルを用意し、この設定で指定してください。

下の例では、ピアノモデルに対して、当たり判定用のシンプルなコリジョンモデルを用意した場合です。

1. ピアノモデルとピアノ用コリジョンモデルをそれぞれ追加します。
#ref(./ピアノ1.png,50%)
#ref(./ピアノ2.png,50%)
2. 「スタンプ」タブに移動し、Shape項目で「Mesh」を選択。
メッシュ項目の右スペースをクリックし、コリジョン用モデルを選択します。
#ref(ピアノ3.png)
''・物理設定タブで専用コリジョンを用意して使用する場合''
複数のコリジョンモデルを組み合わせたり、コリジョンをモデルの動きに連動させたい場合は、
物理設定タブでコリジョン設定を作成する必要があります。

''複数のコリジョンを設定する''
ドアとドア枠のような、独立した複数のコリジョンが必要な場合は、
物理設定で複数のコリジョンを登録します。
#ref(複数のコリジョン設定.png)
1. 「コリジョンリスト」で必要な数だけ[+]追加ボタンを押し、コリジョン設定を追加します。
ドアの例では、ドア枠とドアのコリジョンを追加しました。
#ref(コリジョンリスト.png)
2. それぞれのコリジョン選択し、「物理設定の設定」で調整していきます。
#ref(物理設定.png)
#br
''コリジョンをモデルの動きに連動させる''
開閉するドア扉や、揺れる物体など、
コリジョンをモデルの動きに合わせて連動させたい場合は
アタッチノードを使います。
#ref(./コリジョンをモデルの動きに連動させる1.png,50%)
1. 追加したコリジョンの中で、動きに連動させたいコリジョンを選択します。

2. 「物理設定の設定>基本>アタッチノード」で、アタッチしたいノードを選択します。
アタッチノードは
・原点にあたる「_root」
・fbx内に存在するメッシュノード
・スケルトン構造がある場合は、それらのスケルトンノード
が表示されます。
#ref(コリジョンをモデルの動きに連動させる2.png)
3. 「物理設定のプレビュー」で確認したいモーションを指定し、
再生ボタンを押すと動きを確認できます。
#ref(コリジョンをモデルの動きに連動させる3.png)


''遠景モデルの追加''
遠景モデルはマップの外側に表⽰される⻘空、夜空、曇天といった“背景”を表⽰するモデルで、
【レンダリング設定 > 遠景モデル】でスタンプ化したモデルを指定することができます。
#ref(./遠景モデルの追加1.png,30%)
#ref(遠景モデルの追加2.png)
必要となるものは、基本的には通常のモデルデータと同じです。
どのモデルでも遠景モデルとして登録可能ですが、一般的にはドーム状の半球モデルが適しています。
標準素材の遠景モデルをエクスポートして、データをカスタマイズする⽅法がベストです。

''1. モデル(必須)''
• ファイル形式:Blender2.83以降で作成した、FBX7.4.0(FBX2014)形式モデルデータ(*.fbx)

• バージョンは FBX7.4.0(FBX2014)のみです。現在のところそれ以外には対応していません。

• 三⾓ポリゴン以外は正しく表⽰されません。
予め三⾓ポリゴン化を⾏うか、BAKIN へモデル追加の際に最適化オプション設定を有効にして下さい。
(※最適化オプションを有効にすると⾃動的に三⾓ポリゴン化が⾏われます。)

• BAKIN 標準の遠景モデルは、Blender上でのスケール「X:1000 , Y:350 , Z:1000」を基本サイズとしていますが、
「遠景スケール」プロパティで、自分の作成中のマップサイズに応じてスケール調整をしてください。
#ref(遠景モデルの追加3.png)
• 1つのモデルに対し、複数のマテリアル設定が可能です。
基本の遠景モデルと、太陽や月、空間演出用のマテリアルを分けておくと
設定がしやすいかと思います。
#ref(遠景モデルの追加4.png)
#ref(遠景モデルの追加5.png)

''2. テクスチャ(必須)''
#ref(遠景モデルの追加6.png)
• ファイル形式:BMP 形式 または PNG 形式。

• テクスチャのピクセルサイズは、標準素材では2048x512サイズを基本としていますが、
自分の作成した遠景モデルに合わせて調整してください。

• テクスチャのファイル名は、モデルの FBX 内で指定されているものです。

• BMP にアルファチャンネルの設定することで、透過表現が可能です。
また、PNG についても透明部分を設定することで、透過表現が可能です。

•マテリアル、シェーダーについては、遠景モデルは光の影響を受けないようにする場合が多いため、
「map_nolit」シェーダーを推薦します。
#ref(遠景モデルの追加7.png)
また、太陽などの光らせたい描画物に対しては「map_nolit_add」がおすすめです。
装飾物のシェーダーは表現したいものに合わせて設定してください。
#ref(遠景モデルの追加8.png)


Front page   New Page list Search Recent changes   Help   RSS of recent changes