To describe clearly that problem i need an image:
As you can see there a 9 tiles (hieghtmaps) lets focus on that one in the center.
Those tile are actualy separated 3d meshes/ (lets focus on that in the center)
I want to make shadowmapping, however to properly set light perspective i need to position the light itself not too far [and not too close) from the center of the mesh lets say the center point of a mesh is called CM.
so what i need to find is LightPosition = CM - LightDirection*distance <- yep i need the distance
there would be no problem if the light was placed on one of the axes, but however my light can be anywhere
so i drew an img showing what my problem is:P
So i can get the bounding box of the mesh but i have no idea how to project it to fit to the frustum