Game Development Community

Rene deserves a medal for the new Zones and Portals :)

by Paul Weston · in Torque 3D Professional · 07/07/2011 (8:05 am) · 20 replies

Just a quick shout-out to Rene and anyone else who worked on getting the zones and portals right for 1.1 Final.

Can't say enough about what this does for us... We now have the ability we've waited so long for - to be able to properly cull out areas that the player is not currently in, which totally solves all our performance issues.

Cannot believe we can now run around the entire Starship Enterprise, 24 decks high and as long as 3 football fields, with next to no performance issues whatsoever. Watching everything inside the zones disappear when we get the sizing just right is a great feeling, knowing that those objects will not be rendering when the player is many decks away in another part of the ship.

Well done Rene, your dedication to this issue is so much appreciated and makes a world of difference to us in terms of what we can put into our games. Following the same process with our Titanic game will result in another gigantic ship being able to be explored with no lag. The possibilities are endless now.

Thank you again, you have breathed new life into our efforts and given us the tools to really bring our large projects to life. Without this work you did, putting the entire Enterprise and Titanic into T3D could not be done.

Amazing job!

Cheers and kudos
Paul W.

#1
07/07/2011 (8:20 am)
++ to this

Rene really dug deep to work on the system and improve its capabilities. It's great to see comments from people putting it to good use.
#2
07/07/2011 (8:28 am)
Looking forward to the day (coming soon) when I can post a blog about the completed project, and all of you can download it and explore the Enterprise for yourselves... Everything we've done over the past two years to build this will be given away for free since we could not secure license rights to sell it. Our loss, but the fans' gain :) Pretty amazing ship, lots to see and do inside.

Titanic, our next project, will be our first commercial venture - hoping to have that done for the 100th anniversary of the sinking next year. We already have the entire hull done and all the deck floors in place, along with the Grand Staircase and the elevators so players can travel at will between the decks. There are several other versions of Titanic games out there, but all are mods for existing engines (Crysis, Virtual Sailor, etc). Ours will be the first completely explorable Titanic sold as a stand-alone game. Again, the zones and portals are what makes projects of this size possible.

Now we're having some serious fun :)

T3D FTW!
#3
07/07/2011 (9:50 am)
Wow... <reddens>... thanks Paul! It's very awesome to hear the new culling stuff is working out great for you and allows you to build the levels you want.

Already seen some bits of the Enterprise you've built and looking forward to walking around in this thing :)

Also, I'd be interested to hear of issues you came across. Stuff like where workflow was lacking or things didn't work as expected or pretty much anything else that you think could be improved or that you're missing with the current state of things.

Oh, and BTW, can I trade my medal for a couple boxes of beer instead? :)
#4
07/07/2011 (10:12 am)
yes, much kudos there Rene. Watching the videos on the end result was fantastic, and will certainly help with our project.
#5
07/07/2011 (2:57 pm)
Quote:
Rene deserves a medal
... or at least less spanking ... :P
#6
07/07/2011 (3:21 pm)
Steve, you bring the medal, i'll bring the staple gun :D
#7
07/07/2011 (6:16 pm)
Hehe, love the comments...

@Rene: All is well right now, we had various issues when trying to port the Enterprise over to 1.1 Final from 1.1 B3 but the show-stoppers have been resolved (QTwebkit, GuiObjectControl display, etc). The big one was the zones not working for us out-of-the-box, but that was because we were using the old interiors method of doing things, with DIFs for the floors and walls. Using the "Export interiors to Collada" option we converted everything to DAE, brought it back in, lined it up, and presto everything started to disappear inside the zones. They work exactly as you say they should in the videos, and are easy to reshape with the ConvexShape editor. Love it!

Guess the only thing we'd really like to see and have no ideas how to begin, would be to do more with water planes... For example, the T3D water looks amazing, and using a single water plane achieves a beautiful ocean look with next to no performance problems - however the water is NOT culled out at all anywhere which presents a problem for anyone wanting to build a ship and float it. I'm amazed that even no other engines I know of seem to have thought this out - if you put a 3D model of a boat into a water plane, the water goes right through it. There is no way to explore inside the boat without eventually encountering water inside as you get to the lower decks...

We are faking this out in our Titanic game by a simple trigger that disappears the water plane when a user gets below a certain level in the ship, so they don't see it inside. Works well enough. However, in a multiplayer scenario where one user is outside the ship and one is going deep down inside, things would be weird for the outside guy who would suddenly see the ocean disappear.

Brought this up in the forums a little while back and got some feelers, one suggested the trigger option which we had already thought of, and there was mention of modifying the zone code to handle that somehow, but again I would not know where to start.

