Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain disappears when viewed from a certain angle. #260

Open
Proksimas opened this issue Apr 16, 2021 · 11 comments
Open

Terrain disappears when viewed from a certain angle. #260

Proksimas opened this issue Apr 16, 2021 · 11 comments
Labels
bug Something isn't working Need more info

Comments

@Proksimas
Copy link

Describe the bug
the terrain disappears when viewed from a certain angle.
What is very strange is that this bug appears only on our project.
If I create a new project, with similar test parameters, I don't have this problem.

I add that the terrain collision doesn't work well and my character goes through when there are slopes. I fix this problem if I create a mesh, but maybe this bug is related to the disappearing textures?

To Reproduce

When we have no bug
no_bug

when we up the head, the bug appear.
bug

@Zylann
Copy link
Owner

Zylann commented Apr 16, 2021

Did you scale the terrain with map_scale or transform? It might be that chunk vertical bounds have a calculation error somewhere, leading them to be culled by the renderer.

my character goes through when there are slopes

Do you have an example of that? There is a slight possible discrepancy between visual and collider because visual uses diamond-shaped quads (to slightly break repetition) while collider uses Z-shaped quads. But if not that, then it might be a LOD problem where it's maybe not subdividing visuals enough? (which in turn could be caused by vertical bounds not being correct in some extreme cases).

but maybe this bug is related to the disappearing textures?

None of this seems related to textures.

What is your OS?
One experiment to try here:
Close Godot, edit addons/zylann.hterrain/native/factory.gd with a text editor, and comment out all items in the _supported_os dictionary. Open Godot and test if the problem still happens.

@Proksimas
Copy link
Author

Hey,
I am on Windows 10.
I tried your experiment and that works perfectly :D <3. The problem of the collider was fix too thanks that

By the way I tried to remove the transform ( and pass it at 0,0,0) without comment your dictionary and that work ONLY if i create a new hterrain. The old terrain doesn't work.

Thank you very much !

@Zylann
Copy link
Owner

Zylann commented Apr 16, 2021

I tried your experiment and that works perfectly :D

Ok that means there may be something fishy going on with GDNative. Removing the dictionary entry basically turns off an optimization that speeds up a few things in the plugin, instead falling back on a slower GDScript implementation.
Which Godot version are you using?

I tried to remove the transform ( and pass it at 0,0,0) without comment your dictionary and that work

That's very weird... there are strange bugs with translation related to Godot itself (this one godotengine/godot#37337, which is still open, sigh) but it should not have affected visual culling.

that work ONLY if i create a new hterrain

Even weirder. That should not have affected the issue at all 🤔 Unless you edited the file while Godot was running. When I precised to close Godot, that's really something you must do before editing any plugin file^^ (you can sometimes keep it open but there are many intricate cases where it causes race conditions so in doubt the safest route is to close)

@Zylann Zylann added bug Something isn't working Need more info labels Apr 16, 2021
@Proksimas
Copy link
Author

Proksimas commented Apr 16, 2021

I am on godot 3.2.3

Don't worry i really closed godot before ^^ But maybe i wasn't clear. comment the dict works good and i don't need to do other things.
But if i don't comment the dict, i have to create a new terrain and don't transform it ;)

@Zylann
Copy link
Owner

Zylann commented Apr 16, 2021

I wish there was a repro for this then, but you said it doesnt happen if you try to get it in a test project

@kupher
Copy link

kupher commented Oct 16, 2021

Also having the same issue in the editor.

I'm using godot 3.3.3 mono stable

here's the output from the editor

./core/rid.h:150 - Condition "!id_map.has(p_rid.get_data())" is true. Returned: __null
servers/visual/visual_server_scene.cpp:887 - Condition "!instance" is true.
./core/rid.h:150 - Condition "!id_map.has(p_rid.get_data())" is true. Returned: __null
servers/visual/visual_server_scene.cpp:780 - Condition "!instance" is true.
./core/rid.h:150 - Condition "!id_map.has(p_rid.get_data())" is true. Returned: __null
servers/visual/visual_server_scene.cpp:780 - Condition "!instance" is true.

image

@Zylann
Copy link
Owner

Zylann commented Oct 16, 2021

A hole like this one with these errors could be caused by this godotengine/godot#44642, looks like a different issue.
Other people also had variants of that issue: godotengine/godot#53374

@kupher
Copy link

kupher commented Oct 16, 2021

I noticed. I changed the chunk size to 64. seems to fix the problem on my level. I have also realize that this only happens in the editor. when in play mode everything works correctly irregardless of the chunk size.

RID.Error.mp4

@TokisanGames
Copy link
Contributor

TokisanGames commented Oct 17, 2021

The original issue, where the whole terrain disappears, might be a camera culling issue. e.g. I have noticed it mostly with particle effects. If the camera turns away from the emitter, even if the particles should still be in view, they are culled. By expanding the emitter cull distance fixes it. There might be something similar with the terrain.

Regarding the second issue with only one terrain panel disappearing, noted here #260 (comment)

This is exactly the circumstances and error message I have experienced with HTerrain and reported in godotengine/godot#53374. I do not believe there is anything that can be done with the terrain to permanently fix the issue. It's a bug in the engine (probably visualserver).

@TokisanGames
Copy link
Contributor

TokisanGames commented Oct 17, 2021

Here it just happened on my hterrain. As stated, I think this is a separate issue from OP. Switching scenes does not turn it back on. I had to close and reopen the scene to fix it.

image

@TokisanGames
Copy link
Contributor

I don't know if Op's issue is still present, but the sub-issue from @kupher has been found and fixed. It's not a heightmap issue, it's an engine issue.
You can read about it here:
godotengine/godot#53374
The fix is coming here:
godotengine/godot#54650

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Need more info
Projects
None yet
Development

No branches or pull requests

4 participants