Material

From BZFlagWiki

Jump to: navigation, search

A material is used in a BZFlag world to define a new look for otherwise regular objects, such as meshboxes.

Contents

[edit] Code

To put a material in your map, first it must be defined:

material
 name example_material
 texture filename
 addtexture filename
 notextures
 notexcolor
 notexalpha
 texmat -1
 dyncol -1
 ambient 0.0 0.0 0.0 1.0
 diffuse 1.0 1.0 1.0 1.0
 color 1.0 1.0 1.0 1.0
 specular 0.0 0.0 0.0 1.0
 emission 0.0 0.0 0.0 1.0
 shininess 0.0
 resetmat
 spheremap 
 noradar 
 noshadow
 noculling 
 nosorting 
 nolighting 
 alphathresh 0.0 
 groupalpha
 occluder 
end

Valid parameters for a Material are:

namename for reference
textureset the texture (must be .png but don't include the extension unless on the Internet)
addtextureadd a texture (again, no extension is needed)
notexturesdon't use textures.
notexcolordon't apply the color to the texture
notexalphadon't use the texture's alpha channel
texmatspecify a texture matrix. -1 for no texture matrix. (addtexture must be used before texmat)
dyncolspecify a dynamic color. -1 for no dynamic color.
ambientambient color
diffusediffuse (main)color
colorsynonym for diffuse
specularspecular color
emissionemission color
shininessshiny!
resetmatrestore default values
spheremapuse spherical texture coordinate mapping
noradardo not display on radar (except normal mode)
noshadowdo not render shadows
nocullingdo not cull by face winding (double-sided)
nosortingdo not do front-to-back alpha sorting
nolightingdisable lighting
alphathreshalpha thresholding value
groupalphasort translucent faces as a group
occluderfaces with this material will occlude

To actually apply a material, you must use some sort of reference in an object, like so:

meshbox
 position 0 0 10
 rotation 0
 size 10 10 5
 matref example_material
end

[edit] Transparency

The transparency effect is created by setting the alpha component of a material's color to a value less than one. Transparent objects should be sparingly, because everything behind them must always be rendered. In addition, very large transparent objects may be sorted and drawn in the wrong order. This is caused by the fact that the Z-buffer cannot be used because it would allow another transparent object to cover the transparent object, which would not look right. Thus, the transparent elements are instead sorted by determining the distance to a point in the center, which works well as long as there are not too many large transparent objects. The same applies to textures that have transparent sections.

[edit] Magic Material Names

[edit] General

GroundMaterial
WaterMaterial
LinkMaterial For Teleporter
TeleFrame For Teleporter Frame (BZFlag version 3.0)

[edit] Skybox

LeftSkyboxMaterial
RightSkyboxMaterial
FrontSkyboxMaterial
BackSkyboxMaterial
TopSkyboxMaterial
BottomSkyboxMaterial

[edit] History

Materials were added in BZFlag 2.0.0.

[edit] Editor Support

Materials are supported in Blender with BZWTools, pyBZEdit, and Wings3D with the BZW Exporter for Wings3D. Materials are NOT supported in BZEdit or BZFed.

[edit] A note about textures

A material can be composed of colors and textures. Textures are .png files that are either in the client directory or on the Internet. The terms material and texture are often confused and misunderstood, so bear the above in mind.

Personal tools