Moving an invisible part causes shadows on Future & ShadowMap to constantly flicker on every shadow in the scene

If you have a scene with any amount of objects casting shadows (in my example scene, this was 66 parts including the baseplate and SpawnLocation), and an invisible, CastShadow = false part moving to-and-fro a distant location, it causes the lighting to visibly flicker each time you move the part far away. This is fully consistent and occurs on many different PC specs, both in-game and in studio. Below is a video plus a minimal reproduction file which shows this behavior:
(mild epilepsy warning)


Shadow_bug.rbxl (54.4 KB)
If you do not see the issue occuring, try moving your camera around, or add more parts with shadows into the scene.

There is a script in StarterPlayerScripts which moves the invisible part:

local part = workspace:WaitForChild("Part")

local FAR_AWAY_CFRAME = CFrame.new(9e9, 9e9, 9e9)
local originalCFrame = part.CFrame

while true do
	part.CFrame = FAR_AWAY_CFRAME
	task.wait()
	part.CFrame = originalCFrame
	task.wait()
end

This behavior is something that I, and many other developers, widely use when implementing part caches. Parts which are no longer needed are moved far, far away so that they are no longer rendered, and then moved back into the scene when implementing e.g. visual effects.

All settings in Workspace are set to Default.

Expected behavior

I would expect no flickering with the shadows to occur, especially so given when the part is completely invisible, has CastShadow and collisions off, thus having no impact on the scene.

8 Likes

thank you for the report, we’ve narrowed down the issue and hopefully gonna release fix in the coming weeks

4 Likes

Are there any known workarounds for this?

This is a very jarring bug to experience in my game. So it would be nice if there is anything to work around this issue rather than having to wait weeks for a fix to come out.

1 Like

Just don’t position the parts out of floating point atm

I worked around it by moving parts to this distance instead:

local FAR_AWAY_CFRAME = CFrame.new(2^24, 2^24, 2^24)

Which does not cause flickering.

1 Like

Looks like I was able to track this down to @lewisakura 's Pooler library, if anyone is using it and ran into a similar issue.

If you configure an object pool with a cframe return method, it will trigger this lighting bug.

I was able to fix by setting the returnMethod parameter to nilParent

2 Likes

Heh. What a funny issue. If the issue persists after the bugfix I’ll release a patch that decreases the CFrame distance to what Pyseph stated.

2 Likes