Page 3 of 5

Re: 32-bit mode hook

Posted: Sat Jul 27, 2019 10:56 pm
by Justagai
Based on what I've read in the topic...
I also recommend that you use an updated ddraw.dll that include the commit to reduce memory usage (mine has version v1.3.7). Else the game way run out of memory and crahes in kernelbase.dll.
rogue518, check your ddraw.dll version. Most likely its older than 1.3.7.

Link to Jeremy's latest ddraw:
https://github.com/JeremyAnsel/xwa_ddraw_d3d11/releases

Re: 32-bit mode hook

Posted: Sun Jul 28, 2019 8:29 am
by JeremyaFr
Yes, the crash in kernelbase.dll probably means that the game has run out of memory.
Please retry with the updated ddraw.dll.

Re: 32-bit mode hook

Posted: Mon Jul 29, 2019 10:44 pm
by rogue518
Thank You JeremyaFr and Justagai…. have 1 little problem... the black bars... in-game. I have no solution to make a full screen.


Edit: I figured it out,,,, :2thumbs: Thanks

Re-Edit: Wow.. JeremyaFr and Justagai…. I think I am going to hold off on the Reshade. Man.. the 32-bit mode really does enhance Xwing Alliance!!! well done! For all who was evolved.






Sincerely, Rogue518

Re: 32-bit mode hook

Posted: Thu Aug 01, 2019 6:56 pm
by JeremyaFr
UPDATE
I've improved a bit the hook performance.

I've uploaded the source code of the hook to GitHub.

Re: 32-bit mode hook

Posted: Thu Aug 01, 2019 7:44 pm
by Darksaber
Hi Jeremy, first thanks for the update
JeremyaFr wrote:
Thu Jul 25, 2019 8:16 pm
For projectiles, the game set the ambient color to 1.0.
When diffuse lighting is disabled, the game set the color to 0.4.
When diffuse lighting is enabled, the game initializes the color to 0.0 and adds the diffuse lights. The hook initializes the color to 0.2.
I've notice since installing the 32 bit Hook and with the adjustment in ambient lighting, the lasers aren't so bright as they used to be.

Are you able to isolate the lasers and projectiles and increase the brightness or ambient color as they seem so dulled now

I've tested with the new lasers, the original XWA lasers and both just seem dull

If you can't don't worry about it, I prefer the lighting as it is now

-Thanks

Re: 32-bit mode hook

Posted: Thu Aug 01, 2019 8:01 pm
by JeremyaFr
The illumination of the laser OPTs may need to be redone.

Re: 32-bit mode hook

Posted: Thu Aug 01, 2019 8:13 pm
by Darksaber
Like I said I've tested with the original xwa laser opts and the new ones, I'm testing brightening the textures of the lasers at the moment but they just seem as dull :(

Just to add there is no illumination on the laser opts, plus you can't add illumination to textures with alpha channel, the illumination of the lasers is done with the exe

Re: 32-bit mode hook

Posted: Thu Aug 01, 2019 8:35 pm
by JeremyaFr
Is this a limitation of the tools or the exe?
A texture can be partially transparent and partially illuminated. Each pixel is either illuminated or transparent or solid (not transparent and not illuminated). When a pixel is defined as both transparent and illuminated, the pixel becomes illuminated and not transparent.

Re: 32-bit mode hook

Posted: Thu Aug 01, 2019 8:56 pm
by Darksaber
I don't think it's a limitation of the tools

True you can't add PNG alpha textures in Optech, only BMP files, you can only add PNG file in XWA Opt Editor, this doesn't bother me, I'm ok with that :)

I've never had to add illumination to a laser opt, even when we had to make the lasers in Optech

But using XWA Opt Editor to add illumination to a alpha texture results in this, it's illuminated alright, but not the way you want it

I should add that this texture should also be transparent, but the transparent part as you can see it white
flightscreen35.jpg

Re: 32-bit mode hook

Posted: Fri Aug 02, 2019 8:33 am
by JeremyaFr
JeremyaFr wrote:
Thu Aug 01, 2019 8:35 pm
When a pixel is defined as both transparent and illuminated, the pixel becomes illuminated and not transparent.
I can invert this to make the pixel become transparent instead of illuminated.

Re: 32-bit mode hook

Posted: Fri Aug 02, 2019 9:03 am
by Darksaber
This isn't what I asked though, my original question was

Are you able to isolate the lasers/projectiles from the other lighting and increase the ambient light for them?

A Yes or No answer would be fine :)

Also like I said I've never had to illuminated a laser texture before, I don't really want to start, when the game illuminates them automatically :D

Thanks

Re: 32-bit mode hook

Posted: Fri Aug 02, 2019 12:25 pm
by JeremyaFr
No, it is not currently possible.

Re: 32-bit mode hook

Posted: Fri Aug 02, 2019 12:31 pm
by Darksaber
Thank you that's fine :D

Re: 32-bit mode hook

Posted: Tue Aug 13, 2019 4:44 pm
by JeremyaFr
UPDATE
Hello,
I've fixed a possible bug with illumination.

