Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#Actualcsisy

Posted 30 June 2012 - 12:23 PM

I render the shadowmap to the screen, and it looks like the sphereBounds was too "small". And I find the problem, I was stupid Posted Image
When I computed the sphere's center, I get the radius from the d(center, corners[0]), which is the near-left-bottom corner of the frustum. The correct is the d(corners[0], corners[6]), where the 6th corner is the far-right-top corner.

sphereBounds = Vector3::Distance(frustumCorners[0], frustumCorners[6]);
sphereRadius = sphereBounds * 0.5f;

Now, it works really good. Thanks for your help, the topic is solved (for me).

Ps.:
Can I set the topic to solved state, or set your post as a solution?

EDIT:
I have to use another little hardcoded thing:
sphereBounds = Vector3::Distance(frustumCorners[0], frustumCorners[6]) + 5.0f;
because the camera sees the scene from top, and the sphereBounds wasn't big enough.

#1csisy

Posted 30 June 2012 - 12:12 PM

I render the shadowmap to the screen, and it looks like the sphereBounds were too "small". And I find the problem, I was stupid :)
When I computed the sphere's center, I get the radius from the d(center, corners[0]), which is the near-left-bottom corner of the frustum. The correct is the d(corners[0], corners[6]), where the 6th corner is the far-right-top corner.

sphereBounds = Vector3::Distance(frustumCorners[0], frustumCorners[6]);
sphereRadius = sphereBounds * 0.5f;

Now, it works really good. Thanks for your help, the topic is solved (for me).

Ps.:
Can I set the topic to solved state, or set your post as a solution?

PARTNERS