crest: Sporadic gaps / precision errors in tiles.

Is there an existing issue for this?

  • I have searched the existing issues.

Have you checked the documentation to resolve your problem?

  • I have read the linked documentation and could not resolve my issue.

Current Behavior

Occasionally (maybe over the course of hours) a single frame will create a gap in the tiles or parts of the ocean will be missing and then reappear the next frame. It seems unrelated to settings, it is possible its tied to camera movement.

Expected Behavior

Nothing should happen and no ocean tiles should disappear

Steps To Reproduce

  1. Open “BoatWakeScene” and play
  2. Fly the camera around near the surface of the ocean and rotate as desired
  3. Eventually you will see a very long slice of the ocean disappear and then reappear.

Unity Version

2021.3.26f1

Crest Version

4.19

Render Pipeline

Built-In

Editor or Standalone

Editor (Edit Mode), Editor (Play Mode)

Environment

- OS: Windows 11
- GPU: NVIDIA
- Graphics API: DX11

Anything else?

I want to say that this happens most often right after you start the editor / exe and move around low to the ocean, but its hard to see. I have seen it happen long into a session so the cause is not known.

About this issue

Most upvoted comments

I was able to capture the exact position information for the ocean and the camera when it occurred: Frame Before: gap_info_before

Frame During: gap_info

Frame After: gap_info_after

I was not able to force the transform information for the gap to reproduce the problem. Hopefully you find this information more useful.

@daleeidd Here is an info dump of what I have been investigating. I just ruled out camera distance (far clipping) as a cause. I am hoping this may help lead to a solution to this.

Knowns

  • Changing the LOD Resolution has a direct effect on where the gaps appear
  • Whenever there is a gap it is uniform (a straight line) of misaligned verts
  • The gap appears for a single frame
  • The gap can appear when the camera is moving very slightly or almost not at all
  • Removing all :OceanGridPrecisionErrors changes does not prevent gaps
  • Avoiding use of const in SnapAndTransitionVertLayout does not help
  • The results of frac usage are correct
  • Increasing minRadius to 0.499 has no affect
  • Decreasing minRadius to 0.26 has no affect
  • The gaps appear to be the positions without SnapAndTransitionVertLayout being applied
  • Multiple gaps can appear at once (see video)
  • Keeping the scale of the ocean the same does not prevent gaps (minScale and maxScale are the same)
  • Changing the y positon of the ocean has no affect
  • It is not related to view distance
  • var scale_pow_2 = CalcLodScale(lodIdx); is not the cause
  • SnapAndTransitionVertLayout not moving verts too far
  • Not meshScaleLerp
  • LODCount does not have an affect

Guesses

  • The exact camera position at the moment of vert offset seems to change the outcome
  • The frequency of the gaps is not random but appears so due to the exact conditions required for this to occur being uncommon
  • Something is wrong with SnapAndTransitionVertLayout
  • UNITY_MATRIX_M seems correct at all times
  • SnapAndTransitionVertLayout is unable to account for a gap because offset.x or offset.y is unexpectedly larger than minRadius
  • Workload CPU / GPU seem to play a role but does not seem to help reproduce.

Not sure what else to look at. If it is in fact some sort of rounding error that results in the loss of 0.01 in any direction the results for that frame will be wrong and I am not sure there is any way to correct that without changing the way that tile grid snapping happens or how vert offsets are done. It seems to move them pretty far, very frequently. At any moment the position could be just right to produce a rounding error that SnapAndTransitionVertLayout cannot handle, which may be why it seems so random. (thinking out loud) My brain is a bit melted from looking at this, I sorta feel like if there was some way to not update the verts every frame at least for snapping this would disappear. Obviously there are gaps without connecting the tiles. There may be a way to do something similar when creating the mesh so that it is connected, but does not have to snap those edges all the time (would probably cause other problems).

Here is a video of 2 gaps occurring at once which I had not seen before, but it is interesting they both happened at the same time. This occurred while I had the view distance set to 10000 to see if having it too high was the cause.

https://github.com/wave-harmonic/crest/assets/114962753/72721d93-49e1-4e17-8bc5-2087b8083368

Frame: gap screenshot

Thanks for letting me know. That should help narrow down a solution. And good to hear you have a workaround.

That’s okay. Thank you for your help so far.