mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Visual glitches on high memory usage

Open zo3n opened this issue 5 years ago • 10 comments

Describe the bug https://streamable.com/vlgd1

I don't know what causes this, nor how it starts. There are just a few things I know about it. This already exists for years, moving camera can remove/restore the flickering. Based on this camera thing I believe that the cause could be something 3D related like a vehicle or a ped/player. Not sure if modded elements affect this flickering.

Looking more thoroughly and carefully through the video, before i start flying to that part of SF Airport, you can notice a black thing as possible source, and as i fly towards, only fitting element is a player (LOKO) flying with superman using default CJ model with some clothes from GTA.

Actually looking even more closer, the flickering moved the same way a player with superman script would, suggesting that it's probably coming from that player.

To reproduce Unknown

Expected behaviour To not happen

Screenshots Provided a video above in the description

Version Any

zo3n avatar Mar 26 '20 19:03 zo3n

https://streamable.com/udjwd7

Another video on the issue here. It happens in certain situations and moving the camera fixes it. Has anyone had this happening on a stock MTA server?

Zangomangu avatar Oct 12 '20 21:10 Zangomangu

I also encounter this issue for a long time. However, it seems somehow related to the rendering on peds or ped's driving vehicles; I'm currently using CrystalMV's NPC traffic script. Once I stop that resource, the screen flickering issue suddenly goes away. I'm wondering what the specific mechanism behind this problem is. If I lower my server's framerate limit, let's say 35 rather than 60fps+, and I found it less likely to happen. If anyone knows how to fix that would a huge appreciate! Screenshot unknown

gta191977649 avatar Mar 12 '21 12:03 gta191977649

I know another issue exists that this one is a duplicate of, but I just can't find it right now, so not closing. We're talking about a really old bug that can be provoked by various things in the game world besides other suspicions listed in this topic. I recall that in the main issue, it was said helicopters nearby were the main culprit to trigger these artifacts on your screen.

Btw, using streamable links to accumulate examples wasn't a good idea, as they all get purged after a few months (Streamable doesn't offer indefinite video hosting). Maybe you can reproduce again to add those examples of the artifacts back.

Dutchman101 avatar Mar 12 '21 12:03 Dutchman101

https://twitter.com/_silent/status/1617982556980543488/photo/2

lopezloo avatar Mar 24 '23 00:03 lopezloo

https://twitter.com/_silent/status/1617982556980543488/photo/2

That also explains why sometimes characters lose part of their bodies at random

PlatinMTA avatar Mar 24 '23 00:03 PlatinMTA

I didn't manage to reproduce this issue. These reproduction steps doesn't work: https://github.com/multitheftauto/mtasa-blue/issues/2882#issuecomment-1407717411 (@Zangomangu)

I have upped MTA memory usage to ~2.6 GB, spawned bunch of models (vehicles, peds) and haven't seen any flickering. Maybe higher memory usage is needed to make it more frequent?

lopezloo avatar Mar 30 '23 16:03 lopezloo

Reproduced.

Steps:

  1. Up MTA memory usage a bit by loading a bunch of big SVG files:
for i = 1, 7 do
	svgCreate(1401, 850, 'map.svg',
		function()
			outputChatBox('svg ' .. i .. ' created')
		end
	)
end

I have used this SVG file: https://upload.wikimedia.org/wikipedia/commons/f/fb/Koppen-Geiger_Map_Cfc_present.svg (96,3 MB)

  1. Create bunch of peds and vehicles:
localPlayer.position = Vector3(2483.055, -1682.133, 13.330)

local ids = getValidPedModels()
for i = 1, 200 do
	Ped(ids[math.random(1, #ids)], localPlayer.position + Vector3(0, i * 0.75, 0))
end

for i = 400, 500 do
	Vehicle(i, localPlayer.position + Vector3((i-400+1) * 4, 0, 3))
end
  1. Keep rotating camera.

lopezloo avatar Mar 30 '23 17:03 lopezloo

I found a way of scripting a workaround for this :

local boneIDs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 21, 22, 23, 24, 25, 26, 31, 32, 33, 34, 35, 36, 41, 42, 43, 44, 51, 52, 53, 54, 201, 301, 302}

addEventHandler( "onClientElementStreamIn", root, 
    function ()
        if getElementType(source) == "player" or getElementType(source) == "ped" then
            for b, bone in ipairs(boneIDs) do
                setElementBoneRotation(source, bone, 0,0,0)
            end
        end
    end)

I haven't had any screen flickering since implementing it, before we had a high amount of flickering due to having a lot of peds on our server.

Commendatore1 avatar Jul 09 '23 06:07 Commendatore1

After 1a886460a9fab1041cfba38078ae544b0fa51240 flickering doesn't happen anymore but holes in peds still do. Proper fix is still needed.

lopezloo avatar Sep 19 '23 20:09 lopezloo

If anyone feels like fixing this, it's a one-liner. The code [0x7CD613, 0x7CD641] needs to be NOP-ed out. Credits here.

EDIT: Okay, so it turns out that NOP-ing it simply won't work by itself, as UV anims need the original code (Credits)

My solution

Pirulax avatar Feb 24 '24 00:02 Pirulax