Skip to content
Rules of Auto Cull and customized Cull Distance

Rules of Auto Cull and customized Cull Distance

It takes about 5 minutes to read this article

This article outlines the automatic cull rules preset by the editor and how to customize the cull distance of objects

1. Automatic culling rules

  • Definition of cull and cull distance: When an object's distance from camera exceeds a certain distance, the editor automatically culls the object from rendering in graphics, and this distance we call cull distance

  • The editor provides a set of preset auto-cull rules that take into account both screen performance and performance in most scenes. This set of preset auto-cull rules is calculated as follows: *The actual cull distance of an object in the game (in centimeters) = the default cull distance of the object (determined by object size) Picture quality rating factor

  • The object's default culling distance is determined by object size. The larger the object's surrounding sphere diameter, the further the default culling distance is. The default culling distance for each object can be viewed in each object's Scene Settings - grayed-out Customized culling distance. (The usage of customized culling distance is described later, which can be understood as the default culling distance if custom culling is not enabled.) This rule ensures that relatively large objects are not easily culled.

  • The graphics quality rating coefficient also has a fixed set of rules. The higher the Player's device performance rating, the greater the graphics quality rating coefficient (between 1.2 and 2, and the movie-grade graphics quality is 2), which is designed to give better-equipped Players a better experience

  • For example: if we have a default crop distance of 7500 for a static model (without enabling custom culls) based on its size, and Player devices have a graphics quality rating of 3 (corresponding graphics quality rating coefficient = 1.2):

    • then when experiencing the game on this device, the actual cull distance (cm) represented by this object = 7500 * 1.2 = 9000

2. How to customize cull distance

  • However, in order to satisfy some cases, more important objects will not be culled according to the above automatic cull rules even if they are far from the Player, then we can customize the cull distance of this object in the object's [Scene Settings]-[Enable Custom cull] and [Customize cull distance]

    • If [Enable custom cull] is not checked, the cull distance of the object will still be determined according to the previous logic, based on the fixed rules provided by the previous editor
    • If you check Enable custom cull, you can further customize the Custom cull distance for this object. The actual cull distance will still be multiplied by a factor based on the player's device, calculated as follows:
      • cull distance (cm) that an object actually performs in the game = Custom cull distance for that object * Picture quality rating factor
  • It is important to note that when objects are automatically merged by editor HLOD rules (Hierarchical Level of Detail), merged objects are still cropped at the default cull distance (by the overall enclosing sphere diameter after batching) without applying this customized crop distance

  • For example, if we check Enable custom culling for a static model and set Custom cull distance = 1000, and Player device graphics quality rating is 3 (corresponding graphics quality rating coefficient = 1.2):

    • then when experienced on this device, the actual cull distance (cm) represented by this object = 1000 * 1.2 = 1200
  • The method set in the script is as follows:

TypeScript
// Find the object requiring customized cull distance
let Obj1 = GameObject.findGameObjectById("B48CE402") as Model
// Set customized cull distance
Obj1.setCullDistance(1000);
// Turn off customized cull distance and enable automatic CullDistanceVolume
Obj1.setCullDistance (0);
// Find the object requiring customized cull distance
let Obj1 = GameObject.findGameObjectById("B48CE402") as Model
// Set customized cull distance
Obj1.setCullDistance(1000);
// Turn off customized cull distance and enable automatic CullDistanceVolume
Obj1.setCullDistance (0);