ackle
November 17, 2025, 9:13am
1
Given that the engine performs frustum culling internally, would it be possible to expose the frustum-testing code in the API? This would be useful for manually skipping computations for GOs that are outside the view. I can make a feature request on GitHub if there are no objections.
britzl
November 17, 2025, 9:48am
2
Something similar to this maybe?
opened 10:38AM - 03 May 23 UTC
feature request
engine
render
**Is your feature request related to a problem? Please describe (REQUIRED):**
S… ome time ago, frustum culling was added to the engine. But it is only internally used by the rendering system to skip rendering geometry that is outside the view.
It will be useful to expose some functions from the frustum culling subsystem into Lua to check the visibility of the geometry to use this in game logic.
How we use this in our next game: we stop and start particle fx if it's out of range. This gives a performance boost as our effect animates ~1000 particles to show players a "poisoned" area (there are could be 10+ of them on the game map). So, the main point is to optimise and offload the CPU from unnecessary calculations.
_(off topic: is it worth to pause the skeletal animation that's behind the camera view?)_
**Describe the solution you'd like (REQUIRED):**
Add built-in functions to set frustum and to check visibility. Something like that:
```lua
model.frustum_set(proj_view_matrix)
model.frustum_test(aabb_min, aabb_max) -- Returns 'false' if the bounding box is off the frustum.
```
**Describe alternatives you've considered (REQUIRED):**
Before frustum culling introduced in Defold, I had implemented it in Scene3D by checking aabb visibility and switching meshes off and on. Now I use the same functions but for Lua logic, as Defold doesn't have its own built-in Lua API:
```lua
scene3d.frustum_set(proj_view_matrix)
scene3d.frustum_is_box_visible(min_vector3, max_vector3) -- returns true/false
```
2 Likes
ackle
November 17, 2025, 10:21am
3
Oh yeah, that’s exactly what I was thinking of. Thanks!