Sam3DX Posted July 18, 2022 Posted July 18, 2022 I made a simple spawner for a grass. Nothing fancy, just a plain one. Every time I press "Spawn world" button on the bottom it creates a new copy of a grass object on the terrain. Each time I press "Clear spawns" button to delete existing grass it removes grass from terrain, but keeps all the copies of object in terrain details. Also, after pressing the "Clear spawns" button I can not have any details on this terrain forever. I can press spawn button agian 10 times and it will add 10 more objects to terrain details but I will not see any actuall grass on the terrain. The only way to fix it is to delete the terrain and create a new one. Is this expecting behaviour? Cos it's seems quite unusable this way 😕
Sam3DX Posted July 18, 2022 Author Posted July 18, 2022 Important detail: it happens only if I use Grass as prefab with lod. If I use just a texture it all works just fine.
Peter Posted July 18, 2022 Posted July 18, 2022 Hi @Sam3DX, please note that unity itself does not support grass items with multiple LODs - I assume what might be going on is that Gaia adds the prefab to the terrain, it is not rendered correctly due to it having LODs, and when spawning again there is something in the lodded prefab that "skips" the check that Gaia performs to see if a resource has been added to the terrain already, and then re-adds it again, if I remember correctly Gaia would compare the mesh on the prototypes to see if it is the same terrain detail item, that might not work if that mesh is a child in that prefab. Clearing spawns does not fully remove the prototypes from the terrain, this can be done with the Resource Removal tool found under Advanced > Resource Management in the spawner: To fix this, you would need to take one LOD level from the prefab and turn that single LOD into a new prefab where you just have a game object with a mesh filter & mesh renderer component on it, then it should work. I would recommend to use the "Use GPU Instancing" option, this will use the newer "Instanced Mesh" rendering method for grass which is faster and usually looks better than the older method which only used a very basic vertex lit shader. 1
Sam3DX Posted July 18, 2022 Author Posted July 18, 2022 Hey, @Peter I’m using Nature Renderer, it handles the rendering of a detail prefab with LOD perfectly. The issue is that Gaia can spawn it only one time and then got broken.
Peter Posted July 23, 2022 Posted July 23, 2022 Hey @Sam3DX sorry for the delayed response, I was not aware you are using another vegetation rendering asset - in this case you can keep the prefab with LODs of course. I will try to replicate this with Gaia and should be able to provide you with a patch that fixes this issue. 1
Peter Posted July 23, 2022 Posted July 23, 2022 Hi @Sam3DX I tried to replicate the issue in 3 unity versions, 2020.3, 2021.3 and 2022.2, in all 3 versions I do not get this behavior of Gaia adding the prototype again and again when spawning. My test object was a simple game object with a LOD group and a sphere and a cube mesh as the two different LODs, with this setup the prototype was added only once when spawning. I think you might have a different setup for the object, since unity does not seem to display this message on the terrain inspector:Could you please share your unity version and ideally a screenshot / some more information about the structure of the terrain detail object?
Sam3DX Posted July 25, 2022 Author Posted July 25, 2022 Hey, @Peter I see the issue and feel confused. It's strange, but my Gaia spawner didn't add the prefab iteslf, instead it's adding a zero level from the LOD group. Here, I recored a really short video showing the prefab setup, scene setup, and a spawning issues. My grass using a complex shader, but at the core it's nothing more then regular LOD group and 3 mesh renderers as children. I'm using Unity 2021.3.6 LTS with built-in render and Gaia 2021 PRO 3.2.5 Maybe something is wrong with the way I'm adding my grass prefab to the spawner? Please, check the video I recorded, maybe you could spot something unusual. UPD. I reupload the video to youtube so it will be more convenient to check.
Solution Sam3DX Posted July 25, 2022 Author Solution Posted July 25, 2022 I found it! It's not a Gaia issue, it's a Nature Renderer issue. Gaia adding a LOD prefab exactly as expected. Nature Rrenderer is the one who changing the assigned prefab to a different object. And of course it's breaking the Gaia spawner cos it can't recognize the grass prefab and adding a new one insted (which is changing by NR as well). I reported it to the NR author. Sorry for bothering and thank you for your time.
Recommended Posts