Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
January 23, 2017
arrowPress Releases

If you enjoy reading this site, you might also want to check out these UBM Tech sites:

"Invisible" shadows?
by Patrick Purcell on 04/22/13 12:00:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.


So, I’ve decided that for the final piece thing to add to my two player time travel experiment is a visible shadow for the other player’s phantom.  As of right now, I am rendering both player’s POV to render targets using a DrawManager3D, as simply as it is named, its responsibility is to hold onto a list of meshes and render them onto a render target using a particular effect.  Meshes can “override” this effect to use one of their choosing if so desired.  The render target can then be drawn to the screen, with post processing if desired.

Currently both players have a camera and a draw manager associated with them.  Each player’s draw manager is holding onto a mesh for self, a mesh for the other player’s current position, and a mesh for the other player’s phantom.  During each player’s update, their phantom of the other player is set to the other player’s real-time position, and the mesh that represents the “real” player is set to the recorded position, yaw, and pitch, that the other player recorded at the time stamp that our rendering player is at.  It is not terribly efficient to deal with the rendering in this fashion, but it is easy to manage and suits the purpose of this project.  Typically I have been using multiple draw managers to allow layers that have opposing depths to be drawn on top of each other

What I am doing for the final addition to the project is setting up a rudimentary lighting system that will have 1 directional light that will cause meshes to cast shadows in the environment.  I will set up the system so that each player will see a visible mesh for the other player’s position, yaw, and pitch, but will see only the other player’s phantom’s shadow.


From the perspective of one draw manager, I will need to draw the scene the same way that I am right now while keeping a depth texture around for another draw call that will draw the same scene without the other player’s phantom, but drawing the shadow using a Z-fail test.

Once this is done for each draw manager, then I will need to push both render targets to the screen scaling them down as I am presently.  Aside from this experiment, I think that if this technique has some very interesting potential uses in games.

Related Jobs

Crate Entertainment
Crate Entertainment — Boston Area (work remotely), Massachusetts, United States

Graphics / Engine Programmer
Cryptic Studios
Cryptic Studios — Los Gatos, California, United States

Software Engineer (all levels)
Cignition — Palo Alto, California, United States

Gameplay Programmer
Insomniac Games
Insomniac Games — Burbank, California, United States

Senior Gameplay Programmer

Loading Comments

loader image