Spydave's Dynamic Occluders tutorial

Lithtech Jupiter engine
Post Reply
User avatar
Spawn
Admin
Admin
Posts: 1122
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Spydave's Dynamic Occluders tutorial

Post by Spawn » Tue Dec 18, 2018 4:23 am

Dynamic Occluders …

Image


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.

Image

Occluders are single sided geometry and all single side geometry is created in geometry edit mode. Just click on the tool bar here:

Image

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).

Image

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.

Image

Now let's run it and see what we have in game.

Image

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.

Image

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!

Image

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.

Image

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.

Image

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.

Image

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.

Image

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:

Image

A few steps further and we're outside the dynamic occluder volume:

Image


Example 2 (Courtesy of FatWeiner)

OK so I think Dynamic Occluders are all that, but let's get a second opinion shall 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!

Image


Everything looks good right? Now let's see what happens when Fats adds the traditional static occluder

(Reposted from Spydave.com)
Image

Post Reply