Game Development Community

[beta3 bug] Culling issues with multiple portals

by Manoel Neto · in Torque 3D Professional · 06/27/2009 (6:48 am) · 8 replies

I've been playing with zones portals, and found a bug: if you are inside a zone which contains two portals that connect to the outside and both of their bounding volumes are visible, objects not visible through the first portal are not rendered even if they are visible through the second portal as well.

Here's my test case:
i44.tinypic.com/f5b29.jpg

I added a copy of the tower to test the culling. Here, with only the upper portal (I deleted the bottom one), I can see the building outside as expected:
i44.tinypic.com/154a9fo.jpg


But if I re-add the portal at the bottom, it culls the building away, even if it can be seen through the top portal.
i39.tinypic.com/2w318k6.jpg

If I move the camera so the bottom portal's bounding volume is nowhere close to the frustum it the upper portal works as intended.

#1
06/29/2009 (11:59 am)
Logged as THREED-544
#2
07/02/2009 (1:17 pm)
Hey Manoel, do you think you could send me a mission file with your test case there? I'm sure what's happening is an issue with the zone traversal in scene root, but it'd be much easier to test with your mission than trying to reproduce it from scratch. You can send it to ross (AT) sickheadgames (DOT) com. Thanks!
#3
07/02/2009 (1:27 pm)
I won't be home until tomorrow at night, and even then I'm not sure if I actually saved that mission. Its the template mission, the only changes are:

- Created the zone and put it inside the station's west tower (the one whose doors face the sun).

- Created two portals, resized them as shown in the screenshots. The first one is at the bottom door, the 2nd one is on the top one.

- Made a copy of the station and moved it closer to the water block.
#4
07/02/2009 (1:49 pm)
Okay, that helps, thanks :)
#5
07/02/2009 (2:32 pm)
Okay, I think I've got the fix for this issue, coincidentally it fixes another issue other people were having.

Edit: The first // there isn't actually in the file as it exists now, it's simply there to stop the code block from not indenting the next line properly.

In sceneRoot.cpp, in SceneRoot::prepRenderImage(), change this
//
   _traverseZones( state );

   //  We don't return a render image, or any portals, but we do setup the zone 0
   //  rendering parameters.  We simply copy them from what is in the states baseZoneState
   //  structure, and mark the zone as rendered.

   // RLP/Sickhead NOTE:
   // The frustum for zone 0 is set up within
   // zone and/or portal traversal, so don't override it here!
   // state->getZoneStateNC( 0 ).frustum = state->getBaseZoneState().frustum;

to this:

//
   //  We don't return a render image, or any portals, but we do setup the zone 0
   //  rendering parameters.  We simply copy them from what is in the states baseZoneState
   //  structure, and mark the zone as rendered.
   state->getZoneStateNC( 0 ).frustum = state->getBaseZoneState().frustum;

   // RLP/Sickhead NOTE: Do the zone traversal after setting
   // the outside zone default frustum, otherwise
   // normal Interior rendering of portaled areas
   // will be borked!
   _traverseZones( state );
#6
07/02/2009 (2:44 pm)
Ah, nice catch. By the look of it, zoned Interiors were having culling oddities as well, right?
#7
07/02/2009 (2:48 pm)
Indeed, there were some issues with portals in interiors that it was causing.
#8
07/07/2009 (9:19 am)
The fix is confirmed to solve the issues with Interior portal rendering, and is now checked in.