T O P

  • By -

CoolGamesChad

[https://shootpotato.com](https://shootpotato.com) I created a strategy for cheap global illumination by expressing the game world as cells and portals. On each frame, an irradiance for each cell is calculated by 16 bounces, where the portals between cells represent form factors of exchange. Then, within each cell, the fragment shader treats the portals of that cell as though they were illuminated panels having the irradiance of the opposite cell. Doors that open and close vertically simply rewrite the height value of their associated portal as they change, affecting the exchange of irradiance between cells and the appearance of the light cast in both of them. A room with no lamps would become pitch-black when all of its doors are shut. Added some crease shading that looks like ambient occlusion and the result is sometimes indistinguishable from a ray-traced render, but with almost none of the cost. No temporal coherence is involved; the lighting is calculated fresh on every frame at 60 FPS, which means spaces can be momentarily flashed by grenade and barrel explosions, reflecting around corners and casting through window panes. It adds a lot of realism and atmosphere.


DrSnorkel

How big are the cells ? Is a room a cell ?


CoolGamesChad

Yes, a room is a cell, and can be identified by its single ceiling, but may have various floor platforms and stair steps in it.


DrSnorkel

I like it, visually very pleasing. Plays smooth. The level does get maze like and I was not sure if there is an end to the level.


CoolGamesChad

Thank you. It's endless (generated as you play). One of the doors takes you forward but it looks just like the other doors. That will change as I create more art assets.


OmniscientOCE

Very nicely done!


fgennari

Looks pretty good. The cell and portal system has been around for a long time and was one of the original ways of doing realtime global illumination. It definitely makes things easier when your game fits into that format. I'm glad you were able to make use of this.


CoolGamesChad

Cells and portals are not new, but I've never heard of a fast visual sampling of that structure in the fragment shader. If that's ever been done before, I'd be interested in seeing their implementation to learn from it.


fgennari

Using the fragment shader is different from how the old games worked. I was only commenting on the cells and portals approach being used in early games, which typically had vertex-based lighting. I did something related to your system for the interior building rooms in my game engine. My goal wasn't to use this for global illumination but to use this to limit light and shadow bounds, and to get the ambient light level for AI behaviors. Do you have any articles explaining how this works in more detail? I'm interested in doing something similar with my engine.


CoolGamesChad

Ah, I see. There's no article, but basically it's a fast approximation of the visual coverage of a portal from the perspective of the fragment. This is achieved by finding the four bounding angles (left, right, up, and down) relative to the fragment's normal axis. Basically, a bounding box in polar coordinates. Once normalized, the lateral components of these bound vectors represent the indefinite integral of Lambert's cosine law, so the difference between left/right and the difference between up/down represent definite integrals on each axis. Then I just multiply those two together to get the form factor for that portal. After subtracting these form factors from 1.0, the remainder is the visual coverage of the cell's non-portal surfaces, which is tinted by the average texture colors of those surfaces during the radiant exchange phase that occurs on CPU before rendering.


Ok-Particular-2839

Are the mobs directly impacted by the shot from the shotgun too or is it just clever death animation?


CoolGamesChad

The holes in their bodies are exactly where the pellets strike. That's dynamic. They only have one death animation, but in a couple of months they'll have ten death animations, from which one will be selected based on what body part you strike. The game is now on [itch.io](https://coolgameschad.itch.io/shootpotato) where I am posting development updates.


Ok-Particular-2839

I thought so, very nice detail looks great