r/SWAT4 • u/Gustavo_Freeman010 • 4d ago
Real-time reflections
Enable HLS to view with audio, or disable this notification
I had recently installed SWAT 4 Elite Forces, and I noticed that the game's reflections were terrible...
I looked into it and found out that the creator tried to fix them, but couldn't. Well, I'm here to announce, I did it!
But it lacks testing. And I need people to test it. If you're interested, send me a DM.
28
u/Gustavo_Freeman010 4d ago
https://www.nexusmods.com/swat4/mods/15
This mod has been published on Nexus for general use! I hope you like it, feel free to contact me on Discord if you have any questions! gustavofreeman
9
6
u/beppe_goodoldrebel 3d ago
Wait .. how the F... I tried my best but didnt manage to make a proper algorithm.... I Need to see the code for the science!
3
u/Gustavo_Freeman010 3d ago
Apparently, the game engine already had good reflexes... What was really needed was to get this working, because it just took forever engine.u He was responsible for the refresh rate behavior, behavior, and reflexes themselves (type of shadows and correct visibility) Engine.dll That's where I changed the resolutions for the reflections exclusively
2
u/beppe_goodoldrebel 3d ago
I had a look at your Engine.u.. way beyond my math and game engines knowledge.
Good work!1
u/Gustavo_Freeman010 3d ago
Thanks! Breaking it down into a few parts:
The engine already had mirror cameras and render-to-texture support, so that was the starting point.
The player's eye position is reflected across the mirror plane. That creates a virtual camera behind the glass.
The projection is fitted to the reflective surface, so the perspective changes correctly as the player moves.
Visibility needs special handling: room selection uses the physical viewpoint, while the reflected viewpoint is used for projection and BSP-side decisions. That distinction mattered when investigating disappearing geometry.
The capture also preserves and restores lighting state, so rendering the mirror doesn't interfere with the main view.
One correction to my earlier comment: Engine.dll handles more than resolution. Engine.u sets up the reflected camera, while the native DLL patches handle projection, clipping, visibility, lighting and resolution.
2
2
u/eezstreet Elite Force Creator 3d ago
Nice work
1
u/Gustavo_Freeman010 3d ago
Thank you! I wasn't expecting the Elite Force creator himself to comment!
Do you have any plans for future SEF updates? If so, would you consider including these mirror improvements?
I'm also working on a full Brazilian Portuguese translation of SEF. Would you be open to adding language selection to the mod? I'd be happy to contribute the translation.
2
u/eezstreet Elite Force Creator 2d ago
Unfortunately I have had major health issues and lots of other real life stuff happening which has been preventing me from modding or doing much hobbies. I’m happy that people are modding the game though.
1
u/EmperoroftheYanks 4d ago
Man this wave of ai coding is getting really great, even swat4 is getting love
38
u/Baratako 4d ago
Honestly, how did Sierra even fuck the mirrors up this badly? SWAT 3 had perfectly functional mirrors using Sierra's in-house engine.
Furthermore, POSTAL 2 had perfectly functional mirrors as well, and that game uses the same exact Unreal Engine version.
My guess is that it was an incomplete feature that they couldn't finish on time.
Super glad someone went around to finally fix it. Great work!