One of the most impressive visual features of Marvel’s Spider-Man 2 is the interior of buildings that you can see through windows. When Spider-Man looks into a window, you can see a realistic and detailed reflection of the interior of the building. The studio worked hard to get this right but you likely won’t see the same interior twice, but they’re actually coming from under the city.
We learned how this is done through an interview by Digital Foundry with Mike Fitzgerald, Director of Core Technology for Marvel’s Spider-Man 2. Insomniac Games uses a system of ray-tracing fake rooms that are buried underground in the city. This is to make sure they’re nearby to be called when needed. Each fake room has a basic layout and then different variations on furniture and characters.
When Spider-Man looks into a window, the game uses the ID of that window to randomly select one of the fake rooms to render. The game also casts rays back through the window to get a sense of the key light and shadows, which are then used to light the fake room. This system allows Insomniac to create realistic interior reflections, even for windows that are side-by-side. It also allows them to add details like animated ceiling fans and NPCs watching TV.
This is pretty cool and very smart because it helps the game load faster. The fake rooms are located underground in the city to save performance. The game only needs to render the fake rooms once, and then it can use them for all of the windows in the city. The rooms are not as detailed as the game world, but they are still good enough to create convincing reflections.
The team at Insomniac Games was able to achieve this by using simplified geometry and lighting for the fake rooms. The team also had to use a random selection of rooms for each window. This is because it would be excessively memory-intensive to render a unique fake room for every window in the game world.
This makes a lot of sense and is a really unique way to handle the situation. Insomniac Games is filled with visionaries, and this is one of the cooler ideas I’ve ever heard.