Long-winded post I know, but you asked :) Seriously, whoever figures out how to have a ship sit in the water and have it cull the water inside from the scene while preserving the ocean outside, would be golden... I would also like to know if anyone has ever created a sort of boat vehicle class for Torque. We have cars, tanks, planes, hovercrafts, and now even the Galileo shuttlecraft :) But no boats that can move around in the water and actually float and be subject to physics, etc, just like the other vehicles? Not that we want to really drive our Titanic around, we will probably fake the movement through other means, but we have some nice tugs that it would be real neat to actually pilot around in the harbour as an option.

Anyhow, food for thought... Thanks again, I am back working on the zones again tonight and it's a lot of fun seeing this finally come together. Saucer done, neck done, moving on to the lower hull now.

Cheers!
P
#8
07/07/2011 (9:19 pm)
@Paul - you disable rendering of the waterplane on the client, so only the client who is below decks no longer renders it. All of the clients above it will still render it just fine.
#9
07/08/2011 (3:57 am)
For sure the new portals and zones are amazing. And with lighting control as well, awesome work.
#10
07/08/2011 (4:28 am)
See, realistically, what needs to get ported up(and ideally, integrated into T3D directly, like the existing occluder volumes) is this resource: http://www.garagegames.com/community/resources/view/14272

Set it up to work with any given object type(as it basically just spoofs the clipped view via the rendered view of the object, it should work with shaped 'clip' volumes like the occluder volumes now, and could be made to filter out water, terrain, etc.
This would let us get around the currently clunky remove/add holes functionality to the terrain as well.

I'd taken a quick stab at this a little while back, but I'm not familiar enough yet with the internals of T3D's rendering pipeline yet.
If someone else could do it, that would be simply astounding.
#11
07/11/2011 (10:24 am)
Hey again,

Rene - a couple of quick questions if you get a minute...

In the image below, you can see how using the zones has allowed us to completely disappear the entire ship when flying outside (except the shuttle bay, but that's by design for various reasons). This is good and is working well. I have most of the portals between decks (stairwells, etc) in place but have them hidden in this example to avoid extra objects cluttering the screen for now.

gambitrealm.com/installer/zones.jpg
(Yes, believe it or not folks, there is an entire starship hiding within those zones)

Am very happy so far, but am always looking to improve performance where I can. Noticed a few things:

1) Turning on the "MeshCulling" for the actual hull DTS that surrounds all these decks (hull is not visible here), seems to improve performance (could be my imagination though)... Is this the intended use of that flag?

2) The zones are set up so they extend partway into the floor and ceiling of each deck, and the zone above and below works the same way, in other words there is a thin strip of space between the zones, and I put portals to span that space wherever there is a stairwell, etc. But since each deck's walls are one large DTS (yes I know bad design but that's the way they were done originally), then any view of any point of the walls through any portal renders the entire deck's walls. Could I help this by placing an Occlusion Volume in the same space as the floor, so the floors effectively do additional occlusion? Or is this a stupid question?

3) As I have said, things are working as they should and performance is excellent, however I am just wondering if I am using all these features as best I can or whether there is a better way to do it. Because now that I have every single deck loaded and zoned, it is starting to slow down just a little. I have more portals to add still, and want to keep things running as quickly as possible. If you had to do this task, how would you be leveraging the various occlusion options? (MeshCulling in the Hull and Walls TSStatics, Zones, Occlusion Volumes, etc).

Basically my strategy was to create a single large horizontal zone for each deck (although some zones span two decks high because of the deck design, was easier to do a 2-deck zone in some places), so the saucer ends up being 9 zones high, the neck is 4 zones, and the lower hull another 9 zones. As I mentioned, I snugged them up as tight as I could while leaving a little space between. Then I put portals in at all the stairwells or open areas.

Just want to make sure I'm making the best use of all the new features. Love how it works now, but anything I can do to keep performance good on a medium-grade PC is very important to me.

Also wanted to know what happens if two zones end up overlapping? Do they just automatically become one zone in that case?

Thanks for any advice/insight you can provide.

Cheers,
P
#12
07/11/2011 (12:50 pm)
Quote:1) Turning on the "MeshCulling" for the actual hull DTS that surrounds all these decks (hull is not visible here), seems to improve performance (could be my imagination though)... Is this the intended use of that flag?
That is the intented use.

All it does is do per-mesh culling on the meshes within the DTS. For simple meshes like players or items or wepons this usually is not a win... the first per-SceneObject cull is good enough.

This is mostly helpful for large objects with lots of internal meshes. So this sounds like an ideal case.
#13
07/11/2011 (1:10 pm)
Makes sense, so it is doing something then :) I turned the flag on for each of the parts of the external hull, and also for each of the large decks, and performance seemed to get a bit better both when outside the hull and also when walking around inside...

