You are here: Foswiki>WorldFoundry Web>DocumentationZSort (12 Apr 2002, KevinSeghetti;)

### ROOM Z-SORT ATTRIBUTES

KevinSeghetti -- WorldFoundry under OpenGL now uses ZBuffering, a much better system for handling polygon ordering, so all of this is obsolete. I am putting here both for historical interest as well as in case WorldFoundry is ever again run on the Playstation or other environment where Z-Sorting is not available. (the software renderer pipeline still uses Z-Sorting).

Sort Primitives: Are the polygons in this table sorted (true) or unsorted (false). If false is chosen, all polygons are placed in the first bucket of the order table.

Values
True, False
Default
True Suggested Values: False for simple objects. True for complex objects.
Comments
Always try false in case it looks good enough.

Primitive Depth Value: Determines which feature of each polygon is used to place it into an order table bucket.

Values
First Vertex, Min, Average, Max
Default
Max Suggested Value: Max Comments: First Vertex: Good for convex polygons (ex. pyramids, cubes, octahedrons.) Fastest polygon feature to compute.
Min
Sort polygon based on the minimum depth value (closest point). This (and max) are the 2nd fastest polygon features to compute.
Average
Sort polygon based on the average depth of a polygon's points. This is the slowest polygon feature to compute.
Max
Sort polygon based on the maximum depth value (farthest point). This (and min) are the 2nd fastest polygon features to compute.

Order Table Size: The depth range of the order table is subdivided into this many buckets.

Range
1 - 32767
Default
32 Suggested Value: The smallest value that continues to sort properly.

Order Table Range Update Determines when the depth-range of the order table is updated.

Possible Values: Preset, Each Frame, Once
Default
Once Suggested Value: Once Comments: Currently, Each Frame and Once map to Each Frame due to a crash bug in BRender. I do not recomment using Preset.

Order Table Depth Value What depth value is assigned to the order table?

Possible Values: Min, Average, Max
Default
Max
Min
Sort the order table based on the minimum depth value of all of the polygons in the table. This (and max) are the 2nd fastest order table features to compute.
Average
Sort the order table based on the average depth of all of the polygons in the table. This is the slowest order table feature to compute.
Max
Sort the order table based on the maximum depth value of all of the polygons in the table. This (and min) are the 2nd fastest order table features to compute.

COMMON PAGE Z-SORT ATTRIBUTES

Has Order Table Does this object have an order table (true) or does it use the room's order table (false)? If set to false, all fields lists below are ignored.

Values
True, False
Default
False Suggested Value: False unless object is having sorting problems.

Sort Primitives Are the polygons in this table sorted (true) or unsorted (false). If false is chosen, all polygons are placed in the first bucket of the order table.

Values
True, False
Default
False Suggested Values: False for simple objects. True for complex objects.
Comments
Always try false in case it looks good enough.

Primitive Depth Value Determines which feature of each polygon is used to place it into an order table bucket.

Values
First Vertex, Min, Average, Max
Default
Max Suggested Value: Max Comments: First Vertex: Good for convex polygons (ex. pyramids, cubes, octahedrons.) Fastest polygon feature to compute.
Min
Sort polygon based on the minimum depth value (closest point). This (and max) are the 2nd fastest polygon features to compute.
Average
Sort polygon based on the average depth of a polygon's points. This is the slowest polygon feature to compute.
Max
Sort polygon based on the maximum depth value (farthest point). This (and min) are the 2nd fastest polygon features to compute.

Order Table Size The depth range of the order table is subdivided into this many buckets.

Range
1 - 32767
Default
1 Suggested Value: The smallest value that continues to sort properly.

Order Table Range Update Determines when the depth-range of the order table is updated.

Possible Values: Preset, Each Frame, Once
Default
Once Suggested Value: Once Comments: Currently, Each Frame and Once map to Each Frame due to a crash bug in BRender. I do not recomment using Preset.

Order Table Depth Value What depth value is assigned to the order table?

Possible Values: Min, Average, Max
Default
Max
Min
Sort the order table based on the minimum depth value of all of the polygons in the table. This (and max) are the 2nd fastest order table features to compute.
Average
Sort the order table based on the average depth of all of the polygons in the table. This is the slowest order table feature to compute.
Max
Sort the order table based on the maximum depth value of all of the polygons in the table. This (and min) are the 2nd fastest order table features to compute.

SAMPLE SETTINGS (These settings have worked for me, but your mileage may vary.)

Room: Sort Primitives True Primitive Depth Value Max Order Table Size 256 Order Table Range Update Once Order Table Depth Value Max

Velocity: Has Order Table True Sort Primitives True Primitive Depth Value Average Order Table Size 16 Order Table Range Update Each Frame Order Table Depth Value Min

Floor: Has Order Table True Sort Primitives False Primitive Depth Value Max Order Table Size 1 Order Table Range Update Once Order Table Depth Value Max

Single Sided Cube in middle of room: Has Order Table True Sort Primitives False Primitive Depth Value Max Order Table Size 1 Order Table Range Update Once Order Table Depth Value Max

### HOW TO BUILD YOUR MODELS TO MINIMISE Z-SORTING ARTEFACTS

• Use convex models where possible (avoid concave models).

• Avoid overlapping faces and intersecting polygons.

• If you want to place one model on top of another, it's good practice to cut out the overlaid portion that is not visible. For example, if you place a house on top of a landscape, you could cut out the rectangle at the bottom of the house.

• Avoid triangles that span the extent of the model. For example, artefacts occur when you have extremes in the size of triangles that are next to each other ( a long thin triangles surrounded by smaller ones).

• Manipulate the sort keys for the primitives and the order tables.

• Generally, the bigger the size of the order tables the better.

• Be aware of overflow of primitives, keeping in mind the extra primitives accumulated by clipping.
Topic revision: r1 - 12 Apr 2002, KevinSeghetti;
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback