Im displaying a model which works fine most of the time, but occasionally when i change the position and direction of the camera, the model disapears:
I dont understand how this can be happening, two of those images are in very similar positions so i dont believe it is the lighting, what else could cause this kind of effect? What i have noticed is that when the model is in the upper third of the screen it seems to disapear
I would guess a bounding box issue is probably the cause. Or possibly occlusion - is the white square an occluder?
no the white box is simply some debugrenderer output so i have some frame of reference.
How could a boundingbox be an issue? being outside the camera clip range?
Yes. If the bounding box doesn’t actually contain all of the model for whatever reason and ends up outside the camera’s frustum then the model won’t display even though it should visually. Hopefully the import process got that correct, but it’s worth checking to see for problems like these.
So it turns out the model is not to blame, instead it is because i am using a large projection offset, almost half of my screen dimensions. The reason for this is that i am developing a projected reality application, and the projector (an inverse camera) calibration demands this offset.
Is there a way to get this to render anyway?
You did remember to divide by the viewport dimensions, right? From the documentation for SetProjectionOffset: “Set projection offset. It needs to be calculated as (offset in pixels) / (viewport dimensions.)”
Maybe you should check the far clip distance of the camera to make sure it is far than your model.
Both the distance and the projection offset are correct
I solved the issue by setting a separate cullCamera with a large FoV
Would you mind sharing the parameters you set for the camera? I’d like to look into the issue a bit more as your solution sounds more like a band-aid hiding the underlying issue (which probably works fine for your application, but it would be best to fix it if it is a bug).
141.693 -60.6896 -107.592
0.741284 -0.0941694 -0.664552 0.238699 0.962368 0.129889 0.627312 -0.254913 0.735866
Its the offsetY which seems to be the problem. Let me know if you need anything else
You should enable debug line to show model bounding box.
Also play with set far and near clip.
Use debug-draw to show your Octree as well. Assuming your type derives from Drawable add a debug-draw override to draw a line from itself to the center of it’s Octant.
Your mesh is being assigned to an Octant not in view.