Is there any way to check if a part is occluded using the new Occlusion Culling feature?

Hello!
It would be super beneficial for me to know when a part is being occluded in my game.
Does the new occlusion culling API have a way to check if an object is occluded or not?
I was unable to find any docs regarding it.
Any input is appreciated.

1 Like

go into studio, enable wireframe view

no​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

1 Like

what do you mean by β€œno”? that’s how you check if a part is occluded

You didn’t understand my question.
I’m talking about a property like:
Occluded =true/false or something like that.

There’s no way and no need to use that. Only thing this needed for is for optimization.

try line of sight with the part, and if no line of sight, it’s probably occluded and you can do whatever function

You could just use WorldToViewportPoint to check if that part is on screen, and use GetPartsObscuringTarget to see if there is anything obscuring the part.

Occlusion Culling works pretty similar to that I think

Exactly, I have some custom effects that I only want to be calculated when on screen.

I guess but for my use case I would need to run this on like 200 different instances each frame. It’s too expensive.

it won’t show custom effects if you can’t see them

I’m doing calculations on those effects. That’s why I would like a value that says true or false whether the part is occluded or not. That would allow me to stop unecessary calculations.

I ran into a case where i also need to be able to check if a part is occluded via code, i’ve made systems in the past to do this but its quite expensive. It’s kinda funny to me they didn’t just add a boolean to check this.

for my solution, you’d just be stuck with running raycast operations or what Encaptor said by using WorldToViewportPoint and GetPartsObscuringTarget. I do recommend running these things in parallel to minimize impact on performance (if you can).