SleepKiller's Shader Patch - v0.8.0

New maps and mods are coming out quickly. If you release something (even a beta) please post it here. Be sure to give details in the topic such as Map/Mod name and version

Moderator: Moderators

SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

SleepKiller's Shader Patch - v0.8.0

Post by SleepKiller »

This a mod focusing improving the quality of SWBFII's visuals in subtle ways without interfering with any mod or map's art style. After all a lot of modders spend quite a while making their content look just right and I don't want to come along, ignore all their effort and end up butchering their content.

I want visual improvements that interfere minimally with existing content but are still meaningful. Now let's go on a tour of the features provided by this amazing mod.

First up we have the lovely global per-pixel. Per-pixel lighting is already in the game but modelers must opt into it, this is because back in the day GPUs just weren't up to the task of doing it. However GPUs have gotten alot faster since the game came out and thus we're now able to enable per-pixel lighting across the board.

Notice how on the left the light fades out unevenly and it is hard to even identify where the light is coming from. Compare that to the right where the light interacts with the wall smoothly and correctly from it's centre point.
Hidden/Spoiler:
Image
Next up we have my attempt at improving the look of the Droideka shield effect ingame. On right you can see how the shield has distortion that helps give the appearance of greater depth and complexity to the shield's surface. (The normal map is also seamless.)
Hidden/Spoiler:
Image
Moving onto water! You ever notice ingame how the water animation always looks jittery and lowres? This always bugged me and was my reason for getting into editing the game's shaders. It does however potentially interfere with the art of some maps, although I've done my best to avoid it.
Hidden/Spoiler:
Image
Then we have normal mapping. The game normally uses it's normal maps to modify a light's attenuation to produce a bump mapping effect, this gives a reasonably good result, it's not 2005 anymore, we can do better by using real normal mapping. (The impact of this change is often more noticeable on custom maps that make use of normal maps as opposed to stock maps.)
Hidden/Spoiler:
Image
Ever gotten bugged by that boxy looking bloom falloff that can sometimes show up? As of v0.6.0 Shader Patch comes with an optional (but on by default) replacement stock bloom effect designed to smooth out the falloff.
Hidden/Spoiler:
Image
Another new one as of v0.6.0. The game comes with a scene blur effect that some maps use. The stock one has a nasty habit of adding aliasing to the corners of objects, to solve this Shader Patch can now (once again optionally) replace the blur effect with a gaussian blur that doesn't add as much aliasing to the scene and (keeping in line with Shader Patch's goal of respecting a map's artwork) looks similar when blended in. (Minus the aliasing obviously!)
Hidden/Spoiler:
Image
For a while now SP has had a custom materials system and a fancy pants post-processing system to go along with it. However as I expected there hasn't been any use of it. But one thing I have noted is that people sure to seem to like their post-processing effects. So the effects system used by the materials system has been extended to be perfectly (and easily) usable on it's own. There should be a tutorial on the GitHub wiki either now or in the next couple days for how to use and integrate it with your map.
Hidden/Spoiler:
Please note that I'm not suggesting you color grade a night time map like this, it's just meant to show off what SP's post-processing can do.
Image
To use this amazing mod you'll need:

* To understand that it works by hooking into the game using a .dll, if that isn't something you're comfortable with then obviously don't install this :)

* If you want to use the included Installer/Uninstaller .NET Framework 4.6.2 which you can find here if you don't already have it. (You probably do.)

* A Shader Model 3.0 capable GPU, if you don't have this the patch won't work, full stop.

* Windows 7 or higher, because adding XP support would be a serious pain.

Assuming I haven't frightened you off and you're eager to start installing the patch you can find it at the below link on GitHub. The name of the file you're after is shaderpatch.zip.

GitHub Release


If you hit problems have a look at Common Problems & Solutions page, it is possible some simple settings need changing for it to work.

And of course the source code to both the shaders and DirectInput hook can be found on GitHub.

GitHub Source

If you have any thoughts/bug reports or requests then I'm always happy to hear to them. You can reach me here, on GitHub or if you prefer on Discord.
Last edited by SleepKiller on Sat Aug 04, 2018 4:33 am, edited 12 times in total.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Anakin »

Nice, there is finally a release version :D

But your installer seams not to work properly:
Hidden/Spoiler:
Image
The game is installed to C:\Program Files (x86)\Lucas Arts\Star Wars Battlefront II\...
And not in my download folder. that is where the installer is positioned. And i cannot select the correct path
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by SleepKiller »

Ah this is a bit of oversight on my part. The installer asks Windows Search for all the locations of where it can find battlefrontii.exe, this is blazingly fast and in theory it should let someone open the app, see the location SWBFII is and hit "Install!".

