Model Tool Updates
Model Tool Updates
Ok so with all the research I did to help people understand draw info, I went ahead and updated model tool to generate draw info meshes if you want it to. Complete with support for LOD.
A windows build of model tool 1.8.4 can be found at;
http://beta.bzflag.bz/builds/tools/mode ... _1.8.4.zip
Optic Delusion has been kind enough to provide an intel mac build
http://beta.bzflag.bz/builds/tools/mode ... _1.8.4.zip
Linux and OSX users can build modeltool from the sources in the current development trunk of the bzflag source code ( see http://my.bzflag.org/w/BZFlag_SVN for info on how to get the code ). Model tool is fully cross platform, it is NOT windows only.
To generate a draw info mesh, modeltool needs more info then just a single obj file, so what you have to do is pass it a "diconf" file. This is just a text file with it's extension changed to diconf. In this file you refrence one or more obj files to import and tell model tool how to use it.
I've attached a sample config file as well as a bzw file generated by the tool ( the tank spinning ).
Please let me know if you have any questions, or find any bugs. This is new code, and has only been briefly tested by me.
This update supports static geometry ( as normal mesh faces ), invisible bounding geometry ( as normal mesh faces ), LOD meshes ( as triangle lists or polygons ), and animation commands for the LOD geometry. It does not support triangle strips or fans, or any of the other extended draw info commands. It also requires an OBJ file for each LOD level, it will not generate them for you.
Update Notes:
1.8.0 : First draw info release.
1.8.1 : Bug fixes and material updates for draw info after initial testing.
1.8.2 : Support global shift and scale in all input models, and for draw info bounds computation.
1.8.3 : Change default behavor to NOT compute Draw Info bounds and sphere, so BZ can compute them.
1.8.4 : Options to output comments in the BZW file with index IDs.
A windows build of model tool 1.8.4 can be found at;
http://beta.bzflag.bz/builds/tools/mode ... _1.8.4.zip
Optic Delusion has been kind enough to provide an intel mac build
http://beta.bzflag.bz/builds/tools/mode ... _1.8.4.zip
Linux and OSX users can build modeltool from the sources in the current development trunk of the bzflag source code ( see http://my.bzflag.org/w/BZFlag_SVN for info on how to get the code ). Model tool is fully cross platform, it is NOT windows only.
To generate a draw info mesh, modeltool needs more info then just a single obj file, so what you have to do is pass it a "diconf" file. This is just a text file with it's extension changed to diconf. In this file you refrence one or more obj files to import and tell model tool how to use it.
I've attached a sample config file as well as a bzw file generated by the tool ( the tank spinning ).
Please let me know if you have any questions, or find any bugs. This is new code, and has only been briefly tested by me.
This update supports static geometry ( as normal mesh faces ), invisible bounding geometry ( as normal mesh faces ), LOD meshes ( as triangle lists or polygons ), and animation commands for the LOD geometry. It does not support triangle strips or fans, or any of the other extended draw info commands. It also requires an OBJ file for each LOD level, it will not generate them for you.
Update Notes:
1.8.0 : First draw info release.
1.8.1 : Bug fixes and material updates for draw info after initial testing.
1.8.2 : Support global shift and scale in all input models, and for draw info bounds computation.
1.8.3 : Change default behavor to NOT compute Draw Info bounds and sphere, so BZ can compute them.
1.8.4 : Options to output comments in the BZW file with index IDs.
- Attachments
-
- example.diconf.zip
- sample config file with notes.
- (887 Bytes) Downloaded 509 times
-
- tank.bzw
- a sample mesh that uses draw info.
- (23.54 KiB) Downloaded 471 times
Last edited by JeffM on Wed Oct 24, 2007 11:22 pm, edited 5 times in total.
![Image](https://forums.bzflag.org/download/file.php?avatar=48_1588010522.png)
Optic Delusion has been kind enough to provide an Intel mac build and I have uploaded it to
http://beta.bzflag.bz/builds/tools/mode ... _intel.zip
I also moved the windows build to the same directory so it can be found at
http://beta.bzflag.bz/builds/tools/modeltool_1.8.zip
http://beta.bzflag.bz/builds/tools/mode ... _intel.zip
I also moved the windows build to the same directory so it can be found at
http://beta.bzflag.bz/builds/tools/modeltool_1.8.zip
![Image](https://forums.bzflag.org/download/file.php?avatar=48_1588010522.png)
-
- Private First Class
- Posts: 220
- Joined: Tue Jul 26, 2005 10:32 pm
- Location: Gainesville Florida
Here are the diconfig and obj file I tried to convert to drawInfo.
command line:
$ modeltool bztank.diconf
diconf file bztank.diconf converted to BZW as bztank.bzw
$ ls
bztank.diconf
bztank.mtl
bztank.obj
didn't output the .bzw
command line:
$ modeltool bztank.diconf
diconf file bztank.diconf converted to BZW as bztank.bzw
$ ls
bztank.diconf
bztank.mtl
bztank.obj
didn't output the .bzw
- Attachments
-
- bztank.diconf.txt
- the diconf file
- (1.59 KiB) Downloaded 501 times
-
- bztank.obj.txt
- The obj file
- (232.17 KiB) Downloaded 402 times
-
- bztank.mtl.txt
- The mtl file, just in case
- (231 Bytes) Downloaded 411 times
-
- Private First Class
- Posts: 220
- Joined: Tue Jul 26, 2005 10:32 pm
- Location: Gainesville Florida
I'm having intermittent success with it. I managed to get output from another obj file after repeated attempts. The diconf was :
anim "angvel 40"
lod 0 "objectfile.obj"
It seems that the anim command isn't getting to the drawInfo output, but is needed to make the app work? Without anim command I could not get output.
When it works its great! Thanks.
anim "angvel 40"
lod 0 "objectfile.obj"
It seems that the anim command isn't getting to the drawInfo output, but is needed to make the app work? Without anim command I could not get output.
When it works its great! Thanks.
-
- Private First Class
- Posts: 220
- Joined: Tue Jul 26, 2005 10:32 pm
- Location: Gainesville Florida
maybe one more, line 442 in modeltool.cxx, shouldn't that be
it's on my copy.
That was confusing the hell outa me, kept saying "no valid meshes...", but the .bzw was there.![Confused :?](./images/smilies/icon_confused.gif)
Code: Select all
if (!meshes.valid())
Code: Select all
if ( meshes.valid())
That was confusing the hell outa me, kept saying "no valid meshes...", but the .bzw was there.
![Confused :?](./images/smilies/icon_confused.gif)
- optic delusion
- Special Forces
- Posts: 1054
- Joined: Sat Sep 25, 2004 2:29 pm
- Location: Planet MoFo
- Contact:
This is working well, but we have some problems.
Inevitably after exporting with angvel, we need to make some changes to the object to make it fit into the map. I might move the object around with a group, or even change the vertices. This has a tendency to invalidate the extents and sphere numbers. We need a way to generate new extents including shift in the group, without making a new obj-to bzw export. We need an actual formula.
I would also like to see a conf option to #number each v/n/t and corner, to help in later editing.
Inevitably after exporting with angvel, we need to make some changes to the object to make it fit into the map. I might move the object around with a group, or even change the vertices. This has a tendency to invalidate the extents and sphere numbers. We need a way to generate new extents including shift in the group, without making a new obj-to bzw export. We need an actual formula.
I would also like to see a conf option to #number each v/n/t and corner, to help in later editing.
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
technically you have the "formula" since you have the code, but it's prety simple
find the largest and smallest value for X Y and Z ( each independently )
For each one, subtract the min from the max, and divide it by 2
add that value to the min. That is the center point in that axis, and the value is the distance to the bounds in that axis
When you have all all 3 axes, you have the full center point just do the square root of the X distance squared, + the Y distance squared + the Z distance squared, and that is your sphere radius.
If the mesh object is in a group, then the sphere you define is relative to the group, so you should not have to modify the bounds or the sphere based on where the group is ( if it does not work like this, I call that a bug, since you may have more then one instance of the group )
I see that that bounding code in model tool doesn't take the global shift and scale into account. I've fixed that bug in the current code for 2.1. The shift and scale are now applied when the model is read in.
find the largest and smallest value for X Y and Z ( each independently )
For each one, subtract the min from the max, and divide it by 2
add that value to the min. That is the center point in that axis, and the value is the distance to the bounds in that axis
When you have all all 3 axes, you have the full center point just do the square root of the X distance squared, + the Y distance squared + the Z distance squared, and that is your sphere radius.
If the mesh object is in a group, then the sphere you define is relative to the group, so you should not have to modify the bounds or the sphere based on where the group is ( if it does not work like this, I call that a bug, since you may have more then one instance of the group )
I see that that bounding code in model tool doesn't take the global shift and scale into account. I've fixed that bug in the current code for 2.1. The shift and scale are now applied when the model is read in.
![Image](https://forums.bzflag.org/download/file.php?avatar=48_1588010522.png)
- optic delusion
- Special Forces
- Posts: 1054
- Joined: Sat Sep 25, 2004 2:29 pm
- Location: Planet MoFo
- Contact:
little tutorial
The mac build in the above download has been updated as well, to 1.8.4
There's nothing about modeltool on the wiki, if some one adds that, you'd be doing mappers a gigantic favor. In the meantime, I'll give my little "how to"
1. Jeff provides builds of modeltool, get the correct one for your system, and a copy of example.diconf. Place them in a new folder.
2. Into the same folder place your .obj file. The ENTIRE object should be texture mapped.
3. Edit the diconf so it references your .obj file.
3a. The line "lod 0" is the only one you really need to start experimenting with drawinfo. put your filename there. For now leave "bounding" and "static" with double-slash // C++ style comment markers.
3b. You can add angvel if you want motion, 40 is a good number.
4. Open your terminal and cd to the folder you created.
5. run this command ./modeltool example.diconf
6. A .bzw will be created, named after the .diconf. Load it into bzfs.
There's nothing about modeltool on the wiki, if some one adds that, you'd be doing mappers a gigantic favor. In the meantime, I'll give my little "how to"
1. Jeff provides builds of modeltool, get the correct one for your system, and a copy of example.diconf. Place them in a new folder.
2. Into the same folder place your .obj file. The ENTIRE object should be texture mapped.
3. Edit the diconf so it references your .obj file.
3a. The line "lod 0" is the only one you really need to start experimenting with drawinfo. put your filename there. For now leave "bounding" and "static" with double-slash // C++ style comment markers.
3b. You can add angvel if you want motion, 40 is a good number.
4. Open your terminal and cd to the folder you created.
5. run this command ./modeltool example.diconf
6. A .bzw will be created, named after the .diconf. Load it into bzfs.
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
- optic delusion
- Special Forces
- Posts: 1054
- Joined: Sat Sep 25, 2004 2:29 pm
- Location: Planet MoFo
- Contact:
This is becoming much easier now. You don't need to know the mysteries of how to make drawinfo map objects, it's all done for you. Once modeltool is set up with a diconf, I just make an .obj, run it through modeltool, then place it in my bzw. It works pretty much like any other object, especially if i wrap it in a define and place with a group.
Jeff, it it could wrap the generated bzw object in a define for me, that would save a lot of copy-paste operations, there would be no need to open the modeltool'd bzw at all, thanks to the include function.
I haven't delved into LOD much, yet. Is the diconf command "lod 0.2 "lowerResFile.obj"" repeatable for multiple LODs?
Tedius's di-machine script has it's uses. It is doing tristrips, quadstrips and trifans, as well as very sloppy automatic vertex decimation for LOD. He just skips every other corner in further LODs. (As opposed to modeltool's correct method, where a second obj must be generated by the mapper, and fed into modeltool.) The easier but sloppy method appears to be sufficient for complex meshes, at first blush, as long as I use a LengthPerPixel greater than .5
Jeff, it it could wrap the generated bzw object in a define for me, that would save a lot of copy-paste operations, there would be no need to open the modeltool'd bzw at all, thanks to the include function.
I haven't delved into LOD much, yet. Is the diconf command "lod 0.2 "lowerResFile.obj"" repeatable for multiple LODs?
Tedius's di-machine script has it's uses. It is doing tristrips, quadstrips and trifans, as well as very sloppy automatic vertex decimation for LOD. He just skips every other corner in further LODs. (As opposed to modeltool's correct method, where a second obj must be generated by the mapper, and fed into modeltool.) The easier but sloppy method appears to be sufficient for complex meshes, at first blush, as long as I use a LengthPerPixel greater than .5
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
I don't mean to hijack the thread, but I want to clear up the misconception about my baby. dI-machine does not include any decimation, sloppy or otherwise. I wouldn't attempt to create something that even the best 3D modeling software can't do right. It only includes instructions in the output for where to copy and paste other LODs. Similar to modeltool, it is up to the mapper to make multiple lower resolution models.Optic Delusion wrote:very sloppy automatic vertex decimation for LOD. He just skips every other corner in further LODs. (As opposed to modeltool's correct method,
Now back to your regularly scheduled Modeltool Topic.
this signature intentionally left blank
- Abominable
- Private First Class
- Posts: 141
- Joined: Mon Oct 22, 2007 12:31 am
- optic delusion
- Special Forces
- Posts: 1054
- Joined: Sat Sep 25, 2004 2:29 pm
- Location: Planet MoFo
- Contact:
Modeltool takes files in .obj-format, and converts them into .bzw format.
I suppose it's possible to create obj format files in text editors, but that is extremely difficult.
You are going to need some kind of 3D editor, that can export to obj format.
Using modeltool is very easy, once you know how it works.
http://mybzflag.net/?p=296#comments
I suppose it's possible to create obj format files in text editors, but that is extremely difficult.
You are going to need some kind of 3D editor, that can export to obj format.
Using modeltool is very easy, once you know how it works.
http://mybzflag.net/?p=296#comments
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
- Abominable
- Private First Class
- Posts: 141
- Joined: Mon Oct 22, 2007 12:31 am
- optic delusion
- Special Forces
- Posts: 1054
- Joined: Sat Sep 25, 2004 2:29 pm
- Location: Planet MoFo
- Contact:
Are you looking at the top post in this thread? they seem live to me.
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
- Abominable
- Private First Class
- Posts: 141
- Joined: Mon Oct 22, 2007 12:31 am