Wondering how I can use the Occlusion Volumes in addition to all the zones and the MeshCulling to make things even better, anything I can do with those? Maybe put some in my floors (obviously not blocking stairwells where I have portals, etc) so that when I am on Deck 6 the deck 6 floor blocks out everything below me? Or are the zones my best bet and cannot be combined with Occlusion Volumes?

Sorry if any of these questions seem a bit obvious or ridiculous, just trying to get the correct info from the source so I'm making the best use of all the features :)

For fun, here's an updated image with all decks zoned now, and the hull in place:

gambitrealm.com/installer/zones2.jpg
Thanks again
P
#14
07/11/2011 (1:59 pm)
Regarding improvements or fixes, it would be great if occluders worked. Right now, they are broken and don't work as intended. Depending on the angle they occlude or not. Check this thread for references, plus some other shots:

www.garagegames.com/community/forums/viewthread/126724

img233.imageshack.us/img233/5216/issue01.jpg
img827.imageshack.us/img827/2051/issue02.jpg
img585.imageshack.us/img585/2831/issue03.jpg

Apart from this, it's a very cool job! :salute:
#15
07/11/2011 (2:42 pm)

@Paul

Quote:Guess the only thing we'd really like to see and have no ideas how to begin, would be to do more with water planes... For example, the T3D water looks amazing, and using a single water plane achieves a beautiful ocean look with next to no performance problems - however the water is NOT culled out at all anywhere which presents a problem for anyone wanting to build a ship and float it.

For the most, this isn't addressed by engines because it's really tough with the way water is handled currently--which amounts to little more than some trickery to model the surface and then some rendering tricks for alter stuff when the viewpoint submerged. It is really difficult to punch arbitrarily shaped holes into this kind of visualization.

I guess this will change as water simulation becomes more sophisticated. There's already some pretty stunning stuff happening there (in Hydrophobia, for example).

@Jeff
Only taken a quick look, but this seems to be about punching holes into the terrain through a separate
object. This is quite different from the stuff here which solely addresses scene render optimization.

@Paul

Quote:2) The zones are set up so they extend partway into the floor and ceiling of each deck, and the zone above and below works the same way, in other words there is a thin strip of space between the zones, and I put portals to span that space wherever there is a stairwell, etc. But since each deck's walls are one large DTS (yes I know bad design but that's the way they were done originally), then any view of any point of the walls through any portal renders the entire deck's walls. Could I help this by placing an Occlusion Volume in the same space as the floor, so the floors effectively do additional occlusion? Or is this a stupid question?

No, not at all.

The problem is that culling exclusively works on the object level--it will never break apart what's within an object (the only exception are special objects like terrains and such). So, to get good results from zones and from occluders, the geometry must be broken apart reasonably.

As I assume that in your case, all these model that make up the ship's hull and floors are actually unique and not tiles you are reusing over and over, these would ideally have to be broken up such that parts can be
culled out.

Quote:3) As I have said, things are working as they should and performance is excellent, however I am just wondering if I am using all these features as best I can or whether there is a better way to do it. Because now that I have every single deck loaded and zoned, it is starting to slow down just a little. I have more portals to add still, and want to keep things running as quickly as possible. If you had to do this task, how would you be leveraging the various occlusion options? (MeshCulling in the Hull and Walls TSStatics, Zones, Occlusion Volumes, etc).

I'd probably load up the models that make up the hull, walls, and floors into a 3D package and knife them up. Also, since it was exported from DIF, I'd run an optimizer over the mesh to clean up any damage resulting from the export process. With this done, performance should be pretty optimal with a mostly indoor level such as this.

Occluders wouldn't be too useful here. They are primarily for outdoors where zones can't help to chop up stuff.
#16
07/11/2011 (2:43 pm)
Quote:Basically my strategy was to create a single large horizontal zone for each deck (although some zones span two decks high because of the deck design, was easier to do a 2-deck zone in some places), so the saucer ends up being 9 zones high, the neck is 4 zones, and the lower hull another 9 zones. As I mentioned, I snugged them up as tight as I could while leaving a little space between. Then I put portals in at all the stairwells or open areas.

A pretty solid strategy to strike a balance between time spent on zoning stuff up and render efficiency. Given that you probably have walls within each deck too, it'd probably be more optimal to also zone up each deck further and not have one single zone for the entire deck, but if performance is already good enough, there is no reason whatsoever to go further and spent more time there.

Quote:Also wanted to know what happens if two zones end up overlapping?

Nothing by default. Zones will stay separate from each other except you set the "zoneGroup" property to explicitly override that behavior and cause things to join. So, in short, don't worry about overlap too much.

