-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screen Tearing on Ubuntu+GTX760 #59
Comments
Hello and thanks for looking into AnKi.
If you have the time and provide me with some videos and/or screenshots I could take a look further and hopefully unblock you. Thanks. |
It's a weird thing, I start the default Ubuntu screen cast to record a video (ctrl+alt+shift+R), run sponza, and the discontinuities disappear. The video gets recorded and no bug there to be seen as it should be. However, when I run sponza alone without that video recorder in the background, the same abrupt lines/small displaced blocks appear for a short time during the rotations. So that video recorder somehow puts a pressure on the card and sponza runs smoothly, but otherwise "the bug" persists on my machine. So I suspect it's all due to some Ubuntu processes and my driver system rather than a bug in your code. I suggest we close this issue. BTW, it would be nice to be able to take screen shots directly in a rendering program/record videos since it runs full screen and then any key press just exits with [W][VK ][7faf41f33b40] Swapchain is out of date. Will wait for the queue and create a new one (/home/tokyo/anki/src/anki/gr/vulkan/GrManagerImpl.cpp:788 endFrame) So this is not really a bug in your code, I just put it here to show you what happens when I press the screenshot button, or any key more or less except those of the movement control allowed by the program. I also tried to take some snapshots every ten seconds with a Linux program called scrot by placing this in bash and sourcing it in some background: while true But I get only black windows, despite that scrot takes the screenshots of the desktop programs than run in some gnome gui modes. Anyway, these seem to be my own problems with Ubuntu, I wish you all the best with your titanic efforts here. |
Let us keep this issue open for a while because this problem persists on my machine and I believe this could be related to the engine code somehow. Setting things up anew with Ubuntu 20.04 and newer drivers did not improve much. Let me explain more this problem. I now believe that this issue is best described as "screen tearing". It's mild, but the line appears and below/above there is a frame or its part delayed/displaced. It manifests itself also like some pixelization/aliasing/line blinking effect as well, but the latter is usually only for some sharp line artifacts, and here it's tearing more, not just a line. Everything happens only during the movement/rotations for a short time, but it's annoying and killing quality/experience. It's observable in all the other demos; tearing is less pronounced for physics_playground, but it's also visible when moving around those Blender monkeys fast, slightly less so with the wall. The faster I move/rotate, the more pronounced the effect. I now see that you have added the screen shot taking ability, but I am not able to capture this as a screen shot because it's a dynamic phenomenon. The frames in motion captured with a screen shot are always alright or blurred very heavily, but never with those splitting lines that I can see during the motion. Please note that I am able to take screen shots with Print Screen, but not with some external program such as Scrot which shows only black images. Also, there is no GUI mode so that I could exit from the full screen and resize windows while the scene is running. Anyway, I was reading that this could be related to some frame rate mismatch between a monitor and a GPU, people report some issues that are solvable with G-sync and similar tech-based newer monitors, but I believe this is not the case here. What I have tried is this:
So what could be the culprit here? It's something around anki and GTX760 clearly, could this be some low memory issue here, that 2GB of VRAM is not enough for anki in this scene, or something related to Kepler architecture or some temporal filtering setting? I understand that you do not observe this effect on the newer cards. I have tried enabling FXAA via nvidia-settings "Antialiasing Settings", that did not help. The OpenGL setting "Sync to VBlank" also does not change a thing. |
Hi again. Thanks for taking the time to describe your issue in that detail. I believe what you are seeing in AnKi is the fact that AnKi by default has vsync off. To verify this, is it possible to run the sponza sample with the following cmd line arguments |
That did not help unfortunately. It looks as something related to "vsync" indeed as the effect is identical to the one described here https://www.sapphirenation.net/enhanced-sync-overview It is visible only if I move/change viewpoint, the faster the stronger the tearing. It is possible to move very slowly without such an effect at all, but it takes an effort to move so slowly. The tearing is also rather mild, much smaller than in the photos in the link, but it's always moving and annoying enough. The splitting (horizontal) line is also not necessarily single, there can be a few of them nearby making a narrow band of some kind of shifted squares, and it also always moves from top to bottom. So sponza starts, everything is good. I start moving, the tearing line or a few of them appears at the top and then moves to the middle in a second and to the bottom and then again appears at the top and so on. It's also more pronounced if I turn from left to right rather from top to bottom. The band is not very wide, like a few pixels wide line, but it could be a centimetre or two if I move faster. After I run the program I can see in the command line some information:
This takes place in simple_scene too. |
That is very weird. When I try vsync I can't spot any screen tearing. But I'm having an AMD card. nVidia doesn't have as good integration as AMD on Linux and vsync is always a pain to make it work. Maybe you can check this guide https://www.techticity.com/howto/how-to-fix-nvidia-vsync-on-linux-with-proprietary-drivers/ or this https://wiki.archlinux.org/index.php/NVIDIA/Troubleshooting Have you tried another piece of Vulkan content that has vsync enabled? You mentioned Sascha Willems sponza. Is this it https://github.com/SaschaWillems/VulkanSponza/? From what I see you could hack the create() method to enable vsync: https://github.com/SaschaWillems/VulkanSponza/blob/master/base/vulkanswapchain.hpp. Is it possible to try that? |
The links were very useful and this single command essentially solved the problem: |
Good to hear. Please let me know if there are other problems. |
Thank you for your great work, your engine stands out in the open source space as you have a volumetric lighting, the Vulkan backend, 2M lines of 3rd party crapola bundled so well, and you also dissect the rendered frame in your blog, I sure wish you continue well improving this fine code.
However, I have a few minor annoyances, and frankly I am not sure if this my old GTX760 card, or something with an engine. When I run sponza and simple_scene, I get a slightly jerky rendering when rotating a view. It's like some small square block of the screen is being delayed for a split second, sometimes it's the whole line of these blocks, albeit quite narrow, so the effect is rather mild. And this is mostly visible when rotating around z axis that runs vertically, when using the left and right arrow keys. The more sudden rotation, the stronger the discontinuity. The two other rotations run smoother, esp. the rotation with up and down arrow keys, that one is almost as it should be, almost. This takes place in the simple_scene as well, so it's probably not related to the scene's complexity and the 2GB limit of my GPU.
Also in sponza there is one narrow line between two different textures that gets blinking if you come close and look into it from a right angle. So it must be some continuous redrawing with different colors of overlapping textures. This is one is a very minor issue.
Finally, when sponza starts, it does not get lit instantly, but the left side becomes proper after a second or so. This is not a speed of light as it should be :). And when one walks close to the walls they look dark, but upon a slight turn towards the walls they become brighter, this is a bit unphysical, albeit smooth. It's akin to a gradual revealing.
I suspect it might be very hard to fix those things since you do not have my GPU to reproduce the bug which may not even be such a very big bug, esp. if things run smoothly in your case with newer cards, but if you have some suggestions where I should look into the code and what tools to use for GPU debugging on Ubuntu, I would greatly appreciate it. I mostly want to learn how the game engines/Vulkan work and help afterwards hopefully. The most tempting "least resistance" option for me is to head towards UE4, but I like your project a lot too.
The text was updated successfully, but these errors were encountered: