Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.74k stars 159 forks source link

[Top Down View] Occasional mesh disappearing at the bottom part of the screen #167

Closed Gyeff closed 4 years ago

Gyeff commented 4 years ago

Describe the bug There is an artifact when as the camera is moving up and down with the character, the mesh at the bottom part of the screen disappears.

To Reproduce Camera translation: x:0, y:8, z:8. Rotation degrees x:-45. FOV 20 (parented to character)

The issue only happens in areas with height variation. doesn't happen in flat areas.

Map scale is x:0.2, y:1, z:0.2

I have tried all chunk sizes. issue repeats on all chunk sizes.

LOD scale 2

Video

Things I've tried I have tried multiple chunk sizes. I have tried pulling the camera closer to the character

Environment

Zylann commented 4 years ago

Are you able to provide a test project showing this? I don't see this happen easily.

Gyeff commented 4 years ago

[Removed link] Will provide again upon request.

Zylann commented 4 years ago

Thanks. The vertical bounds grid of the heightmap appears to be wrongly calculated, but I have no clue why yet. It causes the bounding boxes of chunks to mismatch the visuals, so they get culled too early. I can't seem to find a pattern in the visual printouts of the ranges around the map:

image

Will need to investigate further step by step.

Gyeff commented 4 years ago

Maybe the way I'm doing it will give some clues. I'm mostly using the flatten tool and height smoothing tool. 0 is for below water level (water represented by the plane mesh). Sea level height y = 0.2. Flatten 1 for most of the level 1 ground surfaces, only blend between 1 and 0 at beaches. Shore cliffs are rough unsmoothened transition between 0(below water level) and 1(ground level). In the future I intend to make higher ground levels using flatten 2, 3 etc in inland areas and using smoothening only where the character can climb up.

Reminder that I'm using map scale x: 0.2, y:1, z:0.2. Could this be causing it?

If that's the perpetrator I could potentially lower the y scale and repaint height using maybe flatten 2 for ground level 1.

Zylann commented 4 years ago

Map scale should not affect it, neither the ways you are sculpting the terrain. Vertical bounds are calculated when the terrain loads, directly from the heightmap.

Zylann commented 4 years ago

Should be fixed by 5612b0fdc519a16e6c6341761c20ebac929d1afc

Gyeff commented 4 years ago

Nice.