7 votes Vote

Some tiles show up as flat planes when Draw Instanced is enabled

MapMagic Version: 2.0.8
Unity Version: 2020.2.2f1

Issue:
Some tiles appear to not generate and show up as flat planes when Draw Instanced is enabled. No errors in the console. In playmode, I am still able to traverse the terrain, as if the mesh collider is still accurate for the generated mesh - However, visually it appears as a flat plane below me.
Re-generating a couple of times will make fix the issue for the specific tiles, but then other tiles exhibit the same issue.
Tried disabling Instant Generate and manually pin, but pinned terrains exhibit the same issue.
Tried using the default Terrain Diffuse shader but issue remains as long as Draw Instanced is enabled.

Halfspacer , 07.02.2021, 15:37
Idea status: completed

Comments

Halfspacer, 07.02.2021, 15:37
Forgot to post link to screenshot
https://imgur.com/6JK1q9k
Halfspacer, 07.02.2021, 18:45
Adding a 0.25f delay to
main.terrain.gameObject.SetActive(true);
and
draft.terrain.gameObject.SetActive(true);
in TerrainTile.cs works around the issue.
Wraith, 08.02.2021, 21:52
It might be that it requires one frame to render (to pass data o instanced shader) or something. Thanks for your findings. I will look into it!
Halfspacer, 09.02.2021, 21:24
That's what I thought too, but waiting just a frame resulted in the coroutine not continuing at all (Is there maybe a StopCoroutine being called somewhere?). Also noticed a bunch of weird side-effects from my workaround, such as what looked like incorrect normals.
This makes me think there might be some other part of the code that's still affecting the terrain after we've enabled the gameobject and the instanced shader received the mesh data (So maybe the instanced mesh is received earlier rather than later).

I'm not too sure how all of that works though - New to both GPU Instancing and MapMagic. Appreciate you looking into it!
Wraith, 08.02.2021, 21:52
It might be that it requires one frame to render (to pass data o instanced shader) or something. Thanks for your findings. I will look into it!
Wraith, 17.02.2021, 15:47
Can't reproduce it in Unity 2020.1.2
It could be some specific Unity 2020.2 issue, but most probably it's something graph/scene-related. I will appreciate if you could send the scene and the graph to mail@denispahunov.ru. Thanks!
partridge, 24.03.2021, 19:22
I can reproduce this on 2020.2.2f1. I also get a strange texturing issue with some of the tiles, like not all of them are applied. See this video for example of both: https://youtu.be/oZrZQyPJtGk
RiverNyxx, 18.04.2021, 21:44
I have been coming up against this issue as well. It was minorly annoying when using the MM2 interface to generate terrains, but all I had to do was tell it to regenerate everything (maybe a couple times) to get around it.
However, I later started working with runtime manipulation of the heightmap, and I started getting this while in playmode as a result, so this went from a minorly annoying edit-time thing, to an "I can't use this at all with Draw Instanced enabled" runtime thing.
I'm also using Unity 2020.2.2f1, and have a simple scene where this is reproduced -- do you still need an example scene emailed to you?
TeoSha, 28.04.2021, 16:26
Got same issue on any 2020 versions and higher. But! When multythreading disabled everything seems fine.
RiverNyxx, 30.04.2021, 22:02
When I upgraded to Unity 2020.3.4f1, I haven't a problem since.
twobob, 24.06.2021, 05:39
I also see this.

You can recreate by just having tons of stupid nodes. Looks to be a race condition if I had to guess.
Wraith, 02.07.2021, 21:50
Fixed for 2.1.6
twobob, 03.07.2021, 20:23
I really hope this is the reason for the mixed up textures as well on the terrain layers. Getting very odd results with the current release

Leave a comment