And not just frustum culling and other auxilary stuff. The documentation should note this.
All the best,
Ozzy
And not just frustum culling and other auxilary stuff. The documentation should note this.
All the best,
Ozzy
Thanks for this. I was about ready to smash my head against my keyboard trying to figure out why my DrawMeshInstanced and DrawMeshInstancedIndirect calls were drawing at different locations.
This is really frustrating and I dont fully get why unity is doing it this way, but this post helped me fix my issue.
thanks
I agree, the documentation should note that the bounds position is causing a render position offset. It made world space boids simulating relative to a moving object very difficult.
I also found this, the bounds.center will be add to vertex’s world position, so unity whats us always use bounds center at Vector3.zero, but If this affect the frustum culling, the bounds shouldn’t be always center at Vector.zero, that’s confused.
thanks for posting this. i thought i was missing something.
So, does the bounds parameter affect the frustum culling or not?
If it does, as users, I’m assuming we’re supposed to pass the bounds properly, but re-localize our matrices by the opposite of the bounds center?
If it doesn’t, as users, then I guess we should just pass default bounds (zero)?
Can someone from Unity clarify this?
I have done the test could make sure that this bounds is used for frustum culling.
Cause I use GPU to do the whole culling so I just create a bounds with Vector.one size and put it in front of the camera every frame:
new Bounds(camera.transform.poisition + camera.transform.forward * (camera.nearClipPlane + 1.0f), Vector.one);
I plus 1.0f to nearClipPlane to make sure it won’t intersect with near plane
Thanks for chiming in, but I’m not sure I understand your reply.
In your tests, for DrawMeshInstancedIndirect, is the bounds parameter used for frustum culling or not?
What kind of test did you run to confirm?
Yes for frustum culling.
If the bounds you passed to DrawMeshInstancedIndirect it not inside the frustum, then Unity won’t draw it.
So I just create the bounds every frame and just make it always be the front of camera’s direction. Then it will never be culled.
But if you want the bounds is all instances’ bounds, then you might need to calculate by you self.