Dynamic Occluders …
As the name implies they're occluders and they’re dynamic!!!
But how dynamic are they? And what separates them from plain old regular
occluders?
Occluders are good if they’re place where they’re not seen (behind walls, under
floors, over ceilings). Basically anywhere behind your level’s geometry where it
can't be seen by the player.
Occluders are single sided geometry and all single side geometry is created in
geometry edit mode. Just click on the tool bar here:
Or use the hotkeys: Ctrl + G to activate geometry edit mode. You plot out shapes
in geometry edit mode the same as you do with Brush edit ... only difference is
instead of getting a 3 dimensional shape; you create a flat plane.
It's a good idea to actually use the occluder texture on occluders. The texture
it's self doesn't do anything, but it sure makes it easier as you're designing
your level when you can look at a brush labeled occluder and know right away
that's what it is! The texture is found in the main TEX folder.
Now after selecting the Occluder texture, simply draw out your shape(s) to make
up your occluders. Next we want to go into the properties of the occluder brush
and change the type to occluder. You'll notice also that I've set the Lighting
to Flat. Since the occluder is not going to be seen let's set it's lighting to
the lowest value (simply for performance reasons).
Now the theory behind occluders is ... the occluder(s) block visibility from the
player. The engine draws polys ahead of time to keep up with what you (the
player) sees. Even though you're in room A, the engine might (meaning probably
is) drawing room B (regardless if you can see it or not). Occluders tell the
engine to not draw what's behind them. Sounds great right? Well ... the engine
still has the final say so, and even in some places the engine feels it has to
draw what's past the occluders. Occluders are trial and error. Now, it's only
far to say that occluders WILL NOT save a levels that suffers from poor design!
Good design helps a level most of all, but even with good design practices you
might have area(s) where the frame rate is not as good as you would like, that's
when you'll want to experiment with occluders to try to improve those trouble
areas.
To show you how occluders work, I'm going to seal up my doorway with an occluder.
Now let's run it and see what we have in game.
If the occluder is visible by the player … well the results are not pretty. As
you can see, we can't see the other room. Instead we're presented by this black
non solid wall. Also, now would be a good time to mention that even though
occluders are single sided; the occluder works both ways. If we go into the
other room and turn to face the entrance the results are the same (black non
solid wall still there).
The occluders is doing it’s job (blocking visibility) … but, what a mess!!!
OK take the following scenario … say you need an occluder and it would work so
good in that doorway, but we can't place it there in plain sight … can we?
Yes we can!!! Thanks to our good friend the … (drum roll) DYNAMIC OCCLUDER!!!
OK, so far we've learned that an occluder has one state 'on'.
With the dynamic occluder we can create an occluder with two states off/on.
We have to set an area (volume) that tells the engine that while the player is
inside the volume the occluder is on. When the player is outside of the volume
then the occluder is in an off state. We do this by creating a brush that
occupies a area where the occluder would not be visible to the player (in this
case where they can't see through the doorway) and I usually make the height a
little larger than the ceiling height. That way there's some overflow past the
ceiling as well as the floor, just to ensure that the player can't leave the
volume space while they are inside it. When I create my brush I leave it
untextured. That is the convention used in the sample levels so I've adopted it
as well. Again that's just an easy way to identify and dynamic occluder volume
in the editor. To remove textures from brushes use the hotkey combo: ctrl +
shift + T.
With your volume selected right-click, choose Selection, Bind to Object and
scroll down to DynamicOccluderVolume, select it and hit OK. Now your brush is
bound to a DynamicOccluderVolume.
Unless you've got total recall you probably don't remember the name of your
occluder brush, so select the brush and take note of it's name. The occluder
brush itself NOT the DynamicOccluderVolume! Here you can see that mine is named
oc4.
Now select the DynamicOccluder object. You should see fields for listing
occluder names. Simply place the name(s) of any and all occluders that you want
to be active while the player is inside the volume. You can also place the names
of RenderGroups as well. What's render groups you ask? ... Select a brush in the
level, notice the RenderGroup setting? Default is set to 0, just change it to
whatever you wish and you've just created a render group that can also be added
to the dynamic occluder!
OK, let's compile and run what we have so far. Once we're in game we can now
(standing in front of the doorway) see straight into the next room ... even
though we know there's an occluder blocking the doorway! Since we are no longer
inside the DynamicOccluderVolume at the doorway entrance the occluder has
reverted into an 'off' state.
Now, just so you know that I'm not pulling the wool over your eyes, let's extend
the DynamicOccluderVolume to where it's in plain view of the doorway.
Now let's compile and run and see what we get. As you can see, We've got our
'black hole'* once again (since we are now standing inside the DynamicOccluderVolume in
front of the doorway.
Occluders can help improve performance, so knowing as much about them as you can
is a great asset. Still, like I mentioned before, even occluders can't save a
level from poor design. Don't count on occluders saving you from making poor
design judgments. Before the first brush is made in your level think strongly
on the layout your level will have with performance in mind. Build that level
then run through it with Fraps and if you see
a frame rate drop consider occluders.
Good luck!
Examples of Dynamic Occluder:
Example 1
Ok here we find ourselves in the hallway of my Office map.
At this spot we're inside a dynamic occluder volume. Now one problem here is, if the volume extended to the end of the hallway once the player is able to see through the open doors he/she will be confronted will the dreaded 'black hole'* effect. In order for that not to happen I stopped dynamic occluder volume short of the doors. To clarify, right here we're inside the dynamic occluder volume, but take a few steps forward and we'll be outside the dynamic occluder volume.
Here's a wireframe shot of what we see while inside the dynamic occluder volume:
A few steps further and we're outside the dynamic occluder volume:
Example 2 (Courtesy of FatWeiner)
OK so I think Dynamic Occluders are all that, but let's get a second opinion shay we? Let's see what Fats thought about our new friend the dynamic occluder!
Here's Fats looking at his level without any vis blocking (occluders) at all ... basically Fat's is viewing his level in the nude! ... Yeah I know, what a pervert! Still ... let's take a look ourselves!
Everything looks good right? Now let's see what happens when Fats adds the traditional static occluder. This example is using static occluders with openings in the occluder itself to allow for the doorways.
As you can see Fats has removed a substantial amount of polys here!
But, how much better could it be if not for those darn door openings? What if the occluder blocked off this section completely?
Well, enquiring minds like Fats have to know ... so he tried it!
Here Fats has a static occluder with no openings for the door. The occluder is a solid blocker completely covering the doorway. It's clear to see that the processor is spared even more polys are now! Unfortunately, this method is not adequate due to the 'black hole'* effect that will now be displayed due to the solid static occluder.
So now the question remains, "Can I achieve the same results I see with a static occluder by using a dynamic occluder"?
Well ... Fats asked himself the same question, and this was the answer he got in return ...
As you can see, the pictures are pretty much identical! And no, SPYDAVE and FatWeiner are not trying to pull the wool over your eyes! You can achieve the same great results as a completely sealed static occluder (and actually have it functional in your level) thanks to the dynamic occluder! Btw ... take a look at the frame rate difference my buddy Fats is getting with each method!
In closing ... A few words from FatWeiner on the subject of Dynamic Occluders!:
There is an advantage to using dynamic occluders. But I found you have to do
them a certain way to get the maximum effect. Things still show up that
shouldn't, and depending on what angle you're looking at it from affects what's
drawn and what's not.
As you can see, there appears to be no difference in static and dynamic
occluders when they're both set up to block all sides. But with static occluders
that wouldn't be practical, since doorways, windows, and other openings would
have the "black hole"* effect Dave mentions in his tutorial. If you cut holes
for doorways then the occluder becomes a lot less useful, as far more geometry
shows up. So it appears that using a dynamic occluder to block off all sides is
the way to go. Of course careful placement of the dynamic occluder volume is key
in order to prevent the "black hole"* effect from showing.
*The term 'black hole' effect copyrighted 2004 SPYDAVE Productions.