I made a game! Buy on Steam

This article was updated. Jump to Update 1. Update 2.

I just noticed, that this window can not be seen through another window on the other side of the building:

Source: Infinity Nikki

My guess: It’s an optimization to save some polygons.

The back of the wall is most likely one huge quad (instead of at least four), but thanks to back-face culling, this quad does not block the view when we look inside the room.

Source: Infinity Nikki

But why can we still see the sun shining into the room? I assume they use only the front-faces for the shadow map calculation and with that, the sun ignores the big back-face quad.

๐ŸŒž

By the way, a little info-nugget about a game I worked on (Sacred 2):

For this game, back-faces were used for the shadow map calculation (also called “front-face culling“). One artifact of this is, that it’s possible to see small light leaks like this:

Source: Sacred 2

A reason for using back-faces for the shadow map: it fixes the so-called “peter panning” (read more about it here).

But a new problem arises by using this technique: a common optimization (for top-down games like Sacred 2) of removing the polygons on the underside (aka back-faces) of objects doesn’t work anymore since, for example, a tabletop would not cast any shadow.

So we had to make sure that all our tables, bridges, etc. had nice polygons on the underside, even if the player will never see them:

Source: Sacred 2

Have a nice day! ๐ŸŒž
Simon

Update 1

Just noticed another small optimization in the game. Objects, which are out of view, stop being animated. Wouldn’t be noticeable, except if the shadow (or the sun! Again!) wouldn’t reveal the secret:

Source: Infinity Nikki

Another tidbit: Some NPCs, which are too far off the screen, get their animations disabled as well. But this doesn’t seem to be related to the camera frustum, but probably a simple dot product between the camera view vector and the NPC position relative to the camera. I assume that, because when you play in 32:9 you can see some NPCs stop their animation while they are still on-screen.

Source: Infinity Nikki

I guess the developer didn’t test this optimization in super wide screen.

Update 2

Harlist shared this video on my discord, where we can see how the enemy animation in Elden Ring has a lower FPS when being offscreen:

Source: Elden Ring

One thought on “Infinity Nikki: One-way Window

  1. Gaktan

    For the window backface, I’m wondering if it might be slightly more complicated than a polygon optimization. I mean, if you wanted to reduce the poly count, you would just not render the interiors, right?

    My theory: but some games use occlusion culling to hide objects hidden behind larger objects. There are various ways to implement occlusion culling, one of them is to have occlusion volumes manually placed by artists. The issue is that if you can see through the building, then you can’t place an occlusion volume, since it might cull everything rendered through both windows.
    The best solution is to have windows only one way, so that occlusion culling still works for objects behind the building, and you can still see inside with windows on every wall. The best of both worlds.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *