GoPinball.com
http://gopinball.com/forum/

BAM Custom Models.
http://gopinball.com/forum/viewtopic.php?f=86&t=6402
Page 1 of 1

Author:  ravarcade [ Sat Apr 08, 2017 11:07 am ]
Post subject:  BAM Custom Models.

In BAM since version v.1.4-162.

Introduction.
--------------------
BAM can display on table own 3D models. That models are not part of FP table.
3D model should be in one dir with textures used by model.
Few 3D formats are supported.

ModelImporter.
----------------------
In BAM dir you will find simple tool: ModelImporter.exe. Run it. Look at panel on right.
1. From combobox select draw method:
- BAM_diffuse_normal - for models without animation. They may use normal maps, but don't have to.
- BAM_anim_diffuse_normal - as above but for models with animation.
- BAM_hero - for models from DOTA2 (without animation, not finished).

2. Press button "Open Model" and select model.
If you see now your model with loaded textures when all will work in FP. Just press "Save as TGA" button.
If model is not loaded or something is missing, try to save model in different format.
In ModelImporter you can change drawning params. Try it. It will not explode.
Additional info:
- with WASD you can move model
- when you press F11 you can with mouse change direction (like in FP). Press F11 again to turn it off
- when you press F10 model will be displayed as wireframe (like in FP).
- if you lost, press R. It will center model on screen.
- model can be build from many parts. For example "bob" have 6 parts. Each part can have own textures. Model is imported as whole object.

Model is saved as TGA. As you know TGA is texture format. It has one nice feature: you can add any amount of data at end of file (as metadata).
So that TGA file is simple 1 pixel texture with all data about model stored as meta-data at end of file.
Inside that file there is: 3d model, textures, model animations.

Add model to FP.
------------------------
Now you need to add created model to table in FP Editor. So:
1. Open table and open Texture Manager.
2. Press Import button and load TGA file created with ModelImporter and load TGA file.
3. Remember name of that "texture".
4. Close Texture Managaer.
5. SAVE TABLE. IT IS IMPORTANT. DON'T FORGET TO SAVE TABLE AFTER YOU ADD CUSTOM MODEL.

Display custom model on table. Command: CreateModel
--------------------------------------------------------------------
All custom-models are displayed on table with script commands, not in FP editor. So time to open script editor.
Simplest command to display custom object on table:
xBAM.CreateModel("name-from-texture-manager", x, y, z)
If you only add this command and run table (press F5) you can go to "DEV Options" and "Custom Models" menu and change model params.

Full list of params for CreateModel:
xBAM.CreateModel(
"name-from-texture-manager",
X, Y, Z,
Height,
RX, RY, RZ,
ReflectionFlag,
SwapZ2YFlag)

- X, Y, Z - coords from FP editor. Note, you can use objects from FP Editor as reference, like this: xBAM.CreateModel("something", Light1.X, Light1.Y+100, 0)
- Height - dimmension on Z axis of object in FP world. If you don't set it, BAM will gues value
- RX, RY, RZ - rotation on X, Y, Z axis, default is 0,0,0
- ReflectionFlag - True or False. Default is True
- SwapZ2YFlag - sometimes 3D model is designed with Y axis used as "up". You can set this flag to True. Same flag is in ModelImporter. Try it to understand it. Default is False.

This function will return "CustomModelObject". To change params later you will use this command like this:
Code:
Dim Starship
Set Starship = xBAM.CreateModel("starship", 100, 100, 0, 100)


This way you will have access to object properties.

[ToDo: more on custom object params.]

Author:  Gimli [ Sat Sep 14, 2019 10:23 am ]
Post subject:  Re: BAM Custom Models.

bump

Author:  Gimli [ Sat Sep 14, 2019 5:31 pm ]
Post subject:  Re: BAM Custom Models.

ravarcade wrote:
SLAMT1LT wrote:
ravarcade wrote:
Second, with model and textures imported as one single TGA.
See: http://gopinball.com/forum/viewtopic.php?f=86&t=6402
This should work always.


But this isn't working for me. The Model Importer included in the BAM directory will not import any .fpt model, instead it only seems to import .ms3d models but then it doesn't load the texture, so I only have a blank model.

.ms3d format dont have any material/texture info. Try to save model as .obj (wavefront). It is text format. It should also create .mtl file (this is material description).
See Geralt model in: http://www.ravarcade.pl/debug/models.zip

If it fails, you may try other formats, like fbx.

ModelImporter is using Assimp and many formats are supported (but some are broken): https://github.com/assimp/assimp/releases/tag/v4.1.0/



I am playing with this Custom Model feature Rav, it is quite interesting.

I think it would be cool to import animated models into FP.

It is not clear to me what animated file types are supported by "assimp" or where to find free animated models to try.

I tried some "rigged animated" models that weren't actually animated.

I found "bob" guy with a lamp demo is elsewhere on the net as well as in your demo folder. It is an md5anim file...that Bam model importer
imports nicely and converts to a tga file.

Also the Normal maps and diffuse map colored textures need to be assigned to and contained in the obj file to work...



My daughter uses Maya for Pixar type animations, so maybe she can export to md5anim

Author:  Gimli [ Sat Sep 14, 2019 6:19 pm ]
Post subject:  Re: BAM Custom Models.

It looks like Maya exports to fbx so we'll give that a go....https://youtu.be/hznxFmnB2to

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/