DIF/greater than 256 surfaces on an interior hull

From TDN

Introduction

This is a classic example of this error with two options on how to fix it.

Contents

The Error

The error you usually get looks something like this:


Fatal-ISV: (\Projects\TorqueSE\engine\interior\interior.cpp @ 1386) Error, > 256 surfaces on an interior hull


In this case this is the map that generated this error:


Image:cartshop_columns_building.png


The problem in this case is the interaction between the columns and the floor and ceiling blocks in this map. If you look at just one of the floor blocks and the columns from above you'll see it looks like this:


Image:cartshop_columns_building_cutaway.png


When the surface of that block is processed all the columns that touch it cut holes into that surface. When that occurs it fractures that one surface into hundreds of little surfaces. This causes more surfaces to be generated for that single brush than the DIF file format can handle.

Fixes

A Fix

So one fix that is sometimes appropriate is pre-splitting the offending brush surface. In your maps you could split it up even further, but in this case I took the floors and split them in half:

Image:cartshop_columns_building_fix1.png


Now this map will export. When we get it into Torque and set interior rendering mode #6 it looks like this:


Image:cartshop_columns_building_fix1_rm6.jpg


All those cuts in the surface are caused by those columns punching holes in it.

A Better Fix

So this map works, but there are some problems still. These little slivers of surfaces do not shadow well with the scene lighting. Even with a low light scale and a large lightmap border you'll get little spots where light pokes thru in your shadows. Also if this was a larger map the excess of triangles created on these fractured surfaces could start to cause performance problems. To correct this we go with another method, detail brushes.

When we set all our columns into detail brushes (or we can set the floors to detail brushes) and export we see the surface count in the export statistics drop from 1231 surfaces to 479. Looking at the DIF in Torque again we can see why:


Image:cartshop_columns_building_fix2_rm6.jpg

Detail brushes do not force intersecting brushes to split. In this case, the columns intersect with the floors, so if either the floors or columns are set to detail brushes, they will not split each other.

Conclusion

In the future the DIF format may change to remove this limitation, but for now you know the reason this error occurs and how to avoid it.