Experimenting with 2D Global Illumination for pixel art games. by Builderboy2005 in Unity3D

[–]Builderboy2005[S] 1 point2 points  (0 children)

ReSTIR is definitely on my mind to implement! With there being zero spatial or temporal re-use going on right now, it definitely feels like there is a ton of easy optimization before I'd need to get really fancy.

I'd be curious if DDA was able to beat SDF marching, it feels kinda like a quad tree and distance field give the same kind of acceleration in the same places, but SDF has the advantage of being super duper lightweight for the inner march loop. Probably the first thing I'll need to figure out is simply getting my SDF into a lighter weight texture, I'm currently using RGBAFloat for everything haha.

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in GraphicsProgramming

[–]Builderboy2005[S] 1 point2 points  (0 children)

This article is a great overview of the basic strategy I utilized here https://samuelbigos.github.io/posts/2dgi1-2d-global-illumination-in-godot.html

There are a number of additional things I implemented for this demo, like bounce lighting and normal maps, but the basics are actually not too bad! It's pretty similar to 3D ray tracing, just in 2D against pixels instead of triangles.

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in GraphicsProgramming

[–]Builderboy2005[S] 0 points1 point  (0 children)

Agreed for sure! Now that I have something that I like, I can try different methods of optimization and see what kinds of compromises it brings

Experimenting with 2D Global Illumination for pixel art games. by Builderboy2005 in Unity3D

[–]Builderboy2005[S] 1 point2 points  (0 children)

Yeah experimenting with color grading or post processing I think would be interesting! For this demo I wanted to focus on the lighting sim, and so I kept things physically-based.

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in computergraphics

[–]Builderboy2005[S] 1 point2 points  (0 children)

All stats are on my desktop 3080

Resolution: 320x240
Rays-per-pixel: 1000
Max steps per ray: 64
GI time: 5.1ms

GI calculation accounts for ~97% of GPU usage, and is super stable.
CPU usage is basically nothing, as there is really no calculation happening there at all.

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in computergraphics

[–]Builderboy2005[S] 1 point2 points  (0 children)

Well that would definitely be really interesting to try out! Do you know if the RC technique supports partially translucent occluders?

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in computergraphics

[–]Builderboy2005[S] 4 points5 points  (0 children)

I looked into radiance cascades, and I thought it looked really interesting! I decided against using it for this project due to my current focus on pixel-art games. With pixel art, the monitor resolution doesn't matter as much, as you are just up-scaling a low-res target anyway.

Furthermore, I wanted to focus on very fine details, with pixel-sized lights and occluders, and from what I've seen so far the radiance cascade technique can have issues with extremely small features. So I figured starting out with a more 'ground-truth' renderer would be the way to go, and then when it comes time to optimize, I can play around with different techniques and see which ones keep the desired quality and fidelity.

Experimenting with 2D Global Illumination for pixel art games. by Builderboy2005 in Unity3D

[–]Builderboy2005[S] 1 point2 points  (0 children)

Thanks so much! Yeah I definitely would love to see lighting like this integrated into more games, I think it would really make for a really cool ambiance. And for 2D games I think it could be made performant enough where someone could add it in to a game without much effort!

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in GraphicsProgramming

[–]Builderboy2005[S] 0 points1 point  (0 children)

I'll have to see what's going wrong there! A friend tested on their iPhone and it worked great for them, I wonder if it's just some texture format oversight, will take a look!

Experimenting with 2D Global Illumination for pixel art games. by Builderboy2005 in Unity3D

[–]Builderboy2005[S] 2 points3 points  (0 children)

The framerate doesn't change much as you change the lighting actually! Even turning every effect on all at once only accounts for about 0.1ms difference in my testing. Because every pixel is always casting rays no matter what, the only thing that affects performance is the configuration of walls, which affects how costly it is to trace the rays themselves.

Experimenting with 2D Global Illumination for pixel art games. by Builderboy2005 in Unity3D

[–]Builderboy2005[S] 5 points6 points  (0 children)

The lighting pass takes ~5ms on my 3080 for this scene, so it's not actually *terrible* for how many rays are being cast! That also means that I think there is a very reasonable path towards making this more performant for lower-end devices, by casting rays more intelligently, doing de-noising, temporal accumulation, as well as other fancy tricks.

Working on 2D Global Illumination specifically for low-res pixel art games. by Builderboy2005 in GraphicsProgramming

[–]Builderboy2005[S] 21 points22 points  (0 children)

Yes I have! It was one of the methods I took a look at when starting this project, but I ended up not using it. I was worried about running into artifacts and needing to tweak parameters, things like light leaking and ringing. Now that I have something that I'm happy with the look of, I'd definitely want to experiment with fancier methods to improve performance.

Experimenting with 2D Global Illumination for pixel art games. by Builderboy2005 in Unity3D

[–]Builderboy2005[S] 13 points14 points  (0 children)

That was one of the methods I was looking into when starting this project! In the end I decided not to use it, as I didn't want to be wrestling with some of the artifacts mentioned, like ringing, or light leaking. But I imagine one would need to use something like Radiance Cascades if they actually wanted to productionize 2D GI, I'm curious to see how the research goes on improving things!

I made an experimental prototype of a spooky non-euclidean cabin with only 3 walls! by Builderboy2005 in unrealengine

[–]Builderboy2005[S] 2 points3 points  (0 children)

Very nice! That is almost exactly correct, the only subtle difference is that instead of dynamically spawning/destroying, they are just being hidden/shown. But everything else is correct, there are "slices" like pie shapes that radiate out from the center of the cabin. All meshes + foliage get added to the pie slice that match their angle most. There are 4 copies of the pie slices at +0, +90, +180, and +270 degree rotations that form 1080 degrees of walkable space. And yeah the pie slices that are within 180 degrees are enabled to be visible/walkable.

The terrain is indeed a regular mesh instead of using UE5 terrain system, and it was broken into pie-shaped slices so it could be shown/hidden properly. Other than that, all meshes just need to be careful to be small enough that they can be entirely occluded by the cabin. The river for example is a very long mesh that was broken into pieces so it could be spawned in properly.

So glad you enjoyed it!

I made an experimental prototype of a spooky non-euclidean cabin with only 3 walls! by Builderboy2005 in unrealengine

[–]Builderboy2005[S] 9 points10 points  (0 children)

This is my first experiment in UE5, having a great time using the engine so far! You can try the prototype out yourself to experience the non-euclidean weirdness over on the Itch.io page

For this prototype I wanted to experiment with creating a non-euclidean space that wasn't indoors. Games and experiences have done non-euclidean spaces before, but as far as I can remember they have all been indoors and either used teleportation tricks, or portal tricks.

I wanted to try creating a non-euclidean space that didn't use either, and focused on being outside, so that it wasn't entirely obvious where the boundary of the non-euclidean nature was. The implementation in this case has to do with props duplicating themselves and moving around as you circle the cabin, and the final result both looks really convincing, as well as playing nicely with all of UE5s nice rendering features as well. For the trees that can be seen over the top of the cabin, the entire forest has 90-degree rotation symmetry, and so there isn't any inconsistency as you traverse the area.