[Partially Solved] UV coordinates wrong when adding multiple terrain detail objects?

I’m currently creating a shader for the unity terrain details using ShaderForge. While doing so, I noticed that the shader seemed not be applied properly to all of the terrain details of the scene. I particularly noticed that the wind effect from this shader, which should BEND the terrain details, actually pushed the entire detail object all over the place. After a lot of experimentation I noticed that it seems that the UV coordinates for the terrain detail objects are incorrect for the third (fourth, fifth, etc.) terrain detail object you are adding to the terrain.The first two always work as expected. Here are two gifs to visualize the problem:

The first two plant detail objects on this terrain are working like intended, the plants are attached to the ground, while the “wind” of the shader bends them around. Note how the third orange bush on the right is not only bending, but also being moved all over the place. This would make sense if there would be an issue with the UV coordinates on this detail object , since the shader uses the v coordiante to determine the amount of vector displacement that is applied, none at the bottom of the plant, and the maximum at the top.

The issue is even more visible when viewing in wireframe mode in the editor:

As soon as I delete the second, middle detail object from the terrain, the orange plant suddenly is fixed and works as intended:

Does anyone know what I am missing here or what I could do to analyze further? I would like to be able to add more than 2 different terrain detail objects with the shader working the same for all of them. If required I can open a bug report / provide a repro project.

It might be caused by automatic texture atlassing. (This would adjust the uv coordinates in the process.)

Thanks for your reply! I looked into that and did not find any info how unity handles the textures of the detail prototypes, I could imagine however that they are indeed collected in an atlas.

I made some changes in my shader to simply color the textures red when they reach a certain V-threshold, and it looks like that the V-coordinates for the different plant textures indeed start and stop at different intervals. E.g. the “working as intended” plants start at 0 and end at 0.2, and the not working plants start at 0.3 and higher. This would also hint at the textures being stored in an atlas.

I have to see if I somehow can adjust the shader so I can work around these offsets somehow, mabye I have to ask in the Shaderforge forums for help as well.

Update: After some more experimenting it seems indeed that Unity packs these terrain detail object textures into an atlas. The atlas seems to be built up as follows (The squares represent the atlas texture, the number represents the order in which the textures are packed into the atlas):

I now know in theory how I could normalize the V-coordinates for my shader, however there seems to be still an issue with the atlas or the vertex-offset in general, I posted more in detail about it in the ShaderForge thread, in case someone is interested:
https://forum.unity3d.com/threads/shader-forge-a-visual-node-based-shader-editor.222049/page-115#post-3091248

Update 2: After looking in the code of the built-in Unity Waving Grass Shader I found out that you can use the Vertex Color Alpha channel to get the same 0 > 1 interval that you would expect from the v-coordinate. I can therefore just use this as a workaround in my own shader. Again more details over here: https://forum.unity3d.com/threads/shader-forge-a-visual-node-based-shader-editor.222049/page-115#post-3095602