One tricky case is where overlap is such that the viewer can actually be in two or more zones at the same time. In this case, the renderer just picks one zone and starts from there based on the assumption that if zoning is set up correctly, visibility from any point within a zone must be correct. Just something to watch out for when zones start penetrating.

Quote:Wondering how I can use the Occlusion Volumes in addition to all the zones and the MeshCulling to make things even better, anything I can do with those?

Unfortunately, that won't work in the current code. The TS mesh code still only uses the root frustum for culling and doesn't use the scene's culling state. This means that occluders won't have any effect on individual meshes within an object.

Quote:Or are the zones my best bet and cannot be combined with Occlusion Volumes?

They can be combined. In general, though, occluders only start to make sense when there is a lot of stuff behind them that they can cull, i.e. occluders need high depth complexity. If you have that, though, they can help.

Again, be aware, though, that this only works with individual objects.

@Oscar
What you are seeing here is silhouette extraction breaking down--probably because planes from the occluder have started penetrating into the frustum. This is something that definitely can be improved and made more robust. In general, this starts happening when you are very near to the occluder.
#17
07/11/2011 (2:51 pm)
@Oscar
This is for Age of Decadence, right? In all shots I've seen so far, the camera was point mostly top down (not straight but still), so I'm not sure how much occluders will help you. Usually, occluders need stuff behind them since that's the only thing they will affect. However, when looking top down, there's usually little depth complexity and thus little room for the occluders to do much.

Also, from a culling perspective, a top down game where pretty much everything happens along one or two horizontal planes is pretty much ideal already. A default box query against the grid-based container will usually already result in a pretty close approximation of the visible objects.

The only thing where I could see zones&portals and occluders as potentially useful in these games is to help with lighting--though even there, I wouldn't expect huge savings from them.
#18
07/11/2011 (3:36 pm)
Hey Rene,

I'm aware the actual function of the resource is different, I was referring to using it to approach the other side of culling objects, such as what we were talking about with culling water out where the boat is submerged, and only there.
The reason I'd made the parallel to the occluders, is the Clip/Occluder would definitely benefit from being able to piggyback off the arbitrary convex shapes that the zones/occluders can currently ride off of. Being able to hammer out the basic shape of the hull in a convex, and then mounting it to a boat and having it clip the water so you don't have to resort to extra render trickery(which gets very hard to pull off if you wanted to do near-waterline windows on something like the titanic). It "just works".
This would also streamline stuff like underground entrances and the like by having terrain hooks as well.

So you'd have a straight Occluder for optimization, and then a Clipper for select-purpose occlusion for gameplay/direct rendering functionality.
I may be the only one, but this seems like a very valid investment, functionality-wise.
#19
07/11/2011 (4:50 pm)
Wow, what Reno said :) Read my mind... Maybe somebody will bite, you never know. Especially if this is not done anywhere else then T3D could really have another big selling point to it if it dealt with water in this way...

Rene and Tom - many thanks for the quick and detailed replies, it's great to be able to have this dialogue and get these answers so quickly... I'm going to ask Brian to chop up the deck models for me a bit so they can be occluded in chunks, I think that will help in many ways. I'd do it myself but he's the art guy, I don't have the tools or the eye for that end of things, although I'm trying to learn what I can :)

All in all though, given the state of our existing models, things run quite nicely on my mid-range laptop so that's really encouraging. Especially when flying around outside, there's next to no lag even with all 24 decks loaded!

Thanks again,
P
#20
07/11/2011 (4:56 pm)
Quote:@Oscar
This is for Age of Decadence, right? In all shots I've seen so far, the camera was point mostly top down (not straight but still), so I'm not sure how much occluders will help you. Usually, occluders need stuff behind them since that's the only thing they will affect. However, when looking top down, there's usually little depth complexity and thus little room for the occluders to do much.

Also, from a culling perspective, a top down game where pretty much everything happens along one or two horizontal planes is pretty much ideal already. A default box query against the grid-based container will usually already result in a pretty close approximation of the visible objects.

The only thing where I could see zones&portals and occluders as potentially useful in these games is to help with lighting--though even there, I wouldn't expect huge savings from them.

Yeah, that's right. I wanted to use them for separating "areas" in the same level. Right now, we have different locations in the same level, behind black walls, I want to occlude what's behind them (the whole town, for example, like in the shot in the bug thread). I'll post a pic of what I mean when I get home.

EDIT: About the camera, is between 45º and 90º. Polycount and drawcalls can get fairly high, but yeah, not many things will be occluded.

About the pic, here you go!

img807.imageshack.us/img807/7923/levelseparation.jpg