I am making a grass particle system that spawns grass randomly on a mesh at run time. I want to color the grass according to the colors of the mesh it is on and also capture shadows through he same method. I have tried sample mesh color however I only get black as a color. I know there are some HLSL methods to get the information I need to pass as color I just need assistance writing them and integrating it into the vfx graph.
Screenshots you attached does not show anything related to mesh or color sampling. Can you provide a bit more information? How you spawn grass and how you access color?
At me moment I am coloring the mesh by using a render texture from a camera angled at the ground and using the UVs to color the particles however they do come out with random color scattered per particle. When I do use a sample mesh node I just get black as a color. I was wondering if there’s a way to get access to the vertex buffer with an HLSL function.
This is how I am sampling the render texture to color the particles
I think mesh color should work, are you sure your mesh is correctly created with vertex colors?
Does that happen only with vertex color or UV (Tex Coord0) too?
Yes the mesh is correctly created with vertex colors. I haven’t had issues with the UVs I believe the scattered colors are due to the random placement of the particles in regards to the render texture I am using right now.
I assume you debuged colors on scene with some shader that renders mesh with it’s vertex colors, so you are 100% sure it’s uploaded to GPU with proper colors.
I see you are on 2023.2, so perhaps there is bug in your editor version? I can’t see anything else that would case vertex color to be black, so it might be bug or something blindly obvious I forgot