This wiki is archived and useful information is being migrated to the main bzflag.org website

BZW.Rendering

From BZFlagWiki
Jump to: navigation, search
  • notes on how to properly render a bzw map

*Classic Box*----------------

The box is made up of 2 parts, the walls and the roof. The walls are the sides that are are allways normal to the ground plane, where the roof is remaining top and bottom of the box. Each part uses it's own texture and material. All box geometry is defined relitive to a roation of 0, and the final result is rotated to the rot angle.

Walls Box walls are defined using the scale from the map format. The X and Y scales are the distance from Center to the wall of that side. The Z scale is the distance from the bottom of the box to the top. This means that for any box it is 2 times it's size in X and Y when drawn, but the same size in Z ( a unit cube is defined as 0.5 0.5 1 ).

The wall texture scale is 6 times the muzzle height. The default muzzle height is 1.57 units. This means that a default texture will repeat every 9.42 units. For the box walls the texture Origin is allways in the lower left of the face as viewed from the outside. so for each wall, the origin is allways the box bottom and thie folowing Axis; Y- wall, -X X- wall, +Y Y+ wall, +X X+ wall, -Y This origin allways maps to the lower left hand corner of the texture image

Roof Box roofs are defined using the scale from the map format. The lower roof has it's normal aligned along Z- in the world, is allways at the Z postion for the object, and extends +-XYScale to meet the boxwalls. The roof has it's normal aligned along Z+ also extends to +-XYScale, and it at Z Scale above the lower roof.

The roof texture scale is 1/5th of the wall texture scale, so for each texture repeat of the wall, there will be 5 repeats on the roof above it. A defualt roof texture repeats every 1.884 units.

The origin for the roof texture the same for both top and bottom, but each texture is oriented difrently. They textures allways map the lower left cornder of the image to the Y+ X+ side of the box.On the top the texture is oriented so that the X+ directon on the texture is going in the X- direction in world space, and the Y+ texture direction is going in the Y- direction in world space. Basicly rotated 180 around Z when looking in the Y+ world direction.

The bottom texture X+ direction goes in the world Y- direction, and the Y+ texture direction in the world X- direction. Basicly rotated Counter Clockwise 90deg in Z when looking to the Y+ world direction.

When textured the default color for a box is white and all color comes from the texture.


*Classic Pyramid*---------------

The pyramid is made up of 5 faces a flat 4 sided rectangle floor with it's normal facing in the Z- direction, and 4 triangluar walls that each extend from one side of the floor to a peak that is Z Scale+ high.

All pyramid geometry is defined relitive to a roation of 0, and the final result is rotated to the rot angle.

The pyramid floor is +- XY scale in size and at the Z position. The XY position is the center of the floor.

The texture for the floor has it's origin at the X+ Y+ corner of the pyramid, with the texture X+ axis moving in the world Y- direction, and the texture Y+ axis moving in the world X-. Basicly rotated 90 like the box floors.

The pyramid wall textures are the wierdest I have seen in any object. The UV axes are NOT orthonormal.

Each Side has an origin in it's lower left corner. Each texture extends it's X+ axis to the right, and it's Y axis along the vector to the centerpoint.

The base texture repeat for the UV of the floor and lower X+ texutre axes is 7.55 units per texture repeat. The texture Y axis for the walls that moves along the vector to the tip apears to also follow the same distance run, but along the vector using a distance calculation ( aka, flat to the face )

the origins and directions for each side are as follows, all V vectors go along the vector from the origin to the center;

Y- side UV origin X- Y- U+ = X+

X+ side UV origin X+ Y- U+ = X-

Y+ side UV origin X+ Y+ U+ = X-

y- side UV origin X- Y+ U+ = X+

When textured the default color for a box is white and all color comes from the texture.


*Ground*---------------

The ground is a plane at Z0 that extends to +- infinity. The default exture repeat is 1 repeat every 20 units. The texture XY axes are aligned to the world XY axes. Texture origin is at 0 0



*Walls*---------------

The outer walls are vertical quads that block off the ground plane at +- world size in each axis. They use the same texture repeat as the ground ( 20 units per repeat ) and also havee the origin at the 0 value for the axis they cross. The vertical origin is Z0. the walls are