My use case is the following. Recently my artists started placing debris in our levels, broken bricks pieces of concrete rocks etc. now they render pretty great with the GRD, but I would like to not have 10k+ gameObjects in the scene so I would like to bake out their positions and render them with a InstancedIndirect call. However I can only do frustum culling with this and the nature of our levels is such that actual occlusion culling would tremendously benefit the rendering of such debris. So my question is if it is possible to somehow hook into the gpu occlusion system and get results from it in order to control what gets rendered from the instanced indirect calls.
#Hooking into the gpu occlusion system
1 messages · Page 1 of 1 (latest)
Hey! So not answering the question directly because I would be curious to know what is the actual problem with that
but I would like to not have 10k+ gameObjects in the scene
Scene loading time maybe? GRD will do the kind of baking you mention automatically and disable the MeshRenderer components already. So I don't think you would get better runtime perfs at least
Scene loading is a major part of my problem yes.
Right then that's a bit tricky. I'm not sure there is an easy way to do that currently. Occlusion culling compute shaders only work with instances managed by GRD, and there is no way to inject custom instances to GRD from the outside right now
GRD batches up to 64 objects in the same draw command right ? Rendering the debris with a instanced indirect call would be faster ?
When using GRD & GPU occlusion culling normally, instances are already rendered with instanced indirect draws. So you shouldn't get faster than this by using custom source data
Like I said, runtime perfs should be the same
If you really want that, I think you would need to fork the SRP core package and add some public APIs to inject custom data to GRD. There is no built-in support for this yet
I really hate forking the srp packages. When you say “yet” does this mean that it is planned for the future ?
I guess the public api would have to handle expanding the instances array, registering the mesh, writing the metadata etc etc that BRG needs right?
Anyways being able to inject custom rendering data into the GRD would be a great feature.
It's kind of planned for U7. But depending on the demand I think it could be doable to port that to U6
Cool. And one more question kinda related to this, I was gonna post it seperate but I can’t now. Right now we use the culling group api to disable environmental vfx that are not visible. Any way to do this with the gpu occlusion? Or if we bake umbra as well how does that work with the gpu occlusion?
No, much simpler than that actually. You would just need to add a bridge to the point in the code where GRD does GO -> internal data conversation. You can look at what ProcessRenderers does in GPUResidentDrawer.cs
Thanks for the pointer.
So you mean disable vfx that are occluded ?
I'm not sure honestly. GRD occlusion culling is not connected with vfx graph at all. And I don't know how customizable the vfx API is in this regard. In theory you would need to customize the vfx indirect draws to take into account the occlusion buffer. But there might not be an easy way to do that right now
Regarding Umbra, I think vfx occlusion culling is just not supported
Would need a vfx person to confirm those things
Oh like I said we use the culling group API to determine if a vfx object is visible or not.
But again feeding the bounding spheres into the gpu occlusion and then getting a readback to disable the whole vfx sounds like it is impossible
Yeah, I think the culling group customization point is before the frame starts to be rendered on the GPU. And GPU occlusion buffer is computed after that
But do you think there is a problem to bake umbra in the scene to keep using this culling for the vfx while the scene geometry renders and culls with GRD ?
No that should be fine. I don't think Umbra interacts with vfx in any way, but that would need to be verified. Not 100% sure
I was more worried of umbra interfering with the grd
Should be fine too. Umbra doesn't interact with GRD