Re: 32-bit mode hook

Posted: Tue Aug 13, 2019 6:05 pm
by JeremyaFr
WIP
Hello,
Here is a WIP of the hook.

I've changed the default behavior when a pixel is both transparent and illuminated.
Before, the pixel becomed illuminated.
Now it will be transparent.


EDIT: link removed

Re: 32-bit mode hook

Posted: Wed Aug 14, 2019 11:34 pm
by Bman
Thanks

Re: 32-bit mode hook

Posted: Thu Aug 15, 2019 4:35 pm
by JeremyaFr
UPDATE
Hello,
I've merged the changes from the WIP hook to the stable hook.

Re: 32-bit mode hook

Posted: Sat Aug 17, 2019 6:26 am
by blue_max
Darksaber wrote:
Fri Aug 02, 2019 9:03 am
Are you able to isolate the lasers/projectiles from the other lighting and increase the ambient light for them?
I think this is possible in ddraw. It's a bit of a hack; but it kind of works?
x-wing-32-bit-lasers-fix.jpg
tie-fighter-32-bit-laser-fix.jpg
The basic idea is that laser textures are identified by name, using the texture tag hook. Then, when a laser texture is about to be rendered, we send a flag from ddraw to the pixel shader to increase the saturation and lightness (I probably overdid the effect in the images above -- that can be configured). Something similar should be doable for missiles and other objects, I guess.

On the other hand, a more elegant fix would be to apply these lightness/saturation changes inside the 32-bit mode hook itself; but it would have to interact with the texture tag hook, so I don't know how difficult this would be.

Re: 32-bit mode hook

Posted: Sat Aug 17, 2019 9:52 am
by Trevor
Darksaber wrote:
Fri Aug 02, 2019 9:03 am
Are you able to isolate the lasers/projectiles from the other lighting and increase the ambient light for them?
JeremyaFr wrote:
Fri Aug 02, 2019 12:25 pm
No, it is not currently possible.
this is why I never understood this statement, it had to be possible even if doing it by texture id/name.

good work.

Trev

Re: 32-bit mode hook

Posted: Sat Aug 17, 2019 1:56 pm
by Driftwood
So my thought is , "so what" if it is in the texture tag hook rather than 32bit hook at this point? If both are default installs due to the new features they add to the game and are in line with the projects direction forward, and it requires the tag to function (assuming there isnt a better way) then does it matter?

Re: 32-bit mode hook

Posted: Sat Aug 17, 2019 6:28 pm
by keiranhalcyon7
Do we know why the lasers are becoming dulled in the first place? What's special about them? Or are there other things also being dulled that haven't been found yet?

Re: 32-bit mode hook

Posted: Sun Aug 18, 2019 3:55 am
by blue_max
keiranhalcyon7 wrote:
Sat Aug 17, 2019 6:28 pm
Do we know why the lasers are becoming dulled in the first place? What's special about them? Or are there other things also being dulled that haven't been found yet?
I think I know what's going on now -- and how to fix it. The 32-bit hook converts indexed textures to 32-bit textures; but in the process, it looks like it's dulling the lasers a little bit.

I manually extracted the original lasers from the OPT and made 32-bit PNG versions of them. When I replace the lasers at run-time with the versions I made, the lasers look bright again:
A-wing-32-bit-lasers.jpg
So one way to fix this properly -- without any hacks -- would be to redo the OPTs for the lasers and upgrade them manually to 32-bits so that the hook doesn't convert them.

@Jeremy: can this 32-bit hook load 32-bit OPTs? Also, what happened to the "light" textures? It looks like the illumination information is also gone?

Re: 32-bit mode hook

Posted: Sun Aug 18, 2019 4:45 am
by blue_max
Looks like the 32-bit mode hook can load 32-bit OPTs; but it still processes 32-bit textures (?) and makes lasers dull again.

Re: 32-bit mode hook

Posted: Sun Aug 18, 2019 4:56 am
by Bman
BlueMax, yes. Trick I came across is using XWAOptEditor. Select each 32-bit ARGB FG texture and click the "Reset Illumination" button then save. If there is a way to maintain the pixels' transparency with illumination applied, that would be best of both worlds even without using ReShade. Don't know if that's possible currently.

Re: 32-bit mode hook

Posted: Sun Aug 18, 2019 5:10 am
by blue_max
Hey Bman, I don't know about that (I'm still learning about OPTing). If I reset the illumination on all the laser textures, nothing changes. If I export the textures manually to 32-bit PNGs they keep the alpha channel. I can then load these external PNGs inside ddraw and replace the textures coming from the OPT and thus keep illumination (fully bright) and transparency (effectively bypassing the 32-bit mode hook). But it looks like, in general, the 32-bit mode hook still has to process 32-bit textures to apply illumination information and other stuff.

So, it looks like the problem is more complex than I originally thought. I can provide a flag in ddraw.cfg to apply the hack to all lasers to make them brighter in the meantime.