Feb 14, 2012 at 6:33 AM
Edited Feb 14, 2012 at 6:39 AM
That looks like an issue with frustum culling calculation. Since that is not heightfield, but rather a triangle mesh shape, it would be calculating a bounding sphere for the entire physics shape and then comparing that to the camera frustum. Either the frustum
culling calculation is off, or the bounding sphere is inaccurate.
Where were you a month ago when I had a lot of time to work on this stuff? ;)
I feel bad now because I'm so busy as work, I want more time to investigate stuff like this.
The exact line where the bounding sphere for your terrain is compared against the view frustum is line 281 in RenderComponent.cs:
I would calculate the distance between the opposing corners of your terrain that are furthest apart. Unless you have an insanely high or low section in your terrain the opposing corners distance from each other will likely be almost equal to the bounding
sphere's diameter. You can then place a breakpoint on line 281 and see if your calculations match what the bounding sphere's diameter actually reports to be.
I'm not entirely sure how the bounding sphere would be incorrect, it takes into account ever vertex in the render mesh, and accounts for scale of the mesh as well, when calcuating the bounding radius. This is done in LoadModel() and ProcessBoundingRadius(),
both also within RenderComponent.cs. Unless you've changed the scale after the initial loading of the render component, that might be able to cause something like this.
I will put a bounding radius renderer on the list for the next version, it would be helpful when debugging issues like these, and it should be easy enough since we already render sphere for physics shapes.