Hello dear UC-members,
I want to perform some visibility checking for a little OpenGL game i found. The reason why i don't post this in the OpenGL section is that I'm actually not looking for real source code, but rather a more general idea on how to accomplish Visibility checking.
My idea was to read out the depth value from the z-buffer (directly at the position of the players crosshair, witdth/2 height/2) and convert it into real distance, based on zFar and zNear given in the perspection matrix.
If the value is bigger or equal to the distance to the player clostest to the crosshair, the player is recognized as beeing visible.
This concept has quite a few disadvantages:
-the player would not be detected through some material one can shoot tbrough (i.e. water or leafes)
-the detection would be very inaccurate
Do you guys have any advice for a better method? Thanks in advance.
I want to perform some visibility checking for a little OpenGL game i found. The reason why i don't post this in the OpenGL section is that I'm actually not looking for real source code, but rather a more general idea on how to accomplish Visibility checking.
My idea was to read out the depth value from the z-buffer (directly at the position of the players crosshair, witdth/2 height/2) and convert it into real distance, based on zFar and zNear given in the perspection matrix.
If the value is bigger or equal to the distance to the player clostest to the crosshair, the player is recognized as beeing visible.
This concept has quite a few disadvantages:
-the player would not be detected through some material one can shoot tbrough (i.e. water or leafes)
-the detection would be very inaccurate
Do you guys have any advice for a better method? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire