General Category > In Case Of Emergency, Release Raptor

Volumetric Lights And Custom Frustrum Culling

(1/2) > >>


What!?  Shouldn't this post be about procedural generation or new robots? ;)  That stuff is coming, don't worry.  As you can see in the release notes, a lot of work has been done on that.  But in the meantime I did want to do a release with a few other things in it.

Volumetric Lighting

First up, we're now using the brand-spanking-new Hx Volumetric Lighting component from Hitbox Team, the folks behind Dustforce and the upcoming Spire.  I figure I owe them some shout-outs there, because their work on the volumetric lighting is so freaking fantastic.

It has a moderate impact on framerate, depending on your graphics card.  For a lot of lower-end cards you'll need to turn it off.  But for folks running on middle-high or high-end rigs, this is something that really takes the game to the next level visually.

This is something I've wanted to do for quite some time, to give more of a sense of atmosphere to the game.  However, short of particle effects that can look iffy, and a few light-specific options that usually have iffy performance, there's been no good way to do that until now.

Anyway, so, that's neat.  That will make for some nice differences in the next round of videos, so I'm pleased to get that in now.

Obviously this is an effect that is not to be used on every last freaking light in the game -- sometimes it's really nice to have crystal clear areas that just pop with sharpness.  Other times you want a slight bit of softness, and other times you want something that's super foggy.  The point isn't that we're switching over to deep fog all over the place, but that we now have a greater depth of mood effects we can go for.

The screenshots in this post are really leaning on higher-volumetric views, though, since that's what is new; the non-volumetric views don't look any different.  Oh!  And if you hate it, you can always turn it completely off.  So, as with all things, tune to taste.

Custom Frustrum Culling

Occlusion culling is a complicated subject, particularly in games that are partly or completely procedurally-generated.  What it means is not rendering things that the camera can't see.  The biggest problem is knowing what is behind other opaque stuff and thus invisible.

Unity has some built-in support, but only for static levels, not procedurally-generated ones.  I created my own occlusion culling system that works on procedurally-generated levels, but the levels have to be designed with the occlusion system in mind or else it doesn't work to full effect.

However, there's also a middle-tier of object culling that is based around the "view frustrum."  Aka, the view out of your camera based on where it is pointed right now and what your FOV is, etc.  Put another way, it's to avoid drawing things that are either offscreen to your side or behind you.

Unity has a built-in way of handling this, too, and I had -- until now -- not bothered to create my own.  I'm not in the habit of trying to reinvent the wheel for no reason.  However, I found that unity's solution has some really strange issues with false-negatives when the camera gets close to a wall.  Basically it would stop drawing certain objects that were straight in front of me once my camera got a bit close to the wall behind it.

Imagine having your head leaning back against a wall, and the wall on the other side of the room in front of you mysteriously disappears.  Um... no thanks on that.

Apparently with any of Unity's occlusion culling on at all, it was trying to do a mixture of occlusion culling (what is behind something else should not draw) and frustrum culling (what is out of my view should not draw).  And when I got really close to a wall with the camera, it decided "oh hey, you must be on the other side of that wall."

I've known about this for well over a month, and I figured that the solution was to get the camera to stay a bit further from the walls.  Turns out... nope!  That doesn't work in any way that I can figure out.  I thought that it perhaps was related to concave mesh colliders, but nope there too!  I was really surprised, because I thought for sure that was the one.

I had turned off unity's occlusion culling a few weeks ago because of the graphical errors it was introducing, but then performance took a big hit and so I turned it back on.  Now the graphical errors were getting on my nerves increasingly, so I decided to once again disable their system, and this time come up with my own frustrum culling system.

So I did.  It works!  No false negatives.  It seems to have a very similar performance profile to what unity's system did, but minus the errors.  Knock on wood that's what others also experience with it!

so I suppose this frustum culling as you call it will improve its performance? you'll certainly get no complaints from me there.
although ill probably end up turning those volumetrics off asides from the performance issues that looks like it'll be really disorientating to me during play.

Yep, frustrum culling is 100% about performance.

Looks really neat!

Thank you!


[0] Message Index

[#] Next page

Go to full version