• Advertisement
Sign in to follow this  

Game seeing through objects.

This topic is 4687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm curious how do games make it possible that you will always see the player. Like in a 3D the player might be really close to a building and the camera is positioned a bit south west of the player. But instead of the object blocking the view it becomes transparent. And on some 2D games mainly RPG. The character might walk close to a building whose roof extend over the boundry of the house but instead of the room tile hiding the view of the player it just becomes see through or just outlined so the player can still see the character. If anyone has any idea how that is accomplished, some articles anything that would be great. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
In the case of a 3D game, it can occur naturally as a side-effect of polygons being one-sided. It is possible to cull what are called back-facing polygons, or polygons which face away from the view. If the camera slides behind one of these, it won't be drawn and the remaining polygons of the building the camera is inside may be culled on z value.

In the case of 2D games, or 3D situations similar to what you face in 2D (ie, camera not necessarily inside an object), you need to explicitly program the fading or transparency, rather than just exploiting a natural side effect. The alpha channel is good for this; if you set the alpha value of an image or texture to 0, it is not drawn. You can iteratively 'fade' from full alpha (1) to no alpha (0) to get a slow fading out effect as the occluding object goes to transparent. What objects you fade and how you accomplish the fading is so closely tied to how your map is represented and how you are drawing your graphics, that a more detailed explanation is not really practical.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement