PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

'Blur' state in particle_ext #121

Closed DoctorAnsem closed 3 years ago

DoctorAnsem commented 3 years ago

Things are getting hectic again and not in the fun way. There's something shader patch is doing, that is causing AI Hero scripts to crash the game with the classic "BattlefrontII.exe has stopped working" message every time. I thought it might have been a conflict with the script also integrated into shell because of the remaster mod, but that's apparently not the case as disabling shader patch equals no crash. Again, sense has already gone out the window because I swear I was using this exact same setup before, for years, and it's never been a problem before - unless it's restricted to the latest preview build only and I never tested it. I don't know, it's been a while unfortunately. Maybe the devil is just out to get me.

I do know there was another case with slight script interference before, and it affected the display of teams if there were more than 3. (4th team's kill messages would display the 3rd team's names and whatnot) However that was already fixed in one of the previous builds. Still curious how this soup is stirred.

Is there any magic trick I could do to bypass this problem? Or even how or why it's happening?

PrismaticFlower commented 3 years ago

That's quite strange. I honestly don't have any clue what could be causing it it. Maybe something to do with Scalable Fonts as that's the only thing I can think of that's changed in regards to messing with the game's files in the last preview release.

https://github.com/SleepKiller/shaderpatch/blob/687983948e548a76bf5cbce0dfd3795771c2410a/assets/shader%20patch.yml#L35

It's unlikely but you could try commenting out your SP API calls and then hard coding your useShaderPatch to true just to rule out it's not the shader_patch_api script file causing the problem. (It doesn't really do much though, just define a global variable and the test function. Both of which have their values inlined so they're not calling out to anything else.

-- ReadDataFile("shader_patch_api.script")
-- ScriptCB_DoFile("shader_patch_api")

-- local useShaderPatch = gSP_Installed and SP_TestVersion(1, 0, 0)
local useShaderPatch = true
DoctorAnsem commented 3 years ago

I guess I have good news here? While it didn't quite bypass the problem, I'm thinking maybe there's a chance this isn't a script issue after all, because this particular test happened to catch an error in the log I didn't see before:

[ERROR] 13:01:59 Failed to find vertex shader for material shader 'particle_ext' with shader state 'blur'! vertex shader flags: (00000000000000000000000000110110) 'position | normal | texcoords | color'

This falls more in line with what I said before as well. I'm positive I've used this build before with this same exact setup, and I was not wrong. What happened was I made some particle_ext materials but never got around to test them, and I just forgot about it. I'm guessing this error is for particles that use the material with the 'blur' blending type? Is this at least easier to address?

PrismaticFlower commented 3 years ago

I'm guessing this error is for particles that use the material with the 'blur' blending type?

Indeed. Have you applied it to particles with blur explicitly or is there some one the game's drawing itself that (i.e blast bolts) that's causing it? Since particle_ext was made with just getting particles really bright in mind I did leave support for blurred ones out as I couldn't see the use case I can probably add them in if you feel there is one though.

DoctorAnsem commented 3 years ago

It's kind of both really. I made some flash ring, explosion and whatnot materials that replace the stock textures but come to think of it, there are probably hundreds of stock particles that use all of these textures with the blur blending type. Quite the predicament, but if it comes down to it I don't suppose I really need all these particle materials. It shouldn't be too hard for me to reserve its use for textures that aren't ever blurred, in theory at least - in practice though I don't really have a way to tell if some obscure effect uses a flame texture with blurring, for example. So I guess I'd say the blurred blending would be a nice addition for the sake of feature completion, but if it's too much of a hassle then it's probably not worth it.

PrismaticFlower commented 3 years ago

It shouldn't be too much trouble really. The pixel shader that for blur particles is pretty small and it should pretty simple to adapt to particle_ext. Though I should mention that I can't think of a meaningful use for EmissivePower (blur particles only use the alpha channel from their textures) in it so it'll probably do nothing in blur particles. (Unless you can think of something you'd like it to do of course.)