Game Development Community

Need help with culling

by Manoel Neto · in Torque Game Engine · 12/20/2005 (4:47 am) · 5 replies

I am having some problems regarding culling.

I modifyied the player::getEyeTransform() and player::getRenderEyeTransform() so the eye node transform is also taken in account. In our game we need the character to look sideways without rotating the body (the head turning is animation-controlled).

The problem is that the player gets culled out as soon as the eye node rotates to the side. So the weapons and any other mounted images simply disappear (even the nodes that use the eye offset and should follow the eye node all the time). I tried using a massive bounding box for the player, but it didn't help. There is some sort of camera-angle-based culling, but I can't figure out where it's happening.

This annoying glitch is making me crazy, and right now I am using a GuiObjectView layered on top of the playGui to render the weapon. It looks weird and it rather troublesome, since the GuiObjectView doesn't react to the level lighting.

#1
12/20/2005 (8:38 pm)
This is pretty wild. Are you sure your view frustrum etc to the scenegraph are correct? Have you tried hardcoding mounted objects on the control object to always render?
#2
12/21/2005 (5:03 pm)
I'm using a mounted image. The thing is that the object itself is not getting rendered, so anything mounted on it also disappear. Where should I look to hardcode an object as always visible? Maybe I can get around the issue by making the control object aways render.
#3
12/21/2005 (9:21 pm)
In 1.4 there's a handy method you can call to make an object always render. (setAlwaysVisible, I think? Dig around, you'll find it.) Just call in the constructor and you'll be set.

This seems like it might be a symptom of a deeper problem so if you possibly could I'd suggest figuring out why it's getting called. The only "camera angle" culling that happens is the view frustrum, which ought to detect a box properly if it's inside of it.
#4
12/22/2005 (5:29 am)
This project is still done with 1.3 (we're almost done with it). I got a few other issues to sort out, but I'll do a debug in an empty mission and check where the player is get culled out.

The interesting thing is that simply placing another camera at the same place as the player's eyes and looking through it doesn't cull the player. It only happens when using $firstPerson = true.
#5
01/10/2006 (5:28 am)
It's been a while, but I sorted it out.

It was due to the player's box center being culled out by the clipping planes when the camera was looking sideways. This happened in both SceneState::isObjectRendered and in PotentialRenderList::insertObject.

I couldn't find out why this only happens when using $firstPerson, and not manually placing another camera in there (probably something to do with the scaling being propagated to the view matrix somehow), but I solved it by implemengint a mRenderAlways flat in scene objects and making both of those functions skip the clip planes test for renderAlways objects. All I need is call a console method when I need the player culling disabled.