Vizard 7 » Reference » Appearance & Texturing » Draw order & Z offsetting
7.7

Draw order & Z offsetting

Draw Order

Vizard allows users to control the draw ordering of objects. By default, opaque objects have a draw order of 0 and transparent objects have a draw order of 10. Objects are drawn from lowest to highest draw order. You can set the draw order to any number, even negative values. For instance, if you wanted an object to appear on top of all other objects, you would set the draw order to a very high value and disable depth testing:

object.drawOrder(100)
object.disable(viz.DEPTH_TEST)

Z Offsetting

You may have noticed that when you render two polygons on the same plane you get some very ugly artifacts. This is referred to as a Z-fighting artifact. You can fix this problem by applying a Z-offset to one of the polygons. The zoffset command will offset a polygon forcing it to appear on top of or behind other polygons. The following is a screenshot of a blue square that lies on the same plane of a larger red square:

This is what a Z-fighting artifact looks like. To prevent this, we can give the blue square a zoffset of -1:

blueSquare.zoffset(-1)

After this command is performed, the screenshot will look like the following:

When using the zoffset command keep in mind that a negative offset will push the polygon towards the viewer and a positive offset will push the polygon away from the viewer.

See also

In this section:

Appearance & texturing basics

Texture wrapping

Multi-texturing

Environment mapping

Texture appearance and filtering

Texture types

Texture matrix

Visibility

Projecting textures

Appearance & texturing command table

Other sections:

3D model basics