meshes

Questions and answers about the how and why of making maps.
Post Reply
User avatar
Mopar Madness
Private First Class
Private First Class
Posts: 169
Joined: Mon Jul 03, 2006 3:31 am

meshes

Post by Mopar Madness »

the wiki help thing didnt really explain meshes that good, so i was wondering if someone could better explain the stuff in red:
mesh
name example_mesh
# Material properties applied to a mesh apply to all faces
# that follow the setting. Mesh faces will alter their own
# properties without affecting the state of the mesh properties.
# The same pattern is used to apply physics drivers.
inside 5.5 4.5 1.2 # add an inside point (repeatable)
outside 0 0 1000 # add an outside point (repeatable)

vertex 100 200 300 # add a vertex (repeatable)
normal 1.0 0 0 # add a normal (repeatable)
texcoord 0.1 0.75 # add a texture coordinate (repeatable)
shift 0 0 0 # (repeatable)
scale 1 1 1 # (repeatable)
shear 0 0 0 # (repeatable)
spin angle nx ny nz # (repeatable)

phydrv example_phydrv # assign a physics driver
smoothbounce # ricochets use normals
noclusters # render each mesh face individually
# (this can be useful for occluders)
face # start a face (repeatable)
# faces must be convex polygons
vertices 1 4 0 3 5 # list of vertices (requires at least three)
normals 2 6 0 4 7 # list of normals (optional)
texcoords 0 3 2 4 9 # list of texture coordinates (optional)
phydrv example_phydrv # assign a physics driver
smoothbounce
noclusters
drivethrough
shootthrough
passable
material
endface # end the face
#
# This next element can be added to increase the rendering speed
# of the mesh object. If the client is capable of using this data,
# then it is used to draw the mesh instead of the face information.
#
drawInfo
dlist # display list for all material sets
decorative # older clients with not see this mesh
angvel <degrees> # rotation about initial Z axis
extents <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
sphere <x> <y> <z> <radiusSquared>
corner <v> <n> <t> (repeatable)
vertex 0.0 0.0 0.0 (repeatable)
normal 0.0 0.0 0.0 (repeatable)
texcoord 0.0 0.0 (repeatable)
lod (repeatable)
lengthPerPixel <value>
matref <name> (repeatable)
dlist # display list for this material set
sphere <x> <y> <z> <radiusSquared>
points 0 (repeatable)
lines 0 1 (repeatable)
lineloop 0 1 (repeatable)
linestrip 0 1 (repeatable)
tris 0 1 2 (repeatable)
tristrip 0 1 2 (repeatable)
trifan 0 1 2 (repeatable)
quads 0 1 2 3 (repeatable)
quadstrip 0 1 2 3 (repeatable)
polygon 0 1 2 (repeatable)
end # matref
end # lod
end # drawInfo

end # mesh
User avatar
CannonBallGuy
Private First Class
Private First Class
Posts: 2083
Joined: Wed Apr 12, 2006 1:31 am
Contact:

Post by CannonBallGuy »

Code: Select all

inside 5.5 4.5 1.2 # add an inside point (repeatable)
This is any point INSIDE the mesh.

Code: Select all

outside 0 0 1000 # add an outside point (repeatable)
This is any point OUTSIDE the mesh.
You probably don't need both, either define the inside OR the outside...

Code: Select all

shift 0 0 0 # (repeatable)
scale 1 1 1 # (repeatable)
shear 0 0 0 # (repeatable)
spin angle nx ny nz # (repeatable)
See the bzw man page for info on these.
Image

Merry Christmas!

"Look, if I don't buy booze for the kids, I don't get any incriminating pictures to show to their parents, my business goes down the sink, my girlfriend leaves me and the baby goes on ebay. So help me search..."

"go Play With Toys urself in a dark alley u donkey ******" - Lt-Kirby2007
ts
Dev Monkey
Dev Monkey
Posts: 970
Joined: Fri Jan 14, 2005 6:26 pm

Re: meshes

Post by ts »

Code: Select all

drawInfo
Speeding up drawing using striping and LOD.

Code: Select all

   dlist		      # display list for all material sets
Umm, that is just a keyword for display lists, as far as I know.

Code: Select all

   decorative		      # older clients with not see this mesh
Self-explaining.

Code: Select all

   angvel <degrees>       # rotation about initial Z axis
This is how fast the LOD turns in screen, collision box will remain at the original position.

Code: Select all

   extents <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
   sphere <x> <y> <z> <radiusSquared>
No need to know that, computed automatically by bzfs if not specified.

Code: Select all

   corner <v> <n> <t>	      (repeatable)
Corner data. Absolutly necessary to construct the strips and therefore to draw the meshes faster. No idea how to automatically construct them correct.

Code: Select all

   lod			      (repeatable)
Level Of Detail. Far away meshes are drawn with less details (user can not see the difference) and therefore speeding it up a lot

Code: Select all

     lengthPerPixel <value>
When to use which LOD-description. 0 is for very near, higher for more away.

Code: Select all

     matref <name>	      (repeatable)
Which material should apply to the drawn mesh. Should be self-explaining.

Code: Select all

       dlist		      # display list for this material set
Display list keyword.

Code: Select all

       sphere <x> <y> <z> <radiusSquared>
       points	 0	      (repeatable)
       lines	 0 1	      (repeatable)
       lineloop  0 1	      (repeatable)
       linestrip 0 1	      (repeatable)
No idea.

Code: Select all

       tris	 0 1 2	      (repeatable)
       tristrip  0 1 2	      (repeatable)
Both tris and tristrip are the same construct. Represents triangle strips to draw less with no visible difference. Giving a performance increase of 15%.

Code: Select all

       trifan	 0 1 2	      (repeatable)
Look at typical computer graphics tutorials/lessons.

Code: Select all

       quads	 0 1 2 3      (repeatable)
       quadstrip 0 1 2 3      (repeatable)
Similar to tris and tristrips. Explained good in computer graphics tutorials/lessons.

Code: Select all

       polygon	 0 1 2	      (repeatable)
No idea.

Code: Select all

     end  # matref
   end	  # lod
 end	  # drawInfo [/color]
end	  # mesh
End blocks for data structure. Easy.
GU league: http://www.guleague.org/
An introduction to TCP: http://www.lafkon.net/tc/
jude-
2007 Google Summer of Code Participant
2007 Google Summer of Code Participant
Posts: 13
Joined: Tue May 22, 2007 11:11 pm
Contact:

Post by jude- »

Hmmm....If memory serves correctly:

The sphere keyword probably creates a sphere (if not, then it most likely creates a bounding sphere).

Point defines a 3D vertex in a mesh.

Corner contains an index to a vertex, a texture coordinate, and a normal.

Lines defines a line between two points (the two values following it are the indexes you wish to connect); kinda like tris.

Lineloop defines a series of lines between a series of points (again, you supply the indexes) that are closed.

Linestrip is similar to tristrip--create a series of connected lines.

Polygon is like tris, but takes any number of indexes.

Someone please correct me if I'm wrong.
A computer in the hands of a capable developer is like a lightsaber in the hands of a capable Jedi.
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1054
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

OLD BZW MANPAGE

Post by optic delusion »

the new bzw manpage has an error, in the texture matrix definition, and some things that aren't really needed by newbie mappers. (You don't really need any of the LOD stuff)
I suggest you use the OLD manpage that I have made available for download here.
http://cbg.bzflag.org/images/A-Delusion/manpages_old/
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.
Post Reply