Author Topic: Shadows flicker in game view  (Read 192 times)

Kyun

  • Newbie
  • *
  • Posts: 5
    • View Profile
Shadows flicker in game view
« on: July 14, 2019, 12:47:00 AM »
Hello, I'm testing the World_Scene demo and I noted that the shadows on the trees start to flicker/jitter when I go far away from the spawn. Is this due to floating point precision? Is there anyone who solved this and could give me some hints to solve this?

Kind regards
Kyun

Kyun

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shadows flicker in game view
« Reply #1 on: July 14, 2019, 01:16:40 AM »
When I use post processing and enable Temporal Anti-aliasing the problem seems to be gone.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Shadows flicker in game view
« Reply #2 on: July 16, 2019, 11:29:15 PM »
Try increasing your camera's near clip plane. That setting controls the resolution of the depth buffer and in large worlds should not be less than 0.3 or even greater. Here's a good explanation: https://www.sjbaker.org/steve/omniv/love_your_z_buffer.html

Kyun

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shadows flicker in game view
« Reply #3 on: July 20, 2019, 03:20:40 AM »
Awesome, thanks!

Amoo0001

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Shadows flicker in game view
« Reply #4 on: September 08, 2019, 03:26:07 AM »
Is there a way to increase the resolution of the depth buffer (or otherwise fix this flickering) without increasing the NCP?  Even at just 0.2 I get terrible artifacts in tunnels and other tight spaces.  It really needs to be around 0.1 for the game to be playable IME.

The second image has the NCP set to just 1.5.  Crouching causes major artifacting over the bottom half of the screen.
« Last Edit: September 08, 2019, 03:44:00 AM by Amoo0001 »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4994
    • View Profile
Re: Shadows flicker in game view
« Reply #5 on: September 08, 2019, 03:55:38 AM »
Thereís no universal solution to this problem. It could switch the near clip plane from 0.1 to 0.3 depending on the case. For example, if camera is nearer than 0.5 distance to any Voxel face, switch to 0.1 or default to 0.3 otherwise. Iíll try this.

Amoo0001

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Shadows flicker in game view
« Reply #6 on: September 08, 2019, 04:03:15 AM »
Alright, great idea!  Thank you :)