fisheye
Quick-n-dirty BRF Maker download:
http://forums.taleworlds.com/viewtopic.php?t=7054
BRF Fields and Collision Objects Documentation:
http://forums.taleworlds.com/viewtopic.php?t=7054
This tutorial assumes that you are able to make 3D OBJ files and import them into a BRF file using Lurb’s BRF Viewer. If you don’t know how to do this, refer to Yoshi’s tutorial for help.
For illustration, suppose we are trying to make a scene of a flat plain. Assume we are using Wings3d, and the plain is already defined and textured and exported and sitting happily in some BRF file which you defined. So, you can specify it in your scenes, and you can see it, but if you use some other scene's collision mesh (e.g. bo_thirsty_lion) you'll bump into walls that aren't there, etc. Now we need to make a collision object to define the "solid" and "walkable" areas of your scene.
A collision object definition (more often called a collision mesh) defines a space in 3D which is not allowed to intersect with other collision object definitions. The way this space is defined is often very different from the shape of the modelled object, especially if the object is small and intricate. For example, if I was modelling a crystal bowl with 1,234 faces, it's not going to be practical to "cut off the bits I don't need". It's easier to simply define a sphere that encloses the bowl, which means anything that touches this sphere is touching the bowl object. Why is this easier? A sphere is defined as a point in space XYZ with a radius. It is trivial to compute distances from this point, hence physics calculations are much easier. Similar rationales hold for things like capsule. A capsule (looks like the thing you take your medicines in) is a loci of points equidistant from a line, very easy for physics. So if you have a long shape, like a car, maybe, instead of taking the car's mesh and deleting vertices to get a simplified mesh, you wrap the whole thing up in a capsule, much simpler for your game engine to handle. Planes are useful for flat surfaces like walls and floors. Manifolds are used for more complex objects that need to be modelled accurately.
We’re going to make a big square “face”-type collision object to go with this big flat model of a plain. Now we need to get the correct sizing and positioning for the collision object. To do this, we typically make another object that has roughly the same size and shape as our collision object, and then read off its dimensions.
In this case, we don’t even need to do that, since we can see the dimensions that we want simply from our 3D editor.
You can see from here that Wings says the position of the upper left vertex of my plain is at (-77.25, -0.01, -77.25). Since my plain is centered at 0, the other corners are at (77.25, -0.01, -77.25), (77.25, -0.01, 77.25), (-77.25, -0.01, 77.25).
Important note: the coordinates for Wings3D are Y-Z flipped for M&B, so make sure you flip the Y and Z coordinates when entering your data.
Now get BRFMaker and put it in some directory (doesn’t matter where). Edit brf_data.py to show the following:
The outputfilename is self explanatory. The variable “body” is a list of collision objects we are going to include in this file; this one contains only one collision object, “bo_big_floor”. The collision object consists of a “face”, with the specified coordinates that we read off from the previous part (remembering to flip the Y and Z axes), in counterclockwise order with respect to the normal of the face. The last parameter is an unknown but seems to always be set to 4 for collision meshes.
As another example, suppose we added another collision object to this file. Then it would maybe look like:
In this case the collision object of the table is a “composite” of two other collision structures, with a “face” for the tabletop and a “capsule” to encapsulate the legs. This example is for illustration only, don’t include this code for your tutorial.
Now once you’re done entering this into brf_data.py, run make_brf.bat and it will compile a brand new BRF for you with your chosen filename. In this case, it’s bo_big_floor.brf. Move this BRF to your Modules/MyModuleName/Resource folder (of course, replace MyModuleName with the name of your mod).
Now edit Modules/MyModuleName/module_info.txt to include these lines:
Using either the unofficial editor or the python scripts, you can now include these scenes wherever you wish. For example, I made the following changes:
Fire up M&B, enter the scenes (e.g. by talking to the arenamaster) and enjoy!
http://forums.taleworlds.com/viewtopic.php?t=7054
BRF Fields and Collision Objects Documentation:
http://forums.taleworlds.com/viewtopic.php?t=7054
This tutorial assumes that you are able to make 3D OBJ files and import them into a BRF file using Lurb’s BRF Viewer. If you don’t know how to do this, refer to Yoshi’s tutorial for help.
For illustration, suppose we are trying to make a scene of a flat plain. Assume we are using Wings3d, and the plain is already defined and textured and exported and sitting happily in some BRF file which you defined. So, you can specify it in your scenes, and you can see it, but if you use some other scene's collision mesh (e.g. bo_thirsty_lion) you'll bump into walls that aren't there, etc. Now we need to make a collision object to define the "solid" and "walkable" areas of your scene.
A collision object definition (more often called a collision mesh) defines a space in 3D which is not allowed to intersect with other collision object definitions. The way this space is defined is often very different from the shape of the modelled object, especially if the object is small and intricate. For example, if I was modelling a crystal bowl with 1,234 faces, it's not going to be practical to "cut off the bits I don't need". It's easier to simply define a sphere that encloses the bowl, which means anything that touches this sphere is touching the bowl object. Why is this easier? A sphere is defined as a point in space XYZ with a radius. It is trivial to compute distances from this point, hence physics calculations are much easier. Similar rationales hold for things like capsule. A capsule (looks like the thing you take your medicines in) is a loci of points equidistant from a line, very easy for physics. So if you have a long shape, like a car, maybe, instead of taking the car's mesh and deleting vertices to get a simplified mesh, you wrap the whole thing up in a capsule, much simpler for your game engine to handle. Planes are useful for flat surfaces like walls and floors. Manifolds are used for more complex objects that need to be modelled accurately.
We’re going to make a big square “face”-type collision object to go with this big flat model of a plain. Now we need to get the correct sizing and positioning for the collision object. To do this, we typically make another object that has roughly the same size and shape as our collision object, and then read off its dimensions.
In this case, we don’t even need to do that, since we can see the dimensions that we want simply from our 3D editor.
You can see from here that Wings says the position of the upper left vertex of my plain is at (-77.25, -0.01, -77.25). Since my plain is centered at 0, the other corners are at (77.25, -0.01, -77.25), (77.25, -0.01, 77.25), (-77.25, -0.01, 77.25).
Important note: the coordinates for Wings3D are Y-Z flipped for M&B, so make sure you flip the Y and Z coordinates when entering your data.
Now get BRFMaker and put it in some directory (doesn’t matter where). Edit brf_data.py to show the following:
Code:
outputfilename = "bo_big_floor.brf"
body = [
[
"bo_big_floor",[
"face", [ [-77.25,-77.25, -0.01],[77.25,-77.25, -0.01],[77.25,77.25, -0.01],[-77.25,77.25, -0.01] ], 4
]
],
]
The outputfilename is self explanatory. The variable “body” is a list of collision objects we are going to include in this file; this one contains only one collision object, “bo_big_floor”. The collision object consists of a “face”, with the specified coordinates that we read off from the previous part (remembering to flip the Y and Z axes), in counterclockwise order with respect to the normal of the face. The last parameter is an unknown but seems to always be set to 4 for collision meshes.
As another example, suppose we added another collision object to this file. Then it would maybe look like:
Code:
outputfilename = "bo_big_floor.brf"
body = [
[
"bo_big_floor",[
"face", [ [-77,-77,0],[77,-77,0],[77,77,0],[-77,77,0] ], 4
]
],
[
"bo_huge_giant_table",[
“composite”, [
("face", [ [-7,-2,4],[7,-2,4],[7,2,4],[-7,2,4] ], 4),
("capsule", [ 2, [-5,0,2],[5,0,2] ], 4),
]
]
],
]
In this case the collision object of the table is a “composite” of two other collision structures, with a “face” for the tabletop and a “capsule” to encapsulate the legs. This example is for illustration only, don’t include this code for your tutorial.
Now once you’re done entering this into brf_data.py, run make_brf.bat and it will compile a brand new BRF for you with your chosen filename. In this case, it’s bo_big_floor.brf. Move this BRF to your Modules/MyModuleName/Resource folder (of course, replace MyModuleName with the name of your mod).
Now edit Modules/MyModuleName/module_info.txt to include these lines:
Code:
load_module_resource = bo_big_floor
Using either the unofficial editor or the python scripts, you can now include these scenes wherever you wish. For example, I made the following changes:
Code:
("zendar_arena",0,"big_grass_ground", "bo_big_floor", (-100,-100),(100,100),-100,"0", [],[]),
Fire up M&B, enter the scenes (e.g. by talking to the arenamaster) and enjoy!