This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.

Material: Difference between revisions

From BZFlagWiki
Jump to navigation Jump to search
mNo edit summary
Jftsang (talk | contribs)
No edit summary
Line 1: Line 1:
A material is used in a BZFlag world to define a new look for otherwise regular objects, such as [[Meshbox|meshboxes]].
A material is used in a BZFlag world to define a new look for otherwise regular objects, such as [[Meshbox|meshboxes]].
==A note about textures==
A material can be composed of colours and textures. Textures are .png files that are either in the client directory or on the Internet. By default BZFlag will only download textures from images.bzflag.org, so any "alien" textures will not be displayed correctly. This can be changed by changing the configuration file.
The terms ''material'' and ''texture'' are often confused by newbies, so bear the above in mind.


==Code==
==Code==

Revision as of 21:53, 24 September 2007

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

A note about textures

A material can be composed of colours and textures. Textures are .png files that are either in the client directory or on the Internet. By default BZFlag will only download textures from images.bzflag.org, so any "alien" textures will not be displayed correctly. This can be changed by changing the configuration file.

The terms material and texture are often confused by newbies, so bear the above in mind.

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
end

Valid parameters for a Material are: <properties> name=name for reference texture=set the texture (must be .png but don't include the extension) addtexture=add a texture (again, no extension is needed) notextures=don't use textures. notexcolor=don't apply the color to the texture notexalpha=don't use the texture's alpha channel texmat=specify a texture matrix. -1 for no texture matrix. (addtexture must be used before texmat) dyncol=specify a dynamic color. -1 for no dynamic color. ambient=ambient color diffuse=diffuse (main)color color=synonym for diffuse specular=specular color emission=emission color shininess=shiny! resetmat=restore default values </properties> To actually apply a texture, 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

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.

Magic Material Names

General

GroundMaterial
WaterMaterial
LinkMaterial (for teleporters)

Skybox

LeftSkyboxMaterial
RightSkyboxMaterial
FrontSkyboxMaterial
BackSkyboxMaterial
TopSkyboxMaterial
BottomSkyboxMaterial

History

Materials were added in BZFlag 2.0.0.

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.