Unfortunately for my brilliant idea it (obviously) doesn't work if Windows Search hasn't indexed the location. I'll be sure to add a button to let a user manually tell the installer where SWBFII is. But I won't be able to till tomorrow at the earliest. For now you can either manually install it (currently the only thing you need to backup is core.lvl, so this is a fairly simple option for now) or you can add the game's directory to the search index.

You can probably just add the game's folder to the index as opposed the entire disk. This should be enough to let the installer work. You should be able to do it by opening Indexing Options in Control Panel and hitting Modify.

As for manually installing the readme contains instructions on how to do that. (It's just a simple copy-paste after backing up core.lvl at the moment.)
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Anakin »

the more easier way should be to find the path through the registry. Since there is no BFII.exe in my downloads folder and the whole program files folder is indexed, i don't know why it does not work.

What you are looking for is this:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\LucasArts\Star Wars Battlefront II\1.0 and then the ExePath entry. This works for all x64 Battlefront versions. No matter whether it is steam, gog, cd or DVD. For x32 it's a little different, but since i don't have a x32 test PC i cannot tell you the exact path.
Spiret
Private
Posts: 41
Joined: Sun Jan 03, 2016 11:44 am

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Spiret »

Anakin wrote:For x32 it's a little different, but since i don't have a x32 test PC i cannot tell you the exact path.
HKEY_LOCAL_MACHINE\SOFTWARE\LucasArts\Star Wars Battlefront II\1.0
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Anakin »

Awesome, thank you. I'll fix this for my RCM installer and add it to the HD installer :D
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by SleepKiller »

It would seem we unfortunately both have similar problems. Windows Search doesn't work for you and the registry key is nonexistent for me. (That's going off my freshly installed Steam copy for making sure this mod worked with it.) Perhaps it is possible that the recent Steam and GoG updates no longer create that registry key?

I did still however I have added checks for the posted registry keys to the installer, if it finds them it'll use them as well as Windows Search to help the user locate their game install. I also added the ability for the user to browse to were their game is installed manually. The respective downloads have been updated with the new installer.

All that said thanks for testing it, hopefully the new registry checks will enable more people to easily install the mod.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Anakin »

Just redownloaded but the installer crashes while installing

==EDIT==

running as admin works. But if i don't run it as admin it crashes
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by SleepKiller »

Anakin wrote:Just redownloaded but the installer crashes while installing

==EDIT==

