Don't Cull.

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1889
Joined: Sun Mar 08, 2009 5:25 am
x 36

Don't Cull.

Post by mkultra333 » Mon Jan 17, 2011 6:42 am

Ogre's automated culling of entities is a frequent source of pain to me. I often move things around via bones or even vertices, rather than at the entity level, but then Ogre starts culling stuff because it thinks the entity isn't visible.

For instance, I might have moved a bone controlled object to in front of the camera. But because the original entity BB, and maybe other bone controlled objects in that entity, are behind the camera, the object won't draw.

I got the same problem when I wanted to draw bullet marks via lots of little triangles. They're one batch, but they can be all over the place throughout the map. Ogre insisted on culling them whenever the original entity wasn't visible, even when I tried resetting the bounding box.

It'd be handy if you could deactivate automated culling for an entity. It's very annoying.

Edit: Just tried changing the bounding box of my mesh to solve the problem. Like for the splats, it doesn't work.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Re: Don't Cull.

Post by xavier » Mon Jan 17, 2011 5:14 pm

Have you tried setVisible() (available on both SceneNode and Entity)?
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1889
Joined: Sun Mar 08, 2009 5:25 am
x 36

Re: Don't Cull.

Post by mkultra333 » Mon Jan 17, 2011 5:36 pm

Would setVisible have an effect in this circumstance? Generally I leave everything as visible. Apart from a few special cases I never change the visibility, instead I make things vanish by removing their nodes, as I heard that was faster. I don't think I've setVisible(false) and then forgotten about it.

It's a bit weird, actually. Kojack has done some tests, and setting infinite bounding boxes works for him, but the same thing fails for me. Could be something in my code, but as best I can tell I've got the objects setup, visible, attached to a node and ready to render. But once their original BB is offscreen, they vanish.

It's no longer a pressing concern, I've got a workaround. But I still think a "Don't automatically cull this thing, ever" flag would be handy. At the very least it might illuminate something I'm doing wrong.
0 x
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Re: Don't Cull.

Post by xavier » Tue Jan 18, 2011 3:47 am

The only problem I see with that approach is that it sort of defeats the purpose of using a spatial partitioning scheme (i.e. octree). So let's say that top-level octant 3 is entirely off screen; Ogre has tested the view frustum against the extents of this octant and since the entire octant does not intersect the view frustum, Ogre ignores it. If you have an object in that otherwise-culled octant, Ogre would essentially have to test every object in the scene, which obviates the point of the octree in the first place.

I suppose it's possible to keep a top-level list of objects that "must always be rendered"...but I have a nagging feeling about keeping the list in sync...
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

LBDude
Gnome
Posts: 389
Joined: Mon Jul 26, 2010 10:53 pm

Re: Don't Cull.

Post by LBDude » Tue Jan 18, 2011 4:33 am

For your bullet mark problem, have you tried Instancing? From what I recall (well, it could be either the old instancing or the new instancing manager) as long as some of your entities are on screen, they won't be culled. Matter of fact, I don't think the old instancing system did any culling. The new instance manager does do culling, though.

Also, would making your bounding box bigger alleviate some of your problems?
0 x
My blog here.
Game twitter here

Post Reply