#author("2023-08-14T01:15:48+00:00","default:admin","admin")
#author("2023-09-20T02:57:20+00:00","default:admin","admin")
*Objects [#q1d08305]
#contents

**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

**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. Model (required)'' [#r5e05086]
- File Format: FBX7.4.0 (FBX2014) format model data (*.fbx), (created in 2.83 or later for Blender)

- 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.

- 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.)

- 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(ENスケール0.01.png)
#br
- 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
-If you are using a version of Bledner newer than 2.83 and the data exported with the above specifications is displayed 90 degrees down in Bakin, you may be able to improve the situation by checking the "Transform > Use Space Transform" checkbox on the FBX export screen.
#ref(Blender_UseSpaceTransform.png)

***''2. Texture (required)'' [#q245188b]
- File Format: BMP or PNG

- 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.

- 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.

- 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.
#br
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
#br
By specifying these settings correctly, more realistic textures can be expressed.
#br
Also, even without a mask map, the specifications controlled by the mask map can be adjusted to some extent by the material properties.
#ref(ENマテリアルプロパティ.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. 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.)

''[If a Model and Motions are in the Same File]''
- File Format: FBX format.

- The working unit of motion is 60 fps.

- 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.)

- If each motion is a separate action in Blender, they will be imported as separate motions.

- Specify the start and end frames and export the FBX file with the baking process specified.

- 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(ENループ.png)
#br

''[If a Model and Motions are Separate Files]''
- File Format: FBX format.

- The working unit of motion is 60 fps.

- 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.)

- If there are multiple motions (actions) in one motion file, they are loaded as separate motions.

- 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.

- The default setting for motion is no loop regeneration.  If you want to loop the animation, turn on the "Loop" specification on Bakin.
#ref(ENループ.png)

**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.

+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)


**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

+Open any game file, select "Resources -> Models -> reserved -> For Event Templates -> sb_obj_indoor005_Table01" and press the Copy button.
#br
#ref(ENエクスポートボタン.png)
+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)
+Exported models and textures can be modified by DCC tools such as Blender and image editing software.

(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.)

**Preparation of Folder to be Added (2): To Create a New One[#v2dd2ad1]

&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.)

