"Invisible" shadows?
Adding a shadow feature to the experiment
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.
meAndMyShadow
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.
Read more about:
BlogsAbout the Author
You May Also Like