running as admin works. But if i don't run it as admin it crashes
Once again an oversight on my part. It looks like that was being caused when the user account the installer was ran under didn't have write access to SWBFII's folders. I have updated the installer to handle this gracefully now and to run itself as an admin if it has to. (It still prefers to work in usermode but if that fails it'll promote itself, which should trigger a UAC prompt.)

Again, thanks for giving it a go and an even bigger thanks for reporting back with how you got it working. It's let me get it into a much more stable state faster than I would've been able to otherwise.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Anakin »

You're welcome :D

About the admin permission the standard install path is C:Program Files (x86)\... No matter whether steam or not and the normal user even admin, does not have write permission there by default.
Isaac1138
Corporal
Corporal
Posts: 149
Joined: Thu Jan 15, 2015 12:05 am
Projects :: No Mod project currently.
Games I'm Playing :: BF1+2 stronghold
xbox live or psn: No gamertag set
Location: Connecticut

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Isaac1138 »

I cant see the screenshots.
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 558
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Lorul1 »

Good work sleep killer !! My Battlefront 2 conversion will definatly be using this amazing work somewhere down the road.
Calrissian97
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Sun May 07, 2017 11:31 pm
Projects :: A New Frontier Era Mod
Games I'm Playing :: All teh BFs
Location: Kentucky, USA

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Calrissian97 »

Works really well on most maps, but Endor seems to be having trouble:
Hidden/Spoiler:
Image
I'm using integrated intel graphics on my laptop though, so this might not be common. That said, my it runs most stuff fairly well.
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by SleepKiller »

Isaac1138 wrote:I cant see the screenshots.
I'll probably take it down in the future, but for now you can find a mirror of the screenshots here https://photos.app.URL Shorteners are disallowed on Gametoast. Use direct links only./1SAwYvVjJTmfUv4a2.
Calrissian97 wrote:Works really well on most maps, but Endor seems to be having trouble:
Hidden/Spoiler:
Image
I'm using integrated intel graphics on my laptop though, so this might not be common. That said, my it runs most stuff fairly well.
Thanks for giving it a go.

I'm not using any vendor specific hacks in this so I'm going to have to have a guess that this is probably a driver bug. There might not be much I can do about it, but I'll see if I can install drivers for the Intel GPU in my CPU. If I can I'll run some tests and see if I can work around whatever is causing it.

I'd be testing on an Intel HD 4000; would that be similar to the GPU you have?
Calrissian97
Second Lance Corporal
Second Lance Corporal
Posts: 100
Joined: Sun May 07, 2017 11:31 pm
Projects :: A New Frontier Era Mod
Games I'm Playing :: All teh BFs
Location: Kentucky, USA

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Calrissian97 »

Yeah, I'm using an intel HD 4600! I've had to switch up drivers in the past with my specific hardware, but I'm using the latest drivers supported by this architecture rather than the OEM drivers. The OEM drivers (HP) tend to cause crashes with this game in general, and also caused Zero Editor to freeze a whole bunch. Never had any other problems with this driver such as this weird (foilage?) glitch. There's also screen tearing and artifacting on the main menu and ingame, although this can be worked around by altering the settings in the .ini file to run at a specific resolution (1080) in windowed mode. The main menu isn't designed to run at this resolution so it's a little wonky, but luckily Anakin is working on the HD menu patch that should remedy that.
Here is my working ini file btw:

Code: Select all

[display]
; Whether or note to override the display settings used by the game.
Enabled=1
Windowed=1
Width=1920
Height=1080

; Enable borderless window, works regardless of what Enabled is set to.
Borderless=0

[debugscreen]
; The debugscreen is intended for assisting development with quick simple UIs and is currently empty.

; The virtual key that activates the debug screen. See below for some common values.
; '~' = 192 '\' = 220
ActivateVirtualKey=0
Isaac1138
Corporal
Corporal
Posts: 149
Joined: Thu Jan 15, 2015 12:05 am
Projects :: No Mod project currently.
Games I'm Playing :: BF1+2 stronghold
xbox live or psn: No gamertag set
Location: Connecticut

Re: SleepKiller's Shader Patch Beta - v0.1.1

Post by Isaac1138 »

I tried it and all the terrain is pitch black, even if I turn tweak the brightness/contrast.
SleepKiller
Corporal
Corporal
Posts: 143
Joined: Thu Mar 03, 2011 5:08 pm
xbox live or psn: N/A

Re: SleepKiller's Shader Patch Beta - v0.2.0

Post by SleepKiller »

I've released a new version and bumped the version number. I've made more improvements to the water shader (and updated the comparision screenshot), added some new .ini options and fixed/optimized some things to do with the HLSL shaders that I couldn't do before without Shader Patch.

On another subject, the idea of adding custom material types to the game is one that interests me. They could potentially be anything from a simple parallax mapping shader all the way to a HDR physically based rendering shader. However any mod that made use of such a thing would mark itself (without a modder maintaining two versions) as something that required Shader Patch to work. So my question is fairly simple, are their any modders that are interested in that, if so how many and to what scale would they actually use such features.

Hypothetically it would work by creating special textures that when Shader Patch sees would tell it to override the rendering state for the next draw call. Such a texture could be defined in a text file and then passed to a special munger to generate the texture. For instance a hypothetical material file for physically based rendering.

Code: Select all

[Material]
DiffuseTexture = "..."
MetallicTexture = "..."
RougnessTexture = "..."
NormalMap = "..."
Isaac1138 wrote:I tried it and all the terrain is pitch black, even if I turn tweak the brightness/contrast.
Strange. I'll need more information to have any hope of fixing it. Is it only on a specific map? Is terrain the only thing that is being drawn black? What is your operating system, GPU? Do you need to set compatibility options to run the game?
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.2.0

Post by Anakin »

WHAAAT!!! That would be SOOO awesome!!!!

It's a pity that this comes so late, but i think it's a great idea. Maybe Harrisonfog will use this in his graphics mod for the stock maps.
Isaac1138
Corporal
Corporal
Posts: 149
Joined: Thu Jan 15, 2015 12:05 am
Projects :: No Mod project currently.
Games I'm Playing :: BF1+2 stronghold
xbox live or psn: No gamertag set
Location: Connecticut

Re: SleepKiller's Shader Patch Beta - v0.2.0

Post by Isaac1138 »

SleepKiller wrote:Strange. I'll need more information to have any hope of fixing it. Is it only on a specific map? Is terrain the only thing that is being drawn black? What is your operating system, GPU? Do you need to set compatibility options to run the game?
Every map I play, the terrain and models are black. And I do have Harrison's Graphics mod installed.
It has something to do with the core.lvl file.

PC info:
Radeon Software Version - 17.12.1
Radeon Software Edition - Adrenalin
Graphics Chipset - AMD Radeon (TM) R7 370 Series
Memory Size - 4096 MB
Memory Type - GDDR5
Core Clock - 1050 MHz
Windows Version - Windows 7 (Service Pack 1) (64 bit)
System Memory - 12 GB
CPU Type - AMD Phenom(tm) II X4 945 Processor

Image
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4778
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: SleepKiller's Shader Patch Beta - v0.2.0

Post by Anakin »

when i tried to install this over the old version i got this error:
Hidden/Spoiler:
Image
When i uninstalled the old version and then installed the new one, the installer crashed, but it put some files in the correct directory. When i try to uninstall the parts that actually were installed it crashes again.

Solution: run as admin
Post Reply