I am using a compute shader to generate tree instances for my terrain and although the result is added to the terrainData (treeInstances has a Length bigger than zero), I can’t find them. The only factor that I can imagine (at this point) is that I set the TemporaryDistance (an internal variable) to 0 assuming this would be the default value. I would have liked to avoid setting it at all, however because the shader struct must map to the C# struct I had to include it (to align the strides).
My main question is if anyone knows what the TemporaryDistance does, and if my value assignment could cause trouble?
I’m not a terrain dev but a quick look internally shows that it’s used as a temporary store of the current squared distance to the current active camera whilst rendering. It’s not serialized though so on the managed side it would seem to do nothing apart from allow simple marshalling between managed and native.
Again, I’m not a dev on this but what I said seems to be correct.
I resolved it, it turns out during my testing I removed the code to toggle drawTreesAndFoliage to true :(.
Thanks for your answer, it made me search in a different direction !