#Getting frustum culling information and use them to cull my own jobs

1 messages · Page 1 of 1 (latest)

long cave
#

while i am not completely sure, i think entites.graphics should have a job that determines visibility of entities. I’ve found Struct EntitiesGraphicsChunkInfo | Entities Graphics | 1.1.0-pre.3, but adding
[WithAll(typeof(EntitiesGraphicsChunkInfo))] to my job header, my job stops running.

i want to know if there’s an existing flag that tells me if i can frustum cull some entities so i can avoid running some of the expensive IK/animation i’m doing to offscreen entities.

fierce marsh
#

EntitiesGraphicsChunkInfo is a chunk component, not a normal component

long cave
#

Does it contain the culling information I can use?

fierce marsh
#

Probably not, just pointing out why it was breaking your jobs

#

If I recall it's not really possible, or at least easy, to get frustum info out from entities graphics

manic ravine
#

it's not possible because api does not expose these, correct

quick bramble
#

You can get very far by just grabbing the render bounds of whatever you're interested in and brute force comparing every single one to the culling planes of the camera using FrustumPlanes.Intersect2NoPartial

manic ravine
#

but that way you'd be doing 2x the work

quick bramble
#

Sure, but it's extremely cheap to compare the bounds with the planes, even for a couple of hundred if not thousand bounds.

#

Since there was only an interest in "some" entities it should be fine afaik

fierce marsh
#

Well the problem with using eg culling is you're a frame delayed as well, things coming into view won't be applied it can look odd

long cave
#

I see. Yeah implementing my own frustum culling seems to be easiest for me(I’m making a top down isometric game) and I can relax the frustum a bit to deal with entities coming into view

#

A bit disappointed, imagine if I can’t get the occlusion culling flags from the systems, rolling that would be much harder

slim pasture
#

Made my animation culling system from scratch exactly because of this. EG culling is performed just before rendering without any exposed properties (culling results are stored internally).

long cave
#

What’s EG stand for?

slim pasture
#

Entities.Graphics

long cave
#

Kk

long cave
#

is it better to use a visiblity flag or add/remove visibility tag component for this? my hypothesis is that if i add/remove components, the memory would be more compact, if the amount of visibility doesnt change too much from frame to frame it should be better.

quick bramble
#

Enableable component I would say. But it actually sorta depends on how often you expect this to happen. If it happens more than once per second I would go with enableable component

long cave
#

true, nothing beats profiling. but this is a good starting point.