***Adding Method [#z23cce4f]
+Select [Resources] -> [Models] -> [Add Button] to open the [Asset Picker] window.
#ref(EN追加ボタン.png)
#br
+Select the [Select from File] tab
#ref(ENファイルから選択.png)
#br
+Open the folder containing the model you wish to add and select the fbx file.
#br
+Check [Auto Optimization When 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.)
#br
+Press [Add and Exit].
#br
''Steps 1-5 can also be done by dragging and dropping fbx files into the model list.''
#br
If a model with the same name already exists, it will be added under an alias.
If you want to update a model that has already been added, press the "Update Information" button.
#ref(EN情報の更新.png)
#br
#br
+The dialog will appear if the fbx to be imported has "materials with existing textures in the project" or "untextured materials".
This dialog asks you to choose whether you want to assign existing materials to those materials to make them common.
It is useful to have a common material between stamps and models so that material properties can be changed at once.
#ref(./Material_ImportedMaterialsDialog.png,50%)
+If there are materials in the project that have "all the same textures" as the fbx materials to be imported, the "Material Sharing" dialog box will open.
This dialog allows you to choose whether to share the materials or not.
Materials can be reassigned in Resources > 3D Stamps even after importing.
#br
~- The following options are available for processing during import.
-- Add All New
Import all target materials as new materials without applying existing materials.
The imported materials will be added as separate materials in the Resources > Materials tree.
Select this option if you do not want to commonize materials with other stamps or models.
You can share materials with models in your project by assigning existing materials with all the same textures to imported models.
#br
-- Select Individual Materials
Select which of the existing materials in the project will be applied to each target material individually.
If there are multiple "untextured materials" in the fbx to be imported, you will have to select the number of materials to be applied.
Stamps and models to which the same material is applied will be able to adjust the material at once.
[Advantages/Disadvantages of Sharing]
--''Advantages''
---By simply adjusting one material, you can adjust all objects that share the material.
--- No more need to have useless material data.
--''Disadvantages''
---It is not possible to adjust the appearance of only one of the objects that share a material with another object.
In this case, copy the shared material at Resources > Materials.
Reassign that copied material to the object you want to adjust individually in Resources > 3D Stamps.
#br
-- Select Commonly Used Materials
Select which of the existing materials in the project will be applied to all target materials.
The selected material is applied to all target materials.
#ref(./Material_ImportedMaterialsDialog.png,80%)
#br
---What is "material with existing textures in the project"?
It is a material in which all the textures specified for the material match.
--The "Material Sharing" dialog contains the following options:
--- Automatically Assign Materials
Automatically assign materials with the same texture in the project.
If there are multiple materials with the same textures, the first material registered in the project will be assigned.
All "untextured materials" are imported as new materials.
#br
--- Add All as "New Materials"
Even if there are materials with the same textures in the project, they are all imported as new materials.
Select this if you do not want to share materials with other stamps or models.
#br
--- Manually Select Materials to Assign
For each material of the model to be imported, manually select whether to assign a material with the same textures in the project.
If there are multiple materials with the same textures, you can choose which of them to assign.
For "untextured materials," select the material to be assigned from the "untextured materials" in the project.
#br
--''What does "all textures are the same material" mean?''
It refers to a material in which all the textures specified in the material match. (This includes cases where none of the textures are specified.)
For example, if a material has textures specified for the albedo map, normal map, and mask map as shown in the figure below, all three must match.
#ref(./Material_Imported Materials_1.png,50%)	
#br
#ref(./Material_Imported Materials_1.png,50%)


***''Stamping a Model'' [#gafa3882]
Models can be stamped so they can be placed on maps.
The stamping procedure is as follows:
//Models can be stamped so they can be placed on maps.
//The stamping procedure is as follows:
The models must be "stamped" in order to place them on maps or make them usable in games.
Please visit [[What are 'Stamps'?] for more information on "Stamps".

The procedure for stamping a model is as follows:

+Select the model you want to make into a stamp.
#br
+Click the Stamp button.
#br
#ref(ENモデルのスタンプ化.png)
#br
+The stamp will be added to the "3D Stamps" list as a new stamp.
//+The stamp will be added to the "3D Stamps" list as a new stamp.
+It will be added as a new stamp to the list under Resources > [[3D Stamps]].

***''About Object Settings'' [#zb227868]
The added object has no collision detection as it is, and the player walks right through it.
Collision should be specified when a hit setting is required for the shape of the model.

There are two ways to add collisions.

-When using the simple collision setting
-When using the "Physics Settings" to prepare a dedicated collision

***''When Using the Simple Collision Setting'' [#e0d8d827]
+Select the stamp of the model for which you want to apply a collision detection and check the "Simple Collision Settings".
(The simple collision setting appears only when "Accurate Collision Setting" is turned off.)
#br
#ref(EN簡易コリジョン.png)
#br
+Under "Shape," you can select a simple collision shape such as a box or a sphere. Select a close match and adjust the position, rotation, and size while viewing the preview.
#br
#ref(Shape.png)
#br
(Models added by drag-and-drop are automatically stamped, which specifies an auto-adjusted box collision, which can be left in place if the model is a simple shape.)

***''For Shape "Mesh"'' [#faa260fe]
If Shape is selected as "Mesh," you can use your own collision model.
If there is no suitable simple shape, prepare your own collision model and specify it in this setting.

In the example below, a simple collision model is provided for the piano model to determine the collision.

+Add a piano model and a collision model for piano, respectively.
#br
#ref(./ENピアノ1.png,50%)
#ref(./ENピアノ2.png,50%)
#br
+Select "Mesh" under the Shape section.
Click on the right space of the mesh section and select the model for collision.
#br
#ref(ENピアス3.png)


***''When Using the "Physics Settings" to Prepare a Dedicated Collision'' [#l6874eba]
If you want to combine multiple collision models or have collisions linked to the movement of the model, you must create a collision setting in Physics Settings.

***''Specify Multiple Collisions'' [#y6006b62]
If multiple independent collisions are needed, such as a door and door frame, register multiple collisions in Physics Settings.
#br
#ref(EN複数のコリジョン設定.png)

+Add as many collision specs as needed in the "Collision List" by pressing the [+] Add button.
In the door example, we added a door frame and door collisions.
#br
#ref(ENコリジョンリスト.png)
#br
+Select each collision and adjust it in the "Physics Settings" section.
#br
#ref(EN物理設定.png)
#ref(ENコリジョン物理設定.png)



***''Linking Collisions to Model Movements'' [#be8a3a8e]
If you want collisions to be linked to the movement of the model, such as a doorway that opens and closes or an object that swings, use an attach node.
#br
#ref(./コリジョンをモデルの動きに連動させる1.png,50%)
#br
+Among the added collisions, select the collision you wish to link to the movement.
#br
+Under "Physics Settings -> Basic -> Attach Node," select the node you wish to attach.
The followings will appear for the attached nodes.
--The origin "_root"
--Mesh nodes existing in fbx
--If there is a skeleton structure, their skeleton nodes
#ref(コリジョンをモデルの動きに連動させる2.png)
+Specify the motion you want to check in the "Physics Settings Preview" and press the Play button to see the motion.
#br
#ref(ENコリジョンをモデルの動きに連動させる3.png)


***''Adding a Skybox Model'' [#gf759302]
The Distant Landscape Model is a model that displays the "background" such as the blue sky, night sky, cloudy sky, etc. that are displayed outside of maps.  You can specify a stamped model in [Map Settings > Rendering > Skybox Model].
#br
#ref(./EN遠景モデルの追加1.png,30%)
#ref(EN遠景モデルの追加2.png)
#br
What is needed is basically the same as regular model data.
Any model can be registered as a skybox model, but a domed hemispherical model is generally suitable.
The best way to do this is to export a standard skybox model of the default assets and then customize the data.

''1. Model (required)''
- File Format: FBX7.4.0 (FBX2014) format model data (*.fbx), (created in 2.83 or later for Blender)

- The version is FBX7.4.0 (FBX2014) only. Other versions are not supported at this time.

- 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.)

• The Bakin standard skybox model uses the scale "X:1000 , Y:350 , Z:1000" as its basic size in Blender, but you can adjust the scale according to the map size you are creating using the "Skybox Scale" property.
#br
#ref(EN遠景モデルの追加3.png)
#br
- Multiple material settings are possible for a single model.
It would be easier to specify a basic skybox model and separate materials for the sun, moon, and spatial effects.
#br
#ref(遠景モデルの追加4.png)
#ref(EN遠景モデルの追加5.png)

''2. Texture (required)''
#ref(遠景モデルの追加6.png)
- File Format: BMP or PNG format.

- The pixel size of the texture is based on the 2048x512 size for default assets, but you may adjust it to fit the skybox model you have created.

- The file name of the texture is the one specified in the model's FBX.

- Alpha channel can be specified in BMP to create transparency.
PNGs can also be rendered transparently by specifying a transparent area.

- Regarding materials and a shader, we recommend the "map_nolit" shader, since the skybox model is often not affected by light.
#br
#ref(EN遠景モデルの追加7.png)
#br
Also, "map_nolit_add" is recommended for rendering objects that you want to make glow, such as the sun.
The shaders of the ornaments should be specified according to what you want to represent.
#ref(EN遠景モデルの追加8.png)

Front page   Edit Diff History Attach Copy Rename Reload   New Page list Search Recent changes   Help   RSS of recent changes