[Bug] WebGLRenderingContext returns the final composited frame with the CEF/NUI layer #156
zoovdev
started this conversation in
[BUG] FiveM for GTAV Enhanced
Replies: 1 comment
|
Additional step for replication: DLSS must be enabled. When disabling DLSS, it works as intended. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Capturing the game frame through a WebGLRenderingContext returns the final composited frame with the CEF/NUI layer in it, instead of the game render on its own like Legacy. This breaks screenshots (UI shows up in the image) and live in-world previews that draw the frame back into NUI, which feed back into themselves.
Issue type
Client
Repro rate
Always
Server build version
b94 win32
OS
Windows 11
CPU
AMD Ryzen 9 9950X3D2
GPU
NVIDIA RTX 5090
RAM
96 GB DDR5
Storage type
SSD NVMe
Connection type
Ethernet
ISP and bandwidth
1000/500
DxDiag
No response
Network graph
No response
Platform
None
OS version / distribution
Windows 11
CPU
Ryzen 9 9950X3D
RAM
96 GB DDR5
Using txAdmin?
Yes
Hosting provider
Self-hosted
Machine type
Dedicated
/perf endpoint output
No response
DDoS protection
No
ulimit -n value (Linux only)
No response
Docker Compose file (Docker only)
No response
Steps to Reproduce
Edit: DLSS must be enabled to replicate, turns out this is only occuring, along with some infrequent crashes or black screens while DLSS / frame generation is enabled.
Start any resource that draws an NUI layer on screen (a menu, overlay, HUD, inventory, anything visible in CEF).
Capture the in-game frame with the WebGL gameview method. Bind the game framebuffer to a WebGLRenderingContext texture, draw it to a canvas, then read it back with drawImage or toDataURL, or just display it live. The public screencapture and screenshot-basic resources both use this path, so exports.screencapture:requestScreenshot(...) is enough to reproduce it.
Save or preview the result. The NUI layer is baked into the captured frame.
It happens every time. If you sample the framebuffer every frame and draw it back into an on-screen NUI element (for example a 3D weapon or vehicle preview pane), you get a feedback loop. The UI gets drawn into the preview, that preview is part of the next captured frame, and it repeats until the whole thing is nested boxes.
Expected Behavior
The WebGL capture of the game framebuffer should only contain the game render, before the NUI is composited on top. On Legacy this is how it works. Drawing the game framebuffer to a canvas through a WebGLRenderingContext and reading it back gives you the 3D scene with no UI painted over it.
Ideally this would be selectable instead of one fixed behavior. Both frames exist, the game render before the UI and the final composited frame, so it would be useful to pick which one the WebGL capture returns.
Actual Behavior
On GTA V Enhanced the framebuffer you get in the WebGLRenderingContext is the final composited frame, so it already has the CEF/NUI layer in it. Screenshots taken this way show the UI in the image, and any live preview that draws the captured frame back into NUI feeds back on itself and is unusable.
Evidence
No response
Additional Context
https://github.com/itschip/screencapture
All reactions