spice2x / spice2x.github.io

🌶️ spice2x is a spicier fork of SpiceTools with hundreds of bug fixes and new features 🌶️
https://spice2x.github.io/
GNU General Public License v3.0
116 stars 2 forks source link

Camera functionality enhancements #201

Open guardianblue opened 3 months ago

guardianblue commented 3 months ago

Some ideas to follow up on TDJ camera fix.

sp2xdev commented 3 months ago

Not sure how easy this is, but:

guardianblue commented 3 months ago

Should be doable, since the camera texture is already on a D3D9 Surface

It's more like a UX design decision to allow how much flexibility. Might as well just allow user to use Spout2 as input (like in the original cam hook) instead of directly reading the camera, though a separate flag, if sophisticated usage is needed. Like having your favourite vtuber to cheer for you at the usual camera spot.

sp2xdev commented 3 months ago

I've realized the game displays the cams at 4:3, but the current code prefers 16:9, resulting in squished image.

As far as I know most modern cams only support 4:3 in low resolutions (800x600) so some cropping option would also be nice.

guardianblue commented 3 months ago

Thanks for the catch! I am wrapping up my code to allow preserving camera properties over an overlay, will try to integrate ratio/offset setting as well

sp2xdev commented 3 months ago

I have the code to crop 16:9 down to 4:3, will do a release soon.

guardianblue commented 3 months ago

be mindful though, while the camera test shows a 4:3 window, the game expects a 1280 * 720 texture. I have tried 4:3 modes on my camera (Logitech stream cam) and the results aren't good.

i will add a patch to allow stretch/ letterboxing after your new release

sp2xdev commented 3 months ago

be mindful though, while the camera test shows a 4:3 window, the game expects a 1280 * 720 texture. I have tried 4:3 modes on my camera (Logitech stream cam) and the results aren't good.

i will add a patch to allow stretch/ letterboxing after your new release

Try the latest release. I used a Logitech Brio cam with both 16:9 and 4:3 resolutions and they seem fine.

I know the game expects at 1280x720 texture, but still displays it at 4:3 ratio still in-game and in test menu...

llm96 commented 3 months ago

Minor issue: latest version crashes if your privacy settings disallow access to cameras. Works as expected when enabled.

1uRWrFREDE

[2024/08/07 12:43:57] I:iidx::tdjcam: MFEnumDeviceSources returned 1 device(s)
[2024/08/07 12:43:57] M:iidx::tdjcam: Created DeviceManager for DXVA
[2024/08/07 12:43:57] I:iidx::tdjcam: [top] Creating camera
[2024/08/07 12:43:57] M:iidx::tdjcam: [top] Symlink: \\?\usb#vid_046d&pid_085c&mi_00#7&2e13f802&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
[2024/08/07 12:43:57] W:iidx::tdjcam: [top] Failed to create camera: -2147024891
[2024/08/07 12:43:57] I:iidx::tdjcam: [top] Release camera
[2024/08/07 12:43:57] W:signal: exception raised: EXCEPTION_ACCESS_VIOLATION
[2024/08/07 12:43:57] I:signal: printing callstack
[2024/08/07 13:33:10] I:stackwalker: 00000000005E085E (spice64): (unknown): (unknown)
[2024/08/07 12:43:58] F:signal: end
[2024/08/07 12:43:58] F:spice: encountered a fatal error, you can close the window or press ctrl + c
guardianblue commented 3 months ago

Minor issue: latest version crashes if your privacy settings disallow access to cameras. Works as expected when enabled.

1uRWrFREDE

[2024/08/07 12:43:57] I:iidx::tdjcam: MFEnumDeviceSources returned 1 device(s)
[2024/08/07 12:43:57] M:iidx::tdjcam: Created DeviceManager for DXVA
[2024/08/07 12:43:57] I:iidx::tdjcam: [top] Creating camera
[2024/08/07 12:43:57] M:iidx::tdjcam: [top] Symlink: \\?\usb#vid_046d&pid_085c&mi_00#7&2e13f802&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
[2024/08/07 12:43:57] W:iidx::tdjcam: [top] Failed to create camera: -2147024891
[2024/08/07 12:43:57] I:iidx::tdjcam: [top] Release camera
[2024/08/07 12:43:57] W:signal: exception raised: EXCEPTION_ACCESS_VIOLATION
[2024/08/07 12:43:57] I:signal: printing callstack
[2024/08/07 13:33:10] I:stackwalker: 00000000005E085E (spice64): (unknown): (unknown)
[2024/08/07 12:43:58] F:signal: end
[2024/08/07 12:43:58] F:spice: encountered a fatal error, you can close the window or press ctrl + c

Thanks for the findings, will fix soon

guardianblue commented 3 months ago

214 should fix the crash when camera is denied by privacy settings