#Dynamic Occlusion Culling

1 messages · Page 1 of 1 (latest)

brittle sun
#

my game is a planet that rotates and revolves around a star and you can walk on the planet and explore. however, the biggest problem is the lag. just looking at the ground immediately lowers fps to 0.5 (normal is around 60) since all the surface scatters are still being rendered through the ground. an easy fix for this would be occlusion culling; however, since the occluder (planet) is moving, it's just not possible. i've also tried with occlusion areas but that didnt work either and i also tried implementing a "render distance" to the camera but then the moon and sun wouldnt be visible. any feedback would be greatly appreciated!

dusty cape
#

Are you taking advantage of LODs? (Levels of Detail). You should always be using a more simplified mesh if you still want it to be visible at a distance.

rapid swallow
#

Unity supports GPU Occlusion Culling through the resident drawer

#

which is dynamic

brittle sun
brittle sun
worthy geode
#

Planets tend to be predictable shapes, so it wouldn't be difficult to compare whether their renderer bounds are behind the planet origin and closer to the origin than the planet radius from the camera's point of view
GPU occlusion culling would take care of that though

#

It likely helps to split the planet surface into tile meshes, so parts of the planet can be culled individually and can have their own LODs too

brittle sun
worthy geode
brittle sun
dapper atlas
dapper atlas
#

In the simplest form, check if the target object bounding box is behind the planed bounding box relative to the camera. A naive solution would be to cast rays from the camera towards the object. And disable it, if the ray hits the planet.
There numerous optimizations that can be done, but that's beside the point.

brittle sun
brittle sun
#

okay i solved it with selective layer culling. i basically attatched this script to the camera to cull scatters that are too far away


public class renderDistance : MonoBehaviour
{
    // set render distance on setup
    void Start() {
        Camera camera = GetComponent<Camera>();
        float[] distances = new float[32]; // importing layers and other stuff
        distances[7] = 100f; // scatters layer (7) and render distance
        camera.layerCullDistances = distances;
    }


    // not used here
    void Update()
    {
        
    }
}
dapper atlas
#

Yep. That's a valid solution too. And it can be